var lost_focus = false;
var lost_focus_div = false;
var hint_timeout;
var currentCocktailVersion = 1;
var flash_promo;
var intervalVar;
var monInt;


function getCookie(c_name){
  if (document.cookie.length>0){
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1){ 
      c_start=c_start + c_name.length+1; 
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
  return "";
}

function setCookie(c_name, value, expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) +
	';path=/';
}

function rollOver(which){ 
	which.src = which.src.replace("_of","_ov");
}

function rollOut(which){ 
	which.src = which.src.replace("_ov","_of");
}

function getY(oElement){
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX(oElement){
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function close_infolettre_box(){
	document.getElementById("infolettre_iframe_box").style.display = "none";
}

function close_infolettre_over(){
	document.getElementById("infolettre_cancel_button").src = document.getElementById("infolettre_cancel_button").src.replace(/_of/, "_on");
	document.getElementById("infolettre_cancel_text").style.textDecoration = "underline";
}

function close_infolettre_out(){
	document.getElementById("infolettre_cancel_button").src = document.getElementById("infolettre_cancel_button").src.replace(/_on/, "_of");
	document.getElementById("infolettre_cancel_text").style.textDecoration = "none";
}


function checkform(lang)
{
	var doc = document.OptForm;
	if (lang == "fr") {
		if(doc.OFC4_Optin_OptinField_EMail.value == "" || doc.OFC4_Optin_OptinField_EMail.value == "Inscrivez votre courriel"){
			doc.OFC4_Optin_OptinField_EMail.value = "Inscrivez votre courriel";
			doc.OFC4_Optin_OptinField_EMail.style.color = "red";
			return false;
		}	
	}
	if (lang == "en") {
		if(doc.OFC4_Optin_OptinField_EMail.value == "" || doc.OFC4_Optin_OptinField_EMail.value == "Enter your email "){
			doc.OFC4_Optin_OptinField_EMail.value = "Enter your email ";
			doc.OFC4_Optin_OptinField_EMail.style.color = "red";
			return false;
		}
	}
/*	return true;*/
	window.parent.open_infolettre_box(lang,doc.OFC4_Optin_OptinField_EMail.value);
}

function erase(field)
{
	var doc = document.OptForm;
	if(doc.OFC4_Optin_OptinField_EMail.value == "" || doc.OFC4_Optin_OptinField_EMail.value == "Inscrivez votre courriel"){
			field.value = "";
			field.style.color = "#000000";
		}
	}

function open_infolettre_box(lang, email){
	document.getElementById("infolettre_iframe").src = "http://infocourriels.saq.com/Espace_Cocktail/fr/inscription.php?email=" + email;
	if (lang == "en") {
		document.getElementById("infolettre_iframe").src = "http://infocourriels.saq.com/Espace_Cocktail/en/inscription.php?email=" + email;
	}
	document.getElementById("infolettre_iframe_box").style.display = "block";
	document.getElementById("infolettre_iframe_box").style.position = "absolute";
	document.getElementById("infolettre_iframe_box").style.left = getX(document.getElementById("info_lettre")) + "px";
	document.getElementById("infolettre_iframe_box").style.top = (getY(document.getElementById("info_lettre")) - 197)  + "px";
}

function checkKey(lang,e) {
	if (!e) var e = window.event;

	if (e.keyCode) {
		code = e.keyCode;

	} else if (e.which) {
		code = e.which;
	}
	if (code == 13) {
		checkform(lang);
	}
	return false;
}

function str_replace(search, replace, subject) {
    var f = search, r = replace, s = subject;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
 
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
    return sa ? s : s[0];
}
function compare(string, srch){
	var clean_src = new Array('ÄÀÁÂ', 'ËÈÉÊ', 'ÏÌÍÎ', 'ÖÒÓÔ', 'ÜÙÚÛ');
	var clean_dst =  new Array('A', 'E', 'I', 'O', 'U');
	var clean_srch = srch.toUpperCase();
	var clean_string = string.toUpperCase();
	for(var x=0;x<clean_src.length;x++) {
		for(var y=0;y<clean_src[x].length;y++) clean_srch = str_replace(clean_src[x][y], clean_dst[x], clean_srch);
		for(var y=0;y<clean_src[x].length;y++) clean_string = str_replace(clean_src[x][y], clean_dst[x], clean_string);
	}
	return (clean_string.indexOf(clean_srch) > -1);
}

var lang = (this.location.href.indexOf("/en/")>-1?'en':'fr');
var last_search = ""; 
var last_xml = null;

function getHints(string, isUp){
	lost_focus = false;	
	if(string.length>2){
		var box = document.getElementById("hints_down");		
		if (isUp == true) {
			var box = document.getElementById("hints_up");
		}
			
		box.innerHTML = (lang == 'fr'? 'chargement...': 'loading...');
		box.style.display = "block";

		if((string.substring(0, last_search.length) == last_search) && (last_search.length > 2)) {
			parseXMLHints(last_xml, string, isUp);
		}else{
			var hints_url = base_url + lang + '/services/get_hints';
			new Ajax.Request(
				hints_url,
				// addrese su script				
				{
					method: 'post',
					parameters: {input: string},
					// query = nom du parametre					
					onSuccess: function(transport) { 
						last_xml = transport.responseXML;
//						alert(last_xml);
						parseXMLHints(last_xml, string, isUp);
						last_search	= string;
					},
					onFailure: function() { 
						var box = document.getElementById("hints_down");
						if (isUp == true) {
							var box = document.getElementById("hints_up");
						}
						box.innerHTML = "Communication Error";
					}
				}
			);
		}
	}
}

function parseXMLHints(xml, string, up){
	var loopCount = 0;
	var box = document.getElementById("hints_down");
	if (up == true) {
		var box = document.getElementById("hints_up");
	}
	box.innerHTML = "";
	var hints = xml.getElementsByTagName("item") ;
//	alert(hints[0]);
	for(var x=0;x<hints.length;x++){
		if(compare(hints[x].firstChild.nodeValue, string)){
			thisHint = hints[x].firstChild.nodeValue.replace("'","&apos;");
			box.innerHTML += "<li onclick='setHint(\""+ thisHint+"\");'>" + hints[x].firstChild.nodeValue + "</li>";
			loopCount++;
		}
	}
	if (loopCount != 0) {
		box.innerHTML = "<ul id='hints_ul'>" + box.innerHTML;
		box.innerHTML += "</ul>"
		document.getElementById("hints_ul").lastChild.style.border="0px";
	}else{
		document.getElementById("hints_down").style.display="none";
		document.getElementById("hints_up").style.display="none";
	}
	if (up == true) {
		box.style.top = (190-(21*loopCount)+2) + "px";
	}
}

function getSWF(swfID){
	if(document[swfID]){
		return document[swfID];
	}else if(window[swfID]){
		return window[swfID];
	}else{
		return {};
	}
}

/* OBSOLETE */
function setHint(string){
	document.getElementById("hints_up").style.display = "none";
	document.getElementById("hints_down").style.display = "none";
	getSWF('search_panel').stringSearchResult(string);
}


/*
	Communication between searchbar and results (flash)
*/
var comSearchResults = {
	isSearchReady: false,
	isResultsReady: false,
	isReady: false,
	waitingSearch: '',
	searchIsReady: function(){
		comSearchResults.isSearchReady = true;
		comSearchResults.checkReady();
	},
	resultsIsReady: function(){
		comSearchResults.isResultsReady = true;
		comSearchResults.checkReady();
	},
	checkReady: function(){
		if(comSearchResults.isSearchReady && comSearchResults.isResultsReady){
			comSearchResults.isReady = true;
			getSWF('search_panel').resultsReady();
			
			//if search already done
			if(comSearchResults.waitingSearch){
				comSearchResults.searchFor(comSearchResults.waitingSearch);
			}else if(comSearchResults.waitingIds){
				setCocktailIdsToCookie(comSearchResults.waitingIds);
				showTheseIDs(comSearchResults.waitingIds);
			}
		}
	},
	searchFor: function(sSearch){
		setSearchToCookie(sSearch);
		setCocktailIdsToCookie(null);
		//send search to results.swf
		if(comSearchResults.isReady){
			setSearchToCookie(sSearch);
			getSWF('searchContainer').searchFor(sSearch);
		}else{
			comSearchResults.waitingSearch = sSearch;
		}
	},
	showTheseIDs: function(ids){
		//send IDs to results.swf
		setCocktailIdsToCookie(ids);
		if(comSearchResults.isReady){
			getSWF('searchContainer').showTheseIDs(ids);
		}else{
			comSearchResults.waitingIds = ids;
		}
	},
	openSearch: function(){
		getSWF('search_panel').openSearch();
	},
	clearSearch: function(){
		setSearchToCookie(null);
		setCocktailIdsToCookie(null);
		getSWF('search_panel').clearSearch();
	},
	setType: function(s){
		getSWF('search_panel').setType(s);
	},
	resultGotoProduct:function(ids,rational, searchInput, url) {
		setCocktailIdsToCookie(ids);
		setSearchToCookie(searchInput);
		setRationalToCookie(rational);
		window.location = baseURL+url;
	},
	searchGotoResults:function(ids, url) {
		setCocktailIdsToCookie(ids);
		window.location = baseURL+url;
	}
}

var promosLoading = {
	isReady: false,
	currentID: 0,
	errorTimer: null,
	instant: false,
	swf_loaded: 0,
	swfs: [
		{ isReady: false, isFinish: false, id: 'search_panel'},
		{ isReady: false, isFinish: false, id: 'flashFeed'},
		{ isReady: false, isFinish: false, id: 'flashPromos'}
	],
	swfReady: function(id){ //called from swf, flash is ready without content
		promosLoading.swfs[id].isReady = true;
		if(promosLoading.instant){
			getSWF(promosLoading.swfs[id].id).startLoading();
		}else{
			promosLoading.checkReady();
		}
	},
	swfFinish: function(id){ //called from swf, content loaded
		if(!promosLoading.swfs[id].isFinish){
			promosLoading.swfs[id].isFinish = true;
			promosLoading.currentID++;
			promosLoading.loadNext();
		}
	},
	checkReady: function(){
		clearTimeout(promosLoading.errorTimer);
		var l = promosLoading.swfs.length;
		for(var i = 0; i < l; i++){
			if(!promosLoading.swfs[i].isReady){
				//not ready
				promosLoading.errorTimer = setTimeout(promosLoading.readyTooLong, 15000);
				return;
			}
		}//for ends, means swfs are ready
		promosLoading.isReady = true;
		promosLoading.loadNext();
	},
	loadNext: function(){
		clearTimeout(promosLoading.errorTimer);
		if(promosLoading.currentID < promosLoading.swfs.length){
			r=getSWF(promosLoading.swfs[promosLoading.currentID].id);
			if(r.startLoading) {
				promosLoading.swf_loaded++;				
				r.startLoading();
			}
			promosLoading.errorTimer = setTimeout(promosLoading.finishTooLong, 15000);
		}else{
			//all swfs are finish
//			alert(promosLoading.swf_loaded);
			promosLoading = null; //free memory
		}
	},
	readyTooLong: function(){
		promosLoading.instant = true;
		clearTimeout(promosLoading.errorTimer);
		promosLoading.loadNext();
		var l = promosLoading.swfs.length;
		for(var i = 0; i < l; i++){
			if(promosLoading.swfs[i].isReady){
				//ready
				getSWF(promosLoading.swfs[i].id).startLoading();
				return;
			}
		}//start loading for ready swfs
	},
	finishTooLong: function(){
		promosLoading.currentID++;
		promosLoading.loadNext();
	}
}

function resizeSearch(newHeight){ document.getElementById("search_panel").style.height = newHeight + 'px'; }
    	
function set_timer(){
	if(lost_focus_div && lost_focus){
  	clearTimeout(hint_timeout);
    hint_timeout = setTimeout("hide_hints()",1500)
  }
}

function hide_hints(){
	if (lost_focus_div == true){
		document.getElementById("hints_up").style.display = "none";
		document.getElementById("hints_down").style.display = "none";
	}	  	
}

function on_change_focus(focus){

	if (focus){
		clearTimeout(hint_timeout);
	}else{
		clearTimeout(hint_timeout);
		lost_focus_div = true;
		hint_timeout = setTimeout("hide_hints()",1500)
		//hide_hints();
	}
	lost_focus = !focus;
}

function share_this(){
	if(document.getElementById('share_this').style.display == 'block'){
		document.getElementById('share_this').style.display = 'none';
	}else{
		document.getElementById('share_this').style.display = 'block';
	}
}

var spaceout= false;

function spacer(){

	intervalVar = 0;
	monInt = setInterval ( "spacerInt()", 2000);
}

function spacerInt(){
		intervalVar++;
		if(!spaceout) {
		spaceout = true;
		if(document.getElementById("anecdote_fr")){
			document.getElementById("spacer").style.height=(document.getElementById("anecdote_fr").offsetHeight + 20) + "px"
		}
		if(document.getElementById("anecdote_en")){
			document.getElementById("spacer").style.height=(document.getElementById("anecdote_en").offsetHeight + 20) + "px"
		}
		
		if(document.getElementById("promo")){
			document.getElementById("spacer_promo").style.height=(document.getElementById("promo").offsetHeight + 20) + "px"
		}
		if(document.getElementById("promo")){
			document.getElementById("spacer_promo").style.height=(document.getElementById("promo").offsetHeight + 20) + "px"
		}
/*
	Si un mode s'ajoute dans le URL --- document.location.href.indexOf("/nouveau mode/"
	L'ajouter dans la condition ci-dessous, pour obtenir le meme comportement du -- spacer 
*/		
		if(document.location.href.indexOf("/detail/") > -1 || document.location.href.indexOf("/preview/") > -1 || document.location.href.indexOf("/featured/") > -1 || document.location.href.indexOf("/punch/") > -1 || document.location.href.indexOf("/sans/") > -1) {
			var divHeight;
			if(document.getElementById("cocktails_regs") && document.getElementById("alcool_autre")) {
				var regsHeight = document.getElementById("cocktails_regs").offsetHeight;
				
				var autreHeight = document.getElementById("alcool_autre").offsetHeight;
				
				var browser=navigator.appName;
				var b_version=navigator.appVersion;
				var version=parseFloat(b_version);
				if ((browser=="Microsoft Internet Explorer") && (version>=4)){
					if(document.getElementById("promo_img")){ autreHeight = 20; }
				}
				
				if(document.getElementById("promo")){autreHeight = autreHeight+document.getElementById("promo").offsetHeight;
				if(document.getElementById("alcool_list")){autreHeight = autreHeight+document.getElementById("alcool_list").offsetHeight;}
				}

				if(document.getElementById("promo_img")){ autreHeight = autreHeight+252; }
				autreHeight = autreHeight+256;
				if(regsHeight<autreHeight){
					divHeight = autreHeight;
				}else{
					divHeight = regsHeight;
				}
	
				if(divHeight > 567){
					document.getElementById("cocktail_details").style.height=(divHeight+25) + "px"
					document.getElementById("alcool_details").style.height=(divHeight+64) + "px"
					document.getElementById("cocktails_regs").style.height=(divHeight+35) + "px";
					document.getElementById("alcool_autre").style.height = ((document.getElementById("alcool_details").offsetHeight - document.getElementById("alcool_principal").offsetHeight)-30) + "px";
				}else{
					document.getElementById("cocktail_details").style.height=(567-10) + "px";
					document.getElementById("cocktails_regs").style.height=567 + "px";
					document.getElementById("alcool_details").style.height=(567+29) + "px";
					if(document.getElementById("alcool_principal").offsetHeight<280){
						document.getElementById("alcool_autre").style.height = 330 + "px";
					}else{
						document.getElementById("alcool_autre").style.height = 280 + "px";
					}
				}
			}	

		}
		
		if(document.getElementById("promo_img")) {
			document.getElementById("promo_img").style.display="inline";
		}
	}
	if(intervalVar==10){
		clearInterval ( monInt );
	}
}

var flashResult = {
	customHeight: function(val){
		document.getElementById('resultsContainer').style.height = val + 'px';
	}
}

var musicControl = {
	popup: null,
	pauseSound: function(){
		getSWF('flash_menu').pauseSound();
	},
	playSound: function(){
		getSWF('flash_menu').playSound();
	},
	openPlayer: function(base_url, soundURL){
		musicControl.popup = window.open(base_url + 'player_' + lang + '.html?sound=' + base_url + soundURL, 'player_popup', 'height=50, width=250, toolbar=no, titlebar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	},
	closePlayer: function(){
		if(musicControl.popup){
			musicControl.popup.close();
		}
	}
}

function getCode() {
	url = new String(document.location.href);
	if(url.indexOf('?') > -1) {
		if(url.indexOf('&') > -1) {
			codeStart = url.lastIndexOf("/") + 1;			
			codeEnd = url.lastIndexOf('?');
		} else {
			codeStart = url.lastIndexOf("?") + 1;			
		}
	} else {
		codeStart = url.lastIndexOf("/") + 1;	
	}
	scode = url.substring(codeStart);	
	scode = scode.replace('/', '');
	scode = scode.replace('#', '');

	return scode;
}

function swapVidClass(vidNumber) {
  document.getElementById('vid1').style.fontWeight="normal";
  document.getElementById('vid1').style.color="#91908a";
  document.getElementById('vid1').style.textTransform="none";
  
  document.getElementById('vid2').style.fontWeight="normal";
  document.getElementById('vid2').style.color="#91908a";
  document.getElementById('vid2').style.textTransform="none";
  
  document.getElementById('vid3').style.fontWeight="normal";
  document.getElementById('vid3').style.color="#91908a";
  document.getElementById('vid3').style.textTransform="none";
  
  document.getElementById('vid4').style.fontWeight="normal";
  document.getElementById('vid4').style.color="#91908a";
  document.getElementById('vid4').style.textTransform="none";
  
  document.getElementById('vid5').style.fontWeight="normal";
  document.getElementById('vid5').style.color="#91908a";
  document.getElementById('vid5').style.textTransform="none";
  
  document.getElementById('vid6').style.fontWeight="normal";
  document.getElementById('vid6').style.color="#91908a";
  document.getElementById('vid6').style.textTransform="none";
  
  var titleVideo = "vid" + vidNumber;
  document.getElementById(titleVideo).style.fontWeight="bold";
  document.getElementById(titleVideo).style.color="#333333";
  document.getElementById(titleVideo).style.textTransform="uppercase";
}

var shareWin = null;
function shareIt(which) {
	d = document.location.href;
	d = d.replace("#","");
	title = "espacecocktail.com";
	
	switch (which) {
		case "facebook": {
			shareWin = window.open("http://www.facebook.com/share.php?u=" + d + "&t=" + title);
			break;
		}

		case "Delicious": {
			shareWin = window.open("http://del.icio.us/post?url=" + d + "&title=" + title);
			break;
		}
		
		case "Google": {
			shareWin = window.open("http://www.google.com/bookmarks/mark?op=edit&bkmk=" + d + "&title=" + title);
			break;
		}	
		
		case "MyWeb": {
			//shareWin = window.open("http://www.facebook.com/share.php?u=" + d + "&t=espacecocktail.com");
			break;
		}
		
		case "Digg": {
			shareWin = window.open("http://digg.com/submit?phase=2&url=" + d + "&title=" + title);
			break;
		}
		
		case "Reddit": {
			shareWin = window.open("http://reddit.com/submit?url=" + d  + "&title=" + title);
			break;
		}		

		case "StumbleUpon": {
			shareWin = window.open("http://www.stumbleupon.com/submit?url=" + d +  "&title=" + title);
			break;
		}
	}
}

function switchCocktailVersion(which, numOfTabs) {
	// 1 = individuelle, 2 = punch, 3 = sans-alcohol
	indivi_prep = document.getElementById("individuel");
	punch_prep = document.getElementById("punch");
	sans_prep = document.getElementById("sans");
	printImg = document.getElementById("printTitleImg");
	punch_portion = document.getElementById("portion");
	if(document.getElementById("tab1")) {
		btn1 = document.getElementById("tab1");
		ing1 = document.getElementById("ingredient_1");
		etapes1 = document.getElementById("etapes_1");
	}
	
	if(document.getElementById("tab2")) {
		btn2 = document.getElementById("tab2");
		ing2 = document.getElementById("ingredient_2");	
		etapes2 = document.getElementById("etapes_2");
	}
	
	if(document.getElementById("tab3")) {
		btn3 = document.getElementById("tab3");
		ing3 = document.getElementById("ingredient_3");
		etapes3 = document.getElementById("etapes_3");
	}
	
	switch (which) {
		case 1: 
			if(document.getElementById("tab1")) {
				btn1.src =  base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_ind_on.jpg";
				btn1.style.cursor = "default";
				ing1.style.display="block";
				etapes1.style.display="block";
				indivi_prep.style.display="inline";
				punch_prep.style.display="none";
				sans_prep.style.display="none";				
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_ind.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";	
				}
			}
			if(document.getElementById("tab2")) {
				btn2.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_punch_of.jpg";				
				btn2.style.cursor = "pointer";
				ing2.style.display="none";
				etapes2.style.display="none";
				indivi_prep.style.display="inline";
				punch_prep.style.display="none";
				sans_prep.style.display="none";		
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_ind.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";					
				}
			}
			if(document.getElementById("tab3")) {
				btn3.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_noalc_of.jpg";
				btn3.style.cursor = "pointer";
				ing3.style.display="none";
				etapes3.style.display="none";
				indivi_prep.style.display="inline";
				punch_prep.style.display="none";
				sans_prep.style.display="none";					
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_ind.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";	
				}
			}
			break;
			
		case 2: 
			if(document.getElementById("tab1")) {
				btn1.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_ind_of.jpg";
				btn1.style.cursor = "pointer";
				ing1.style.display="none";
				etapes1.style.display="none";
				indivi_prep.style.display="none";
				punch_prep.style.display="inline";
				sans_prep.style.display="none";					
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_punch.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";		
				}
			}
			if(document.getElementById("tab2")) {
				btn2.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_punch_on.jpg";
				btn2.style.cursor = "default";
				ing2.style.display="block";
				etapes2.style.display="block";
				indivi_prep.style.display="none";
				punch_prep.style.display="inline";
				sans_prep.style.display="none";					
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_punch.jpg";
				if(punch_portion) {
					punch_portion.style.display="inline";					
				}
			}
			if(document.getElementById("tab3")) {
				btn3.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_noalc_of.jpg";
				btn3.style.cursor = "pointer";
				ing3.style.display="none";
				etapes3.style.display="none";
				indivi_prep.style.display="none";
				punch_prep.style.display="inline";
				sans_prep.style.display="none";	
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_punch.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";	
				}
			}
			break;

		case 3: 
			if(document.getElementById("tab1")) {
				btn1.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_ind_of.jpg";
				btn1.style.cursor = "pointer";
				ing1.style.display="none";
				etapes1.style.display="none";
				indivi_prep.style.display="none";
				punch_prep.style.display="none";
				sans_prep.style.display="inline";					
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_sans.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";	
				}
			}
			if(document.getElementById("tab2")) {
				btn2.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_punch_of.jpg";
				btn2.style.cursor = "pointer";
				ing2.style.display="none";
				etapes2.style.display="none";
				indivi_prep.style.display="none";
				punch_prep.style.display="none";
				sans_prep.style.display="inline";				
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_sans.jpg";
				if(punch_portion) {
					punch_portion.style.display="inline";	
				}
			}
			if(document.getElementById("tab3")) {
				btn3.src = base_url + "public/images/" + lang + "/fiche/bt" + numOfTabs + "_noalc_on.jpg";
				btn3.style.cursor = "default";
				ing3.style.display="block";
				etapes3.style.display="block";
				indivi_prep.style.display="none";
				punch_prep.style.display="none";
				sans_prep.style.display="inline";				
				printImg.src= base_url + "public/images/" + lang + "/fiche/print_sans.jpg";
				if(punch_portion) {
					punch_portion.style.display="none";					
				}
			}
			break;
	}
}
