window.name="lancome_main";
var footcontent = ""

var RollOvers = new Array();

function openAnnounce(url){
	window.open(url,"announce","width=450,height=740,scrollbars=no,resizable=no")
}

function loadImage(imgName,imgOff,imgOn){
        if(!document.images) return;
        RollOvers[imgName] = new Array();
        RollOvers[imgName][0] = new Image();
        RollOvers[imgName][0].src = imgOff;
        RollOvers[imgName][1] = new Image();
        RollOvers[imgName][1].src = imgOn;
}

function switchImage(layer,imgName,onoff){
		if(document.layers && layer!=null)
		{
			eval('document.'+layer+'.document.images["'+imgName+'"].src = RollOvers[imgName]['+onoff+'].src');
		}
		else 
			if(RollOvers[imgName])
			{
			document.images[imgName].src = eval('RollOvers[imgName]['+onoff+'].src');
			}
}

loadImage('navreg1','/img/_zh/_tw/00nav/t_mylancome_0.gif','/img/_zh/_tw/00nav/t_mylancome_1.gif');
loadImage('navreg0','/img/_zh/_tw/00nav/t_register_0.gif','/img/_zh/_tw/00nav/t_register_1.gif');
loadImage('navcust','/img/_zh/_tw/00nav/t_customer_0.gif','/img/_zh/_tw/00nav/t_customer_1.gif');
loadImage('navcheck','/img/_zh/_tw/00nav/t_checkout_0.gif','/img/_zh/_tw/00nav/t_checkout_1.gif');
loadImage('navnewsletter','/img/_zh/_tw/00nav/t_newsletter_0.gif','/img/_zh/_tw/00nav/t_newsletter_1.gif');
loadImage('navvosachats','/img/_zh/_tw/00nav/t_vosachats_0.gif','/img/_zh/_tw/00nav/t_vosachats_1.gif');
loadImage('navaccueil','/img/_zh/_tw/00nav/t_accueil_0.gif','/img/_zh/_tw/00nav/t_accueil_1.gif');
loadImage('navcollection','/img/_zh/_tw/00nav/t_collection_0.gif','/img/_zh/_tw/00nav/t_collection_1.gif');
loadImage('navabout','/img/_zh/_tw/00nav/t_about_0.gif','/img/_zh/_tw/00nav/t_about_1.gif');
loadImage('navsitemap','/img/_zh/_tw/00nav/t_sitemap_0.gif','/img/_zh/_tw/00nav/t_sitemap_1.gif');
loadImage('navstore','/img/_zh/_tw/00nav/t_store_new_0.gif','/img/_zh/_tw/00nav/t_store_new_1.gif');



function urlPop(popup)
	{
	var id = popup.selectedIndex;
	if(id==0) return;
	var url = popup.options[id].value;
	if(url==""|| url=="#") return;
	document.location = url;
	}
	
function openshopbag(where)
    {
    shop = window.open(where,"shopbag","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=260,height=350")
	if(window.focus) shop.focus();
	if(window.moveTo) shop.moveTo(50,50);
    }
    
function openrefill(where)
    {
    refill = window.open(where,"refillswdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=620,height=220")
	if(window.focus) refill.focus();
	if(window.moveTo) refill.moveTo(50,50);
    }
function opentell(where,what)
	{
	if (document.all)
		s = where + '?pageurl='+escape(what);
	else
		s = where + '?pageurl='+what;
	tell = window.open(s,"tellwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=710,height=280")
	if(window.focus) tell.focus();
	if(window.moveTo) tell.moveTo(50,50);
	}
function openwarning(what,where)
	{
	warn = window.open(what+'?'+ where,"warwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=350,height=300")
	if(window.focus) warn.focus();
	if(window.moveTo) warn.moveTo(50,50);
	}

function GetMainFormName()
	{
		var i;
		for (i=0;i<document.forms.length;i++)
		{
			// Framework v1.0.3705
			if (document.forms[i].name.indexOf("_ServerForm") != -1)
				return document.forms[i].name;
			// Framework v1.1.4322
			if (document.forms[i].name.indexOf("__aspnetForm") != -1)
				return document.forms[i].name;
		}
		return null;
	}
function GetElementName(n, mf)
	{
		if (n==null || n=="") return null;
		var i, s, j;
		for (i=0;i<document.forms[mf].elements.length;i++)
		{
			if (document.forms[mf].elements[i].name.toLowerCase().indexOf(n.toLowerCase()) != -1)
			{
				var strform = document.forms[mf].elements[i].name.toLowerCase();
				var strformname = strform.substr(strform.indexOf(n.toLowerCase()),n.length);
				if (strformname == n){
					return document.forms[mf].elements[i].name;
				  }
			}
		}
		return null;
	}
	
function GetElement(ElementName, formName)
	{
		return document.forms[formName].elements[GetElementName(ElementName,formName)];
	}	
	
function SaveElement(ElementObject,ElementValue)
	{
		var mf = GetMainFormName();					
		if (mf==null) return;
		var element  = GetElement(ElementObject,mf);
		if (element!=null) 
			element.value = ElementValue;
	}
	


function setProductCount(count)
	{
		if(!document.images) return;
		var counter = document.images["prodcount"];
		if(counter)
		{
			counter.src = "/img/_zh/_tw/00nav/b_top_articles_" + count + ".gif";
		}
	}

function setBagCount(count)
	{
		if(!document.images) return;
		var counter = document.images["bag"];
		if(counter)
		{
			counter.src = "/img/bag_" + count + ".gif";
		}
	}
	
function GetLastElementName(n, mf)
    {
        if (n==null || n=="") return null;
        var i, s, j, lastname;
        for (i=0;i<document.forms[mf].elements.length;i++)
        {
                if (document.forms[mf].elements[i].name.toLowerCase().indexOf(n.toLowerCase()) != -1)
                {
                    var strform = document.forms[mf].elements[i].name.toLowerCase();
                    var strformname = strform.substr(strform.indexOf(n.toLowerCase()),n.length);
                    if (strformname == n)
                    {
                            lastname =document.forms[mf].elements[i].name;
                    }
                }
        }
        return lastname;
    }     

function openformula(what)
	{
	form = window.open('../catalog/formula.aspx?prdcode='+ what,"formwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=270,height=330")
	if(window.focus) form.focus();
	if(window.moveTo) form.moveTo(50,50);
	}
	
function openactiskin(what)
	{
	acti = window.open('../catalog/actiskin.aspx?prdcode='+ what,"formwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=auto,width=350,height=350")
	if(window.focus) acti.focus();
	if(window.moveTo) acti.moveTo(50,50);
	}	
	
function openvideo(where,what,axe)
	{
	movie = window.open(where +'?prdcode='+ what+'&amp;axe=' + axe,"moviewdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=no,width=402,height=321") 
	if(window.focus) movie.focus();
	if(window.moveTo) movie.moveTo(50,50);
	}

	
function openhelp(where)
	{
	help = window.open(where,"helpwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=230,height=150")
	if(window.focus) help.focus();
	if(window.moveTo) help.moveTo(50,50);
	}
	
function openlost(where)
	{
	lost = window.open(where,"lostwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=no,width=230,height=150")
	if(window.focus) lost.focus();
	if(window.moveTo) lost.moveTo(50,50);
	}

function GoPreAddToBasket(rtlid, RetailerFile)
{
	var frm = GetMainFormName();

	if (frm!=null)
	{
		var sku = GetElementName("varlist", frm);
		if (sku!=null)
		{
			var selindex = document.forms[frm].elements[sku].selectedIndex;
			var ProductId= document.forms[frm].elements[sku].options[selindex].value;
			ProductId=ProductId.slice(0,ProductId.indexOf("#"));			
			// ProductId = ProductId.slice(ProductId.lastIndexOf("#")+1);
			var qtyEl = GetElementName("qtylist", frm);
			
			if(qtyEl!=null)
			{
				var qty = document.forms[frm].elements[qtyEl].value;
			
				if(GoAddToBasket!=null && GoAddToBasket!='undefined' && qty!=null && qty!='undefined' && ProductId!=null && ProductId!='undefined')
				{
					if (qty > 0)
					{
						window.open (RetailerFile + '?pid=' + ProductId + '&qty=' + qty + '&rtlid=' + rtlid, "_blank", "top=0,left=5000,height=100,width=100");
						// Call the retailer addtobasket action
						GoAddToBasket(document.forms[frm],ProductId, qty);
					}
				}
			}
		}
	}
	return false;
}

function GoPreAddToBasketForCollection(nameprefix, ContainerNumber, rtlid, RetailerFile)
{
      var frm= GetMainFormName();
      if (frm!=null)
      {
					var sku = GetElName("varlist",ContainerNumber);
					var selindex = document.forms[frm].elements[sku].selectedIndex;
					var ProductId= document.forms[frm].elements[sku].options[selindex].value;
					var qtyEl = GetElName("qtylist",ContainerNumber);
					ProductId=ProductId.slice(0,ProductId.indexOf("#"));			
					// ProductId = ProductId.slice(ProductId.lastIndexOf("#")+1);
                  //alert('sku: '+sku+'--index: '+ selindex+ '--Id: '+ProductId+'--qtyEl: '+qtyEl);
                  if(qtyEl!=null)
                  {
                        var qty = document.forms[frm].elements[qtyEl].value;
                        // alert('qty: '+qty+'--ProductId: '+ProductId);
                        if(GoAddToBasket!=null && GoAddToBasket!='undefined' && qty!=null && qty!='undefined' && ProductId!=null && ProductId!='undefined')
                        {
                             if (qty > 0)
                             {
                                   window.open (RetailerFile + '?pid=' + ProductId + '&qty=' + qty + '&rtlid=' + rtlid, "_blank", "top=0,left=5000,height=100,width=100");
                                   // Call the retailer addtobasket action
                                   GoAddToBasket(document.forms[frm],ProductId, qty);
                             }
                        }
                  }
      }
}

function gopage(url)
{
	mf = GetMainFormName();
	if (mf==null) return;
	document.forms[mf].action=url;
	document.forms[mf].submit();
}

/*******************/


function EcrireCookie(nom, valeur){
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+"; path=/"+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}

function getCookieVal(offset){
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function LireCookie(nom){
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen){
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

/*******************/

function openInOpener(url, rtlId, focusOpener){
	
	if(!window.opener){
		return
	}
	
	if(rtlId != undefined){

		if(url.indexOf("?") == -1){
			url += "?";
		}else{
			url += "&";
		}
		
		url += rtlId;
	}
	
	window.opener.location = url;
	
	if(focusOpener){
		window.opener.focus()
	}
}

function getAbsoluteURL(url,secured){
	if(secured == 1){
		protocol = "https:";
	}else{
		protocol = "http:";
	}
	
	var host = location.hostname;

	var absurl = protocol + "//" + host + url;
	return absurl;
}


var pageExt = (location.pathname.indexOf(".html") != -1) ? "html" : "aspx"
var v3PopupSettings = "width=850,height=458,resizable=0,scrollbars=0"

function openV3Popup(url,id,optParams,rtlId){
	var params
	if(optParams != null){
		var params = v3PopupSettings + "," + optParams
	}else{
		var params = v3PopupSettings
	}
	
	if(rtlId != null){
		if(url.indexOf("?") == -1){
			url += "?";
		}else{
			url += "&";
		}
		url += rtlId;
	}

	window.open(url,id,params);
}

//var pageExt = (location.pathname.indexOf(".html") != -1) ? "html" : "aspx"
var v4PopupSettings = "width=995,height=458,resizable=0,scrollbars=0";

function openV4Popup(url,id,optParams,rtlId){
	var params
	if(optParams != null){
		var params = v4PopupSettings + "," + optParams
	}else{
		var params = v4PopupSettings
	}
	
	if(rtlId != null){
		if(url.indexOf("?") == -1){
			url += "?";
		}else{
			url += "&";
		}
		url += rtlId;
	}

	window.open(url,id,params);
}