window.name="lancome_main";

var RollOvers = new Array();

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('navabout','/images/btm_about_off.gif','/images/btm_about_on.gif');
loadImage('navreg1','/images/top_signin_off.gif','/images/top_signin_on.gif');
loadImage('navreg0','/images/top_signin_off.gif','/images/top_signin_on.gif');
loadImage('navcust','/images/top_custservice_off.gif','/images/top_custservice_on.gif');
loadImage('tg_navcust','/images/tg_ContactUs_0.gif','/images/tg_ContactUs_1.gif');
loadImage('navcheck','/images/top_checkout_off.gif','/images/top_checkout_on.gif');
loadImage('navnewsletter','/img/_fr/_fr/00nav/t_newsletter_0.gif','/img/_fr/_fr/00nav/t_newsletter_1.gif');
loadImage('navhome','/images/top_home_off.gif','/images/top_home_on.gif');
loadImage('navfaq','/images/top_faq_off.gif','/images/top_faq_on.gif');
loadImage('navsitemap','/images/btm_sitemap_off.gif','/images/btm_sitemap_on.gif');
loadImage('navstores','/images/btm_store_off.gif','/images/btm_store_on.gif');
loadImage('navcollection','/images/btm_collection_off.gif','/images/btm_collection_on.gif');
loadImage('navlastcall','/images/btm_lastcall_off.gif','/images/btm_lastcall_on.gif');
loadImage('navsneak','/images/btm_sneak_off.gif','/images/btm_sneak_on.gif');
loadImage('navconsult','/images/btm_consultations_off.gif','/images/btm_consultations_on.gif');
loadImage('navcareers','/images/btm_careers_off.gif','/images/btm_careers_on.gif');
loadImage('navinstore','/images/btm_whatsinstore_off.gif','/images/btm_whatsinstore_on.gif');
loadImage('navgirls','/images/btm_girls_off.gif','/images/btm_girls_on.gif');
loadImage('navcert','/images/btm_egift_off.gif','/images/btm_egift_on.gif');
loadImage('navboutique','/images/btm_lancomeboutique_off.gif','/images/btm_lancomeboutique_on.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=no,width=260,height=350")
      try {
  	    if(window.focus) shop.focus();
	      if(window.moveTo) shop.moveTo(50,50);
      }  
      catch(e) {
    
      }
    }
    
function openAroma(where)
    {
    aroma = window.open(where,"lostwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=500,height=350")
	if(window.focus) aroma.focus();
	if(window.moveTo) aroma.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=350,height=480")
	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 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)
				return document.forms[mf].elements[i].name;
		}
		return null;
	}

// This fixes the SP3 Update to .Net1.0  
// Push is Pending need.
/*function GetMainFormName()
	{
		var i;
		for (i=0;i<document.forms.length;i++)
		{
			if ( (document.forms[i].name.indexOf("_ServerForm") != -1) || (document.forms[i].name.indexOf("_aspnetForm") != -1) )
				return document.forms[i].name;
		}
		
		
		
		return null;
	}
*/
function GetMainFormName()
	{
		var i;
		try{
		  for (i=0;i<document.forms.length;i++)
		  {
		  	if ( (document.forms[i].name.indexOf("_ServerForm") != -1) )
		  		return document.forms[i].name;
		  }
		}
		catch(e) 
		{
		}
		
		try 
		{
		  for (i=0;i<document.forms.length;i++)
		  {
		  	if ( (document.forms[i].name.indexOf("_aspnetForm") != -1) )
		  		return document.forms[i].name;
		  }
    }		
		catch(e) 
		{
		}
		
		return null;
	}

/*
// Commented out to allow the above procedure to take precedence.
function GetMainFormName()
	{
		var i;
		for (i=0;i<document.forms.length;i++)
		{
			if ( (document.forms[i].name.indexOf("_ServerForm") != -1) )
				return document.forms[i].name;
		}
		return null;
	}
*/

function setProductCount(count)
	{
		if(!document.images) return;
		var counter = document.images["prodcount"];
		if(counter)
		{
			counter.src = "/images/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 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 openApplMethod(what)
{
	loc = window.open('../catalog/application_method.aspx?prdcode=' + what,"locwdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=280,height=300")
	if(window.focus) loc.focus();
	if(window.moveTo) loc.moveTo(50,50);
}
	
function openvideo(where,what)
	{
	movie = window.open(where +'?prdcode='+ what,"moviewdw","toolbar=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=yes,width=240,height=400")
	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=300,height=230")
	if(window.focus) lost.focus();
	if(window.moveTo) lost.moveTo(50,50);
	}
	 
function openverisign()
	{
		lost = window.open("https://seal.verisign.com/splash?form_file=fdf/splash.fdf&type=GOLD&sealid=2&dn=WWW.LANCOME-USA.COM&lang=en",null,'toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=650')
	
	}
	
function openbaeliteverisign()
	{
		lost = window.open("https://seal.verisign.com/splash?form_file=fdf/splash.fdf&type=GOLD&sealid=2&dn=WWW.LANCOME-ELITE.COM&lang=en",null,'toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=650')
	}

function openbagratisverisign()
	{
		lost = window.open("https://seal.verisign.com/splash?form_file=fdf/splash.fdf&type=GOLD&sealid=2&dn=WWW.LANCOME-GRATIS.COM&lang=en",null,'toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=650')
	}

function GoPreAddToBasket(rtlid, RetailerFile)
{
	
	var frm= GetMainFormName();
	if (frm!=null)
	{
		var sku = GetElementName('sku', frm);
		if (sku!=null)
		{
			if (sku.toLowerCase().indexOf("productsku_") != -1){
				var selindex = 0;
				var ProductId= sku.substr(11);
			}else{
				var selindex = document.forms[frm].elements[sku].selectedIndex;
				var ProductId= document.forms[frm].elements[sku].options[selindex].value;
			}
			ProductId = prd[ProductId];
			var Qte = GetElementName('qty', frm);
			var Qte = document.forms[frm].elements[Qte].value
			if(Qte!=null)
			{
				if(GoAddToBasket!=null && GoAddToBasket!='undefined' && Qte!=null && Qte!='undefined' && ProductId!=null && ProductId!='undefined')
				{
					if (Qte > 0)
					{
						// Check if using Internet Explorer or Netscape browser
						// and get the img object
						ns = (document.layers)? true:false
						ie = (document.all)? true:false
						if (ie)
							elAddToBasket = document.all['tatob'];
						else
							elAddToBasket = document.images['tatob'];
						//	Call insertbasket.aspx to trap an 'add to basket' action related to a retailer
						if (elAddToBasket !=null && rtlid!='undefined' && rtlid!=null && rtlid!=''
							&& RetailerFile!=null && RetailerFile!='' && RetailerFile!='undefined')
						{
							elAddToBasket.src = RetailerFile + '?pid=' + ProductId + '&qty=' + Qte + '&rtlid=' + rtlid;
						}
						// Call the retailer addtobasket action
						
						GoAddToBasket(document.forms[frm],ProductId, Qte);
					}
				}
			}
		}
	}
	return false;
}


function GoPreAddToBasketForCollection(nameprefix, rtlid, RetailerFile)
{
	var frm= GetMainFormName();
	if (frm!=null)
	{
		var selindex = document.forms[frm].elements[nameprefix+'sku'].selectedIndex;
		var ProductId = document.forms[frm].elements[nameprefix+'sku'].options[selindex].value;
		var RetailerProductId = document.forms[frm].elements['RC_'+ProductId].value;
		var Qte = document.forms[frm].elements[nameprefix+'Qty'].value
		if(Qte!=null)
		{
			if(GoAddToBasket!=null && GoAddToBasket!='undefined' && Qte!=null && Qte!='undefined' && ProductId!=null && ProductId!='undefined')
			{
				if (Qte > 0)
				{
					// Check if using Internet Explorer or Netscape browser
					// and get the img object
					ns = (document.layers)? true:false
					ie = (document.all)? true:false
					if (ie)
						elAddToBasket = document.all['tatob'];
					else
						elAddToBasket = document.images['tatob'];
					//	Call insertbasket.aspx to trap an 'add to basket' action related to a retailer
					if (elAddToBasket!=null && rtlid!='undefined' && rtlid!=null && rtlid!=''
						&& RetailerFile!=null && RetailerFile!='' && RetailerFile!='undefined')
					{
						elAddToBasket.src = RetailerFile + '?pid=' + ProductId + '&qty=' + Qte + '&rtlid=' + rtlid;
					}
					// Call the retailer addtobasket action
					
					GoAddToBasket(document.forms[frm],RetailerProductId, Qte);
				}
			}
		}
	}
}
function gopage(url)
{
	mf = GetMainFormName();
	if (mf==null) return;
	document.forms[mf].action=url;
	document.forms[mf].submit();
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name)
{
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain)
{
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date)
{
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
		date.setTime(date.getTime() - skew);
}

//start of Dotomi Abandon Tag
  function callAbandonPixel(promo_id,category,subcategory){
   var baseUrl = window.location.protocol + "//login.dotomi.com/ucm/UCMController?";
   var baseFields = "dtm_com=28&dtm_cid=2053&dtm_fid=101&dtm_format=5";
   var customFields = new Array();

   // custom fields start [CHANGE ONLY IN THIS BLOCK]  
   customFields['cli_promo_id'] = promo_id;
   customFields['dtmc_category'] = category;
   customFields['dtmc_sub_category'] = subcategory;
   // custom fields end

   var iframeSrc = baseUrl + baseFields;
   for (var item in customFields)
   {
      iframeSrc += "&" + item + "=" + escape(customFields[item]);
   }
   
   setTimeout('timeOutDotomi()',4000);
   document.write('<div id="dtmdiv" style="display:none;"><iframe name="response_frame" src="' + iframeSrc + '"></iframe></div>');
   
 }
function timeOutDotomi()
{
   document.getElementById("dtmdiv").innerHTML = "";
}

//End of Dotomi Abandon Tag