
	$(document).ready(function($) {

		swapValue = [];
		$("#Search input.text").each(function(i){
		   swapValue[i] = $(this).val();
		   $(this).focus(function(){
			  if ($(this).val() == swapValue[i]) {
				 $(this).val("");
			  }
			  $(this).addClass("focus");
		   }).blur(function(){
			  if ($.trim($(this).val()) == "") {
				 $(this).val(swapValue[i]);
			 $(this).removeClass("focus");
			  }
		   });
		});	

		$('#slider-wrap').cycle({ 
		    fx:     'scrollHorz', 
		    speed:  1500, 
		    timeout: 4000, 
		    pager:  '#slider-pagination-links',
		    fit: true,
		    after: onAfter
		});

		$('#product-gallery-images').cycle({ 
		    fx:     'fade', 
		    speed:  'fast', 
		    timeout: 0, 
		    fit: true,
		    after: onGalleryAfter
		});

		$("#navigation-alpha li.parent").hoverIntent( {    
		     over: showNav,
		     timeout: 500,
		     out: hideNav
		} );

		$('.showOnClick a').click(function(){
			$(this).hide();
			$('.showOnClickContainer').show();
		});

		$('#product-gallery-thumbs-inner a').click(function() { 
		    $('#product-gallery-images').cycle($(this).index()); 
		    return false; 
		});

		$('.button-update').click(function() {
			$('#cart-contents').submit();
			return false;
		});
		
		$('.button-shipping').click(function() {
			$('#Form_ShippingForm').submit();
			return false;
		});

		$('#Form_Form_Country').change(function () {
			
			var selectedMethod = $("#Form_Form_Country option:selected").val();
			
			if (selectedMethod != 'AU'){
				$("#State").hide();
				$("#StateOther").show();
			} 
			else {
				$("#State").show();
				$("#StateOther").hide();
			}
		});
		
		$('#Form_ContactForm_Country').change(function () {
			
			var selectedMethod = $("#Form_ContactForm_Country option:selected").val();
			
			if (selectedMethod != 'AU'){
				$("#State").hide();
				$("#StateOther").show();
			} 
			else {
				$("#State").show();
				$("#StateOther").hide();
			}
		});

	});

	function onAfter() { 
		var ThisText = $(this).children('a').attr('title');
	    $('#slider-pagination-title p').html(ThisText); 
	}

	function onGalleryAfter() { 
		var ThisText = $(this).attr('alt');
	    $('#product-gallery-description span').html(ThisText); 
	}

	function showNav(){
		$(this).children('ul').slideDown('fast');
	}

	function hideNav(){
		$(this).children('ul').hide();
	}
	
