// JavaScript Document

// Menu images accueil
   function menu1()
    {
        var imgPath = new String();
        imgPath = document.getElementById("home_gauche_featured").style.backgroundImage;
        document.getElementById("home_gauche_featured").style.backgroundImage = "url(http://www.slimarin.com/skin/frontend/slimarin/default/images/regime.jpg)";
    }
	
    function menu2()
    {
        var imgPath = new String();
        imgPath = document.getElementById("home_gauche_featured").style.backgroundImage;
        document.getElementById("home_gauche_featured").style.backgroundImage = "url(http://www.slimarin.com/skin/frontend/slimarin/default/images/substitus-de-repas.jpg)";
    } 
	
	
    function menu3()
    {
        var imgPath = new String();
        imgPath = document.getElementById("home_gauche_featured").style.backgroundImage;
        document.getElementById("home_gauche_featured").style.backgroundImage = "url(http://www.slimarin.com/skin/frontend/slimarin/default/images/minceur.jpg)";

    } 	
	
	
    function menu4()
    {
        var imgPath = new String();
        imgPath = document.getElementById("home_gauche_featured").style.backgroundImage;
        document.getElementById("home_gauche_featured").style.backgroundImage = "url(http://www.slimarin.com/skin/frontend/slimarin/default/images/complement-alimentaires.jpg)";

    } 		

	
	
// Liste des carousels
    $j(function(){
       			$j("div.carousel").carousel({ autoSlide: true, loop: false, autoSlideInterval: 5000, delayAutoSlide: 2000});

		
    });
	
	
    $j(function(){
       			$j("div.carousel_droite").carousel({ autoSlide: true, loop: false, autoSlideInterval: 5000, delayAutoSlide: 2000});

		
    });	
	
    $j(function(){
       			$j("div.droite_home").carousel({ autoSlide: false, loop: false, autoSlideInterval: 5000, delayAutoSlide: 2000});

		
    });
	
	
    $j(function(){
       			$j("div.carousel_large").carousel({ autoSlide: false,  loop: false, autoSlideInterval: 5000, delayAutoSlide: 2000});

		
    });
	
	
	
// Tabs footer

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

$j.fn.simpleTabs = function(){ 
	//Default Action
	$j(this).find(".tab_content").hide(); //Hide all content
	$j(this).find("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$j(this).find(".tab_content:first").show(); //Show first tab content
	
	//On hover Event
	$j("ul.tabs li").hover(function() {
		$j(this).parent().parent().find("ul.tabs li").removeClass("active"); //Remove any "active" class
		$j(this).addClass("active"); //Add "active" class to selected tab
		$j(this).parent().parent().find(".tab_content").hide(); //Hide all tab content
		var activeTab = $j(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$j(activeTab).show(); //Fade in the active content
		return false;
	});
};//end function

$j("div[class^='simpleTabs']").simpleTabs(); //Run function on any div with class name of "Simple Tabs"


});



// Tabs fiche produit

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

$j.fn.tableau_produit = function(){ 
	//Default Action
	$j(this).find(".tab_content").hide(); //Hide all content
	$j(this).find("ul.tabs_produit li:first").addClass("active").show(); //Activate first tab
	$j(this).find(".tab_content:first").show(); //Show first tab content
	
	//On hover Event
	$j("ul.tabs_produit li").click(function() {
		$j(this).parent().parent().find("ul.tabs_produit li").removeClass("active"); //Remove any "active" class
		$j(this).addClass("active"); //Add "active" class to selected tab
		$j(this).parent().parent().find(".tab_content").hide(); //Hide all tab content
		var activeTab = $j(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$j(activeTab).show(); //Fade in the active content
		return false;
	});
};//end function

$j("div[class^='tableau_produit']").tableau_produit(); //Run function on any div with class name of "Simple Tabs"


});




/* Poup compte */
	
var knowallaboutyr0done		 	= 0;
var memenu0done		 			= 0;
var boutiquemenu0done 			= 0;
clearancemenudone 				= 0;


var activeCategorySeqId = null;



function activatemenu(id, storedlocation, menu, linkmenu, linktab, classover, classtabover, contenttoload) {
	var trackerID;
	$j(id).mouseover(function() {				 	
		if(eval(storedlocation) == 0) {
			if (contenttoload) {
				loadcontent(contenttoload, menu)
			}
			trackerID = window.setTimeout('showMenu("' + storedlocation + '","' + menu + '","' + linkmenu + '","' + classover + '","' + linktab + '","' + classtabover + '")',350);
		} else { 
			window.clearTimeout(trackerID); }
	   });
		$j(id).mouseout(function() {
			window.clearTimeout(trackerID);
			trackerID = window.setTimeout('clearMenu("' + storedlocation + '","' + menu + '","' + linkmenu + '","' + classover + '","' + linktab + '","' + classtabover + '")',250);
	   }); 
		$j(menu).mouseover(function() {
			window.clearTimeout(trackerID);
			$j(menu).show("");
			$j(linkmenu).addClass(classover);
			if($.browser.msie) {
				$j("input.formhider").addClass("hideform");$j("select.formhider").addClass("hideform");
			}
	   }); 
		$j(menu).mouseout(function() {
			window.clearTimeout(trackerID);
			trackerID = window.setTimeout('clearMenu("' + storedlocation + '","' + menu + '","' + linkmenu + '","' + classover + '","' + linktab + '","' + classtabover + '")',250);
	   });	
}



selectToHideT = ["by_price","contactMechId","quantite_1","FTCOLOR", "QUANTITY"];
function showMenu(storedlocation, menu, linkmenu, classover, linktab, classtabover) {
		for(var i=0; i < selectToHideT.length ; i++){
			if(document.getElementById(selectToHideT[i])!=null && document.getElementById(selectToHideT[i])!=undefined)
				displayElement(selectToHideT[i], "none");
		}	
		eval(storedlocation+"=1;");
    	$j(menu).fadeIn("fast"); 
		$j("div").remove(".errorform");
		$j("div").remove(".errorform2");	
		$j(linkmenu).addClass(classover);
		$j(linktab).addClass(classtabover);
		if($.browser.msie) {
			$("input.formhider").addClass("hideform");$("select.formhider").addClass("hideform");
		}
}
 function clearMenu(storedlocation, menu, linkmenu, classover, linktab, classtabover) {
 		for(var i=0; i < selectToHideT.length ; i++){
			if(document.getElementById(selectToHideT[i])!=null && document.getElementById(selectToHideT[i])!=undefined)
				displayElement(selectToHideT[i], "");
		}
		eval(storedlocation+"=0;");
		$j(menu).stop();
		$j(menu).fadeOut("");
		$j(linkmenu).removeClass(classover);
		if("#boutique-menu"+activeCategorySeqId != linktab)
			$(linktab).removeClass(classtabover);
		$j("div").remove(".errorform");
		$j("div").remove(".errorform2");	
		if($.browser.msie) {
			$("input.formhider").removeClass("hideform");$("select.formhider").removeClass("hideform");
		}
}

function menuNavigationMe(){
	var i=0;
	while (document.getElementById("boutique-menu"+i)){
		activatemenu("#me-menu"+i, "memenu"+i+"done", "#me"+i, "#me"+i, "", "me_hover", "");
		i++;
	}
}


function menuNavigationBo(){
	var i=0;
	while (document.getElementById("boutique-menu"+i)){
		activatemenu("#boutique-menu"+i, "boutiquemenu"+i+"done", "#boutique"+i, "#boutique"+i, "#boutique-menu"+i, "boutique_hover", "boutique-categ-"+i+"_hover");
		i++;
	}
}


var myMenuHTML="";
isDocReady = false;
var menuTimer = 0; 
$j(document).ready(
	function(){
		isDocReady = true;
		
			menuNavigationMe();
			menuNavigationBo();
		
	}
);
	

