jQuery.noConflict();

jQuery(document).ready(function() {

/* Set Height of main container on home page */
	var main = jQuery(".cms-dscases3-home .wrapper .page .main");
	if (main.height() < 628) { main.height(628); }

/**   Homepage: Featured Product Carousel */	
	    jQuery('.featured-products').cycle({			fx:         'fade',	        pager:      '.prods',	        pagerEvent: 'click'	    });
/* Set Pause event for carousel */
	jQuery(".carousel-controls a.pause").click(function(){
		if (jQuery(this).attr('id') == 'pauseIt') {
			jQuery(".featured-products").cycle("pause");
			this.id = "startIt";
		} else {
			jQuery(".featured-products").cycle("resume");
			this.id = "pauseIt";
		}
	});
	
/** Set menu drop down */ 	
	jQuery(".nav-container .nav-wrap ul li a").click (function() {
		jQuery(".nav-container .nav-wrap ul .active").removeClass("active");
		
		var clicked = jQuery(this);
		var actSubNav = jQuery(".sub-nav-container .active");
		// Save id of item clicked (this corresponds to the correct sub-nav to show)
		var navItem = jQuery(this);
		if (clicked.attr("id").length > 0) {
			   for(var i=1;i<6;++i){
              var thisid = "#sub-nav-" + i;
              sNavItem = "#sub-"+navItem.attr("id");
              if (thisid != sNavItem){
                jQuery(thisid).removeClass('active');
              }else {
                jQuery(sNavItem).addClass('active');
				          jQuery(".sub-nav-container").animate({'height':'30px'},100, function(){jQuery(sNavItem).addClass("active");});
               
              }
         }
      
 			jQuery(navItem).addClass("active").parent().addClass("active");
		}
	}); 
	
	jQuery(".main").click (function() {
		jQuery(".nav-container .nav-wrap ul .active").removeClass("active");
		jQuery(".sub-nav-container").animate({'height':'0px'},100,function(){jQuery(".sub-nav-container .active").removeClass('active');});
    jQuery(".sub-nav-container .active").removeClass('active');

	});   
	
/** Set Active Nav States for pages */	
	// All Products Page
	if (jQuery("body.cms-products") .length > 0) {
		jQuery(".nav li #nav-1").addClass("active").parent().addClass("active");
	}
	
/** Alert user if shipping to another country */
jQuery(".input-box select").change(function(){
		//console.log("hello. dont be shipping stuff anywhere else");
	});
});
