$().ready(function(){
	$("#Country").change(function(){
		if($(this).val()!="AU" && $(this).val()!="NZ")
		{
		$("#state_info").hide();
		$("#State").attr("disabled", "disabled");
		$("#Suburb").attr("disabled", "disabled");
		$("#Postcode").attr("disabled", "disabled");	
		$("#hd_require").val("user_firstname, user_lastname, user_email, user_address2, user_gender,user_custom2 <{if is_object($user)}><{if $user->getID() gt 2}>,user_passwd,passcheck<{if $user->getCompany() neq '1'}>,user_company<{/if}><{/if}><{/if}>")	
		}
		else
		{
		$("#state_info").show();
		$("#State").removeAttr("disabled");
		$("#Suburb").removeAttr("disabled");
		$("#Postcode").removeAttr("disabled");
		$("#hd_require").val("user_firstname, user_lastname, user_email, user_address2, user_gender, user_city, user_stateid, user_suburb, user_postcode, user_custom2 <{if is_object($user)}><{if $user->getID() gt 2}>,user_passwd,passcheck<{if $user->getCompany() neq '1'}>,user_company<{/if}><{/if}><{/if}>");
		
		}
	});
});



function checkCountry(){
	if($("#Country").val()!="AU" && $("#Country").val()!="NZ")
	{
	$("#state_info").hide();
	$("#State").attr("disabled", "disabled");
	$("#Suburb").attr("disabled", "disabled");
	$("#Postcode").attr("disabled", "disabled");		
	$("#hd_require").val("user_firstname, user_lastname, user_email, user_address2, user_gender,user_custom2 <{if is_object($user)}><{if $user->getID() gt 2}>,user_passwd,passcheck<{if $user->getCompany() neq '1'}>,user_company<{/if}><{/if}><{/if}>")
	}
	else
	{
	$("#state_info").show();
	$("#State").removeAttr("disabled");
	$("#Suburb").removeAttr("disabled");
	$("#Postcode").removeAttr("disabled");
	$("#hd_require").val("user_firstname, user_lastname, user_email, user_address2, user_gender, user_city, user_stateid, user_suburb, user_postcode, user_custom2 <{if is_object($user)}><{if $user->getID() gt 2}>,user_passwd,passcheck<{if $user->getCompany() neq '1'}>,user_company<{/if}><{/if}><{/if}>")
	}
}


//TABS CONTROLLER

$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab

		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});


//DATEPICKER CONTROLLER

$(function() {
	$("#datepicker").datepicker();
});

//QUICKLINKS TOGGLE CONTROLLER
$(document).ready(function(){

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
});


//Initialize FAQ Accordian:
ddaccordion.init({
	headerclass: "technology", //Shared CSS class name of headers group
	contentclass: "thelanguage", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["closedlanguage", "openlanguage"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
});


//Initialize Dropdown Menu:
$(document).ready(function(){
	$('#multi-ddm').dropDownMenu({timer: 1000, parentMO: 'parent-hover', childMO: 'child-hover1'});
});

/**
//Initialize Homepage banner slider:
$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'		
		animSpeed:300, //Slide transition speed
		pauseTime:8000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true,
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...		
		keyboardNav:true, 
		pauseOnHover:true //Stop animation while hoveri
	});
});


**/
//Initialize Homepage banner slider:
$(window).load(function() {
	$('#bottomPanel').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'		
		animSpeed:300, //Slide transition speed
		pauseTime:7000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false,
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...		
		keyboardNav:true, 
		pauseOnHover:true //Stop animation while hoveri
	});
});

//Another tab function.....
$(document).ready(function() {
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabssd li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabssd li").click(function() {
		$("ul.tabssd li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});


//Homepage news box
$(document).ready(function(){
	$("#newsbox").CarouSlide({animType:"none", hoverLinks: true, autoAnim:true, animTime:1200});
});

//And yet Another tab function.....
$(document).ready(function() {

	//When page loads...
	$(".tab_cont").hide(); //Hide all content
	$("ul.ret_tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_cont:first").show(); //Show first tab content
	//$(".ret_tab2").css("padding", "0");
	//On Click Event
	$("ul.ret_tabs li").click(function() {

		$("ul.ret_tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_cont").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});

//Image gallery
    $(function(){
        $("div.other_photos").carousel({loop: true
 });
    });
	
	 $(document).ready(function() {
	  
	  $('.action_overlay').mouseover(function() {
        $('.description_bg').slideDown('slow');
		$('.description_text').fadeIn('slow');
		$('.image_total').fadeIn('slow');
    	return false;
      });
	  
	    $('.action_overlay').mouseout(function() {
       $('.description_bg').slideUp('slow');
	   $('.description_text').fadeOut('slow');
	   $('.image_total').fadeOut('slow');
    	return false;
      });
	  
	  });
	 
//Homepage banner scroll
	$(document).ready(function(){				
				
		//$('#slider-code').tinycarousel({ pager: true, interval: false, intervaltime: 2000, duartion: 500});
		$('#slider-code').tinycarousel({ pager: true, interval: true, intervaltime: 8000, animation: true, duration: 1000 });
		$("ul.pager li a").click(function(){
			$("#slider-code").tinycarousel_stop();
			$f().stop();
		});
	});

//Suppliers pager	 
	    
    function getSearch(var1,var2,var3,page)
    {
        //$('#start').val(page);
        window.location.href='index.php?action=supplier&form_name=list_suppliers&form_action=relate_products&start='+page+'&s_field=supp_firstname&s_order=asc&per_page=15';
        //$('#frm_search').submit();
    }

//Products pager

	function getSearchProd(var1,var2,var3,page,searchdate,searchartist,searchvenue,expire)
    {
        //$('#start').val(page);
        window.location.href='index.php?action=prodcatalogue&form_name=all_search&start='+page+'&s_field='+var2+'&s_order=asc&per_page=9&merchant_id='+var1+'&start_date='+searchdate+'&supplier_ids='+searchartist+'&brand='+searchvenue+'&expire='+expire+'';
        //$('#frm_search').submit();
    }
	

	



