Cufon.replace('#banner h1, #footNav h6, #whichRight h1, #which-is-right h1, .mini-livechat h4, h6, h2.cufon');

$j = jQuery.noConflict();
mce_jQuery = jQuery;
jQuery(document).ready(function(){	
  
	// clear search default text on focus
	jQuery(".clearDefault").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
	// submit forms on link click
	jQuery(".btnSearchTop").click(function() {
		var form = jQuery(this).parents('form:first');
		form.submit();
		return false;
	});
	// show phone number on hover
	jQuery("h2#phone").hover(function(){
		jQuery("h2#phone > .normal").hide();
		jQuery("h2#phone > .hover").show();
	},function(){
        jQuery("h2#phone > .normal").show();
		jQuery("h2#phone > .hover").hide();
    });
    
    // show currency selection on hover (top menu)
  var curtimer;
	jQuery("#currencyPopLink, #currencyPop").hover(function(){
		jQuery("#currencyPop").fadeIn(200);
		clearTimeout(curtimer);
	},function(){
    curtimer = setTimeout(function(){
      jQuery("#currencyPop").fadeOut(200);
    },200);
  });
  
  // show currency selection on hover (footer)
  var curtimer;
  jQuery("#currencyPopLink3, #currencyPop3").hover(function(){
  	jQuery("#currencyPop3").fadeIn(200);
  	clearTimeout(curtimer);
  },function(){
    curtimer = setTimeout(function(){
      jQuery("#currencyPop3").fadeOut(200);
    },400);
  });
  
  // show currency selection on hover (product view page)
  jQuery("#currencyPopLink2, #currencyPop2").hover(function(){
  	jQuery("#currencyPop2").fadeIn(200);
  	clearTimeout(curtimer);
  },function(){
    curtimer = setTimeout(function(){
      jQuery("#currencyPop2").fadeOut(200);
    },400);
  });
    
    // show newsletter info on ? hover
	jQuery("#q, #q2, #q3, #what").hover(function(){
		jQuery("#newsPop").fadeIn(200);
	},function(){
        jQuery("#newsPop").fadeOut(200);
    });
    // ingredients table
    jQuery("#ingredients .san").hide();
	jQuery("#showSan").click(function() {
		jQuery("#ingredients .san").show();
		jQuery("#ingredients .lat").hide();
		return false;
	});
	jQuery("#showLat").click(function() {
		jQuery("#ingredients .san").hide();
		jQuery("#ingredients .lat").show();
		return false;
	});

	// accordions
	jQuery(".accordion a.title").click(function() {
		jQuery(this).parent().parent().find("li p").slideUp(200);
		jQuery(this).parent().parent().find("li p").removeClass("open");
		jQuery(this).parent().parent().find("li a.title").removeClass("on");
		jQuery(this).next().slideDown(200);
		jQuery(this).addClass("on");
		return false;
	}).next().not(".open").hide();

    // fancy select boxes
	jQuery("#options select").sSelect();


	// hide left side buttons if screen is too small
  var checkWidth = function() {
		if(jQuery(window).width() < 1080){
			jQuery("#fdbk_tab").hide();
		} else {
			jQuery("#fdbk_tab").show();
		}
  };
	jQuery(window).bind("resize", checkWidth);
  checkWidth();

  // clean up residue from plugins
  //jQuery("#footer").nextAll(":not(#fancybox-overlay, #fancybox-wrap, #fdbk_tab, #fdbk_overlay, #svluUnder)").css('background-color',"#3D3D3E").css('position','fixed');
  
  
  // homepage nav flyout
  jQuery(".nav-Left li.flyout ul").width(0);
  jQuery(".nav-Left li.flyout").mouseover(function() {
  	jQuery(this).find("ul").stop().animate( {width: 200}, 200 );
  }).mouseout(function() {
  	jQuery(this).find("ul").stop().animate( {width: 0}, 200, function(){ jQuery(this).hide(); } );
  }); 
  
  
  
  
});

