// JavaScript Document
var $j = jQuery.noConflict();


$j(document).ready(function(){
		//at first hide the sub lists (if javascript is disabled all sublists remain usable)
		$j("#sideNav>li>ul").hide();		
		//Open the subnav for pages needed
		$j("body.pod-page-aw11 ul#sideNav li ul").show();
		$j("body.page-id-113 ul#sideNav li ul").show();
		$j("body.page-id-12 ul#sideNav li ul").show();
		$j("body.page-id-115 ul#sideNav li ul").show();
		$j("body.page-id-222 ul#sideNav li ul").show();
		$j("body.wpsc ul#sideNav .store ul").show();
		$j("body.single-wpsc-product ul#sideNav .store ul").show();
		$j("body.wpsc_product_category ul#sideNav .store ul").show();

		//when a link (that is a child of #vnav) is clicked call a function
		$j("#sideNav a").click(function(){
			//if the clicked link has a sibling ul, stop following the link and slide open (or close) the ul
			if($j(this).next("ul").length > 0) {
				$j(this).next("ul").slideToggle();
				return false;
			}
		});
	});			
		$j(document).ready(function(){
				$j(".page-id-3 #leftCol").css(/*"visibility","hidden", */"width","0px");												
				$j(".heroFade").show();	
				$j(".homeBanner").show();		
    		$j('.homeBanner').click(function(){
      		$j('.heroFade, .homeBanner, .heroFadeWrap').fadeOut('500');
					$j(".page-id-3 #leftCol").css("width","280px");
					//$j(".page-id-3 #leftCol").fadeIn('1000');	
					//$j('#leftCol').css("display","inline-block");
      	return false;
				
    });
  }); 
		
	$j(document).ready(function() { 
			$j('.heroFade').cycle({
				fx:	'fade',
				speed: 1500,
				timeout: 4000
				});
		});		
	
$j(function()
			{
			$j('#section').jScrollPane({showArrows:false});
		});

 
 
function mycarousel_initCallback(carousel) {
    $j('.jcarousel-control a').bind('click', function() {
        carousel.scroll($j.jcarousel.intval($j(this).text()));
        return false;
    });

    $j('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = $j.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    $j('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    $j('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

// Ride the carousel...
$j(document).ready(function() {
    $j("#mycarousel").jcarousel({
        scroll: 3,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});


// Shopping cart
// Hide Shipping and Order panels
$j(document).ready(function() {
	$j('.shipDetails, .yourOrder, .yourPayment').hide();
	$j("#wpsc_checkout_form_18").attr('title', 'ausbillingstate');
	$j("#wpsc_checkout_form_14").attr('title', 'ausshippingstate');
	//$j("#wpsc_checkout_form_18")[0].title = "ausbillingstate";
	//$j("#wpsc_checkout_form_14")[0].title = "ausshippingstate";
	// Show Shipping details and hide Cart details
	$j('.checkOutBtn').click(function(){
			$j('.shipDetails').show();
			$j('.yourCart').hide();
			$j('.stepTwo').addClass('active');
			$j('.stepOne').removeClass('active');
			return false;
	});
	$j('.backCartBtn').click(function(){
			$j('.yourCart').show();
			$j('.shipDetails').hide();
			$j('.stepOne').addClass('active');
			$j('.stepTwo').removeClass('active');
			return false;
	});
	$j('.FinalOrderBtn').click(function(){
			$j('.yourOrder').show();
			$j('.shipDetails').hide();
			$j('.stepThree').addClass('active');
			$j('.stepTwo').removeClass('active');
			return false;
	});
	$j('.backShipBtn').click(function(){
			$j('.yourOrder').hide();
			$j('.shipDetails').show();
			$j('.stepTwo').addClass('active');
			$j('.stepThree').removeClass('active');
			return false;
	});
	$j('.finalCheckOutBtn').click(function(){
			$j('.yourOrder').hide();
			$j('.yourPayment').show();
			$j('.stepFour').addClass('active');
			$j('.stepThree').removeClass('active');
			return false;
	});
	$j('.backOrderBtn').click(function(){
			$j('.yourOrder').show();
			$j('.yourPayment').hide();
			$j('.stepThree').addClass('active');
			$j('.stepFour').removeClass('active');
			return false;
	});
	
});	

// Show hide content dependent on Payment method selected

$j(function(){
	$j(".ddpayment").hide();
	$j(".pppayment").hide();
  if ($j(".custom_gateway_wpsc_merchant_testmode").length > 0){ $j(".pppayment").show(); }

  // add functionality for the onclicks here
  $j(".custom_gateway_wpsc_merchant_testmode").click(function() {
    $j(".ddpayment").show();
		$j(".pppayment").hide();
  });

  $j(".custom_gateway_wpsc_merchant_paypal_standard").click(function() {
    $j(".ddpayment").hide();
		$j(".pppayment").show();
  });
});






									 
