﻿$(document).ready(function(){
	
	$("#banner").slides({ 
	
		pagination: false,
		effect: 'fade',	
		preload: true,
		preloadImage: '/wp-content/themes/sun_swing/images/loading.gif',
		crossfade: true,
		play: 5000,
		pause: 10,
		hoverPause: true

	});
	
	$("ul#menu-footer-menu>li").css('text-transform','uppercase');
	
	$("input.wpsc_buy_button").click(function() {
         if($(this).parents("form:first").find("select.wpsc_select_variation[value=0]:first").length) { // if have variations and not selected prevent from clicking through
               return false;
          }
         var itemCount = parseInt($("#header-cart em.count span").text()); // selects the current count of the header cart items
         var itemQuantity = parseInt($(this).parents("#single_product_page_container, table.list_productdisplay td, #products_page_container .productcol").find("input[name=wpsc_quantity_update]").val());
        
		if (itemQuantity > 1) {
               itemCount += itemQuantity;
          } else {
               itemCount++;
          }
          $("#header-cart em.count span").text(itemCount);
     });
	 

	 $('a.anchor').click(function(){ //highlight subscribe form. 
		var pathname = window.location.pathname;
		console.log('The path nanme is: '+pathname);
		if(pathname.search('#subscribe_form'))
			console.log('inside the IF statement');
			$('#subscribe_form').addClass('highlight');
	 });
	 
	 
	 $('#nav_menu-3 ul li li li').addClass('hidden');
	 
	 $('#nav_menu-3 ul li li.current-menu-ancestor li, #nav_menu-3 ul li li.current-menu-item li').show();
	 
}); 
