/* definition du pays */
tmp_rootIndex=self.location.href.substring(self.location.href.indexOf("/_"));
if (tmp_rootIndex.indexOf("/_Http")!=-1) tmp_rootIndex=tmp_rootIndex.substring(tmp_rootIndex.indexOf("/_Http")).substring(tmp_rootIndex.indexOf("/_"));
if (tmp_rootIndex.indexOf("/_Files")!=-1) tmp_rootIndex=tmp_rootIndex.substring(tmp_rootIndex.indexOf("/_Files")).substring(tmp_rootIndex.indexOf("/_"));

tmp_rootIndex=tmp_rootIndex.split("/");
document.RootIndex=tmp_rootIndex[1]+"/"+tmp_rootIndex[2]+"/";
document.LangIndex=tmp_rootIndex[2];
/* /definition du pays */

/* variable interne */
ipackage=[];
/* /variable interne */

function preloadImg(src){
	itemValue=ipackage.length;
	ipackage[itemValue]=new Image();
	ipackage[itemValue].src=src;
}

function getSideSize(){
	if(!ipackage["sideSize"]){
		ipackage["sideSize"]=[];
		ipackage["sideSize"].width=(navigator.appVersion.indexOf('MSIE 4.5')!=-1 && navigator.appVersion.indexOf('Mac')!=-1)? parseInt((document.body.offsetWidth-772)/2):"50%";
		ipackage["sideSize"].widthImg=(document.all)? ipackage["sideSize"].width:1;
	}
	return ipackage["sideSize"];
}

function writeSideTD(background){
	ipackage_bgnd=(arguments.length)?(background.indexOf('#')!=-1)? 'bgcolor="'+background+'"':'background="'+background+'"':'';
	document.write('<td width='+getSideSize().width+' '+ipackage_bgnd+' ><img src="/img/identical/identical/dot.gif" width='+getSideSize().widthImg+' height=1 border=0></td>');
}

function ipackage_getForm(name){
	return (document.all || document.layers)? document.forms[name]:document.getElementsByTagName('FORM')[name];
}

function ipackage_getImg(Imgname){
	retObj=0;
	if(document.layers || document.all) retObj=document.images[Imgname];
	else retObj=document.getElementsByTagName("IMG")[Imgname];
	return retObj;}

function getNavImgPos(RubRoot, pageName){
	RubRoot=RubRoot.split(",");
	RetValue="off";
	for(i=0; i<RubRoot.length; i++){
		RubRoot[i]=(arguments.length==2)?("/"+RubRoot[i]+"/"+pageName):("/"+RubRoot[i]);	
		CurrentUrl=(arguments.length==2)? "/"+getURLRep():"/"+getUrlRepTable()[0];
		PosImg=(arguments.length==2)? (CurrentUrl.indexOf(RubRoot[i])!=-1)? 1:0:(CurrentUrl==RubRoot[i])? 1:0;
		if(PosImg) RetValue="on";}
	return RetValue;
}

function ActivGenNavRub(imgName){
	ipackage_getImg(Imgname).src=ipackage_getImg(Imgname).src.replace(/_off\u002E/gi,"_on.");	
}

/* votre guide beauté 
   classé par Axe, puis, BackgroundColorTitle, BackgroundTextTitle, diagUrl*/
BeautyGuideTable=[];
BeautyGuideTable["AXE_Bodycare"]=["#7089D0","#9EB6F9","body_questions.aspx"];
BeautyGuideTable["AXE_Makeup"]=["#D278AA","#DDB1D4","#"];
BeautyGuideTable["AXE_Skincare"]=["#7089D0","#9EB6F9","Skin_questions1.aspx"];
BeautyGuideTable["AXE_Suncare"]=["#C6551E", "#CC6D36","solaire_questions.aspx"];	
BeautyGuideTableF1=[];
BeautyGuideTableF1["F1_Protection"]=["#8F005C", "#E9338C","#"];	
function getBeautyGuideBackgroundColorTitle(AxeNAme, F1Name){ 
	if (arguments.length==2 && F1Name!="") {
		for (var iF1Name in BeautyGuideTableF1) {
			if (iF1Name==F1Name) return BeautyGuideTableF1[iF1Name][0];}
	}
	return BeautyGuideTable[AxeNAme][0];}
function getBeautyGuideBackgroundColorText(AxeNAme, F1Name){ 
	if (arguments.length==2 && F1Name!="") {
		for (var iF1Name in BeautyGuideTableF1) {
			if (iF1Name==F1Name) return BeautyGuideTableF1[iF1Name][1];}
	}
	return BeautyGuideTable[AxeNAme][1];}
//function getBeautyGuideBackgroundColorTitle(AxeNAme){ return BeautyGuideTable[AxeNAme][0];}
//function getBeautyGuideBackgroundColorText(AxeNAme){ return BeautyGuideTable[AxeNAme][1];}
function getBeautyGuideDiagLinkUrl(AxeNAme){ return BeautyGuideTable[AxeNAme][2];}

/* */
function getUrlCountry(){ return "/"+document.RootIndex.split("/")[0]; }
function getUrlLang() {return document.LangIndex;}

function getURLRep(){
	RootIndex=document.RootIndex;
	ShortURL=self.location.href.substring(self.location.href.indexOf(RootIndex)+RootIndex.length);
	return ShortURL;
}

function getUrlRepTable(){
	ShortURL=getURLRep();
	ShortURL=ShortURL.split("/");		
	return ShortURL; }

function GetRootUrl(){
	ShortURL=getUrlRepTable();
	RelativPath="";
	for(i=0; i<ShortURL.length-1; i++) RelativPath+="../";
	return RelativPath;
}

function GetAbsoluteRoot(){
	return self.location.href.substring(0,self.location.href.indexOf(document.RootIndex)+document.RootIndex.length)
}

function gotoAxeBody(){
	self.location=GetRootUrl()+"catalog/body_home.aspx?CategoryCode=AXE_Bodycare";
}
function gotoAxeSuncare(){ 
	self.location=GetRootUrl()+"catalog/suncare_home.aspx?CategoryCode=AXE_Suncare";
}
function gotoAxeMakeUp() { 
	self.location=GetRootUrl()+"catalog/makeup_home.aspx?CategoryCode=AXE_Makeup";
}
function gotoAxeSkinCare() { 
	self.location=GetRootUrl()+"catalog/skincare_home.aspx?CategoryCode=AXE_Skincare";
}
function getNews(){
	/* ajouter pour la what's new noel
		de façon a ce que what new noel ne soit que pour les site inter */
	inter=document.RootIndex.split("/");
	if(inter[0]=="_int") self.location=GetRootUrl()+"whatsnew/Whatsnew_edito.aspx";
	else self.location=GetRootUrl()+"whatsnew/Whatsnew_edito.aspx";
}
