
function gotoFrancilien(urlhp){
	//var iWidth = screen.width-5
	var iWidth=800;
	//var iHeight = screen.height-15
	var iHeight=615;
    f=window.open("http://www.billetfrancilien.com","BilletFrancilien",'scrollbars=auto,screenX=0,screenY=0,status=0,resizable=1,width='+iWidth+',height='+iHeight+',left=0,top=0');
	f.focus();
    location.href=urlhp;
}


// ***********************************************************************************************************************************

//******  GLOBAL VARIABLES  ******
var wrCountry = ['uk','ie','fr','be', 'nl','de','au','ch','it','es','dk','no','se'];
var wrMarket = ['gb','ie','frd','frl','be', 'nl','de','au','ch','it','es','dk','no','se'];
var wrLangId = ['uk','frl','fr','nl'];
var wrCountryId = ['210','67','94','211', '18','191','18','140'];

// country list exotic
var arabic = ['DZ','BH','TD','KM','DJ','EG','ER','ET','IQ','JO','KW','LB','LY','MR','MA','OM','QA','SA','SO','SY','TN','AE','YE'];
var russian = ['GE','BY','UA','KZ','KG','MD','RU','TM'];
var polish = ['PL'];
var greek = ['AL','GR','CY'];
var czech = ['CZ'];
var hungarian = ['HU','SK'];
var romanian = ['RO'];


// ****** COOKIES SETTINGS ******
function clearCookies(){
Delete_Cookie('c','/','.disneylandparis.com');
Delete_Cookie('market','/','.disneylandparis.com');
Delete_Cookie('DDS-WR-REDIRECT','/','.disneylandparis.com');
Delete_Cookie('checked','/','.disneylandparis.com');
Delete_Cookie('asvcountry','/','.disneylandparis.com');
Delete_Cookie('country','/','.disneylandparis.com');
}

function trackCookie(){

	// TDUID
	// récupère le Tradedoubler ID et le stocke dans un cookie sous le nom TDUID
	var tduid = getURLVariable('tduid'); 
	var durationTDUID=1000*60*60*24*45;	//miliseconds*seconds * minutes * hours * days
	if (tduid!='') {
		Set_Cookie( 'tduid', tduid , 45,'','.disneylandparis.com'); 			
	}
	
	// AFFID
	// récupère l'Affilié ID et le stocke dans un cookie sous le nom AFFID
	var affid = getURLVariable('affId'); 
	var durationAFFID=1000*60*60*24*45;	//miliseconds*seconds * minutes * hours * days
	if (affid!='') {
		Set_Cookie( 'affid', affid , 45,'','.disneylandparis.com'); 			
	}

	
	// CAMID
	var camid = getURLVariable('camid'); 
	var durationCAMID=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('camid')==null && camid!=''){
			Set_Cookie( 'camid', camid , 21,''); 
	}
	
	// MAUID	
	var mauid = getURLVariable('mauid'); 
	var durationMAUID=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('mauid')==null && mauid!=''){
			Set_Cookie( 'mauid', mauid , 21,''); 
	}	
	
	// ESVT
	var esvt = getURLVariable('esvt'); 
	var durationCAMID=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('esvt')==null && esvt!=''){
			Set_Cookie( 'esvt', esvt , 21,''); 
	}
	
	// ESVADT
	var esvadt = getURLVariable('esvadt'); 
	var durationCAMID=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('esvadt')==null && esvadt!=''){
			Set_Cookie( 'esvadt', esvadt , 21,''); 
	}		
	
	// COUNTRY
	var country = getURLVariable('country'); 
	var c = getURLVariable('c'); 	
	var durationCOUNTRY=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('country')==null && country!=''){
			Set_Cookie( 'country', country , 21,''); 
	}	
	if (Get_Cookie('c')==null && c!=''){
			Set_Cookie( 'c', c , 21,''); 
	}	
	
	// LANGUE
	var language = getURLVariable('language'); 
	var l = getURLVariable('l'); 	
	var durationLANGUAGE=1000*60*60*24*21;	//miliseconds*seconds * minutes * hours * days	
	if (Get_Cookie('language')==null && language!=''){
			Set_Cookie( 'language', language , 21,''); 
	}	
	if (Get_Cookie('l')==null && l!=''){
			Set_Cookie( 'l', l , 21,''); 
	}	

	// recontruit le query string
	var wr1='';
	if (mauid!='' && camid!='') {
		wr1='camid='+camid+'&mauid='+mauid;
	}
	if (affid!='' && tduid!='') {
		if(wr1!=''){wr1=wr1+'&'}
		wr1=wr1+'affId='+affid+'&tduid='+tduid;
	}	
	if (esvt!='' && esvadt!='') {
		if(wr1!=''){wr1=wr1+'&'}
		wr1=wr1+'esvt='+esvt+'&esvadt='+esvadt;
	}
	
	// Affiliate
	// Créee le cookie Affiliate pour DDS 
	var durationAffiliate=1000*60*60*24*45;	//miliseconds*seconds * minutes * hours * days
	var Affiliate='';
	if (esvt!='' && esvadt!='') {
		Affiliate = "esvt="+esvt+"&esvadt="+esvadt;
	}
	if (mauid!='' && camid!='') {
		Affiliate = "camid="+camid+"&mauid="+mauid;		
	}	
	if (affid!='' && tduid!='') {
		Affiliate = "affId="+affid+"&tduid="+tduid;
	}	
	if (Affiliate!=''){	
		Set_Cookie( 'Affiliate', Affiliate , 45,'','.disneylandparis.com'); 			
	}	
			
	return wr1;

}

function setCookieMarket(countryId, langId){
}

function hiddeLayer(idLayer){
document.getElementById(idLayer).style.display = 'none';
}

function showLayer(idLayer){
hiddeLayer('fr');
hiddeLayer('be');
hiddeLayer('ch');
hiddeLayer('other');
document.getElementById(idLayer).style.display = 'block';
}



//******  REDIRECT SETTINGS ******
function loadRedirect(){

// Variables passé en GET
var newCountry = getURLVariable('c'); // Market
var newLanguage = getURLVariable('l'); // Language
var newRegion = getURLVariable('rg'); // Region
var redirectURL = getURLVariable('r'); // URL to redirect to
var redirectFlag = getURLVariable('splash'); // block auto redirect

// Variables présent dans les cookies
var cookieC = Get_Cookie('c');
var cookieCP = Get_Cookie('CP');
var cookieCountry = Get_Cookie('country');
var cookieMarket = Get_Cookie('market');
var cookieASV = Get_Cookie('asvcountry');
var cookieINT = "";
var cookieDDS = Get_Cookie('DDS-WR-REDIRECT');
var cookieChecked = Get_Cookie('checked');


if (newCountry=='0'){
// Change country - réinit
	clearCookies();
}else if (cookieMarket=='' && newCountry==''){
// No redirect - réinit
	clearCookies();

}else if (cookieMarket!=null && newCountry=='' && cookieDDS!='' && redirectFlag!='1'){
//Redirect auto WR
	switch (cookieMarket) {
		case "GB-EN-Neutral":
			window.location="http://www.disneylandparis.co.uk/index.xhtml";break;
		case "IE-EN-Neutral":
			window.location="http://www.disneylandparis.ie/index.xhtml";break;
		case "BE-NL-Neutral":
			window.location="http://nl.disneylandparis.be/index.xhtml";	break;
		case "BE-FR-Neutral":
			window.location="http://fr.disneylandparis.be/index.xhtml";	break;
		case "NL-NL-Neutral":
			window.location="http://www.disneylandparis.nl/index.xhtml";break;
		case "FR-FR-Distant":
			window.location="http://www.disneylandparis.fr/index.xhtml";break;
		case "FR-FR-Locale":
			window.location="http://idf.disneylandparis.fr/index.xhtml";break;
		case "CH-FR-Neutral":
			window.location="http://fr.disneylandparis.ch/index.xhtml";break;		
		case "DE-DE-Neutral":
			window.location="http://www.disneylandparis.de/index.xhtml";break;	
		case "ES-ES-Neutral":
			window.location="http://www.disneylandparis.es/index.xhtml";break;				
		case "IT-IT-Neutral":
			window.location="http://www.disneylandparis.it/index.xhtml";break;						
		case "DK-DA-Neutral":
			window.location="http://www.disneylandparis.dk/index.xhtml";break;						
		case "SE-EN-Neutral":
			window.location="http://www.disneylandparis.se/index.xhtml";break;									
		case "NO-NO-Neutral":
			window.location="http://international.disneylandparis.com/index.xhtml";break;									
		default: 
			break;
	}
//case INT
		if (cookieMarket.indexOf('INT-EN-Neutral')!=-1 && cookieASV!='' && cookieCountry!='' && cookieChecked!='true'){
//				cookieInt = cookieMarket
				cookieInt = cookieMarket.substring(cookieMarket.indexOf('Neutral-')+8,cookieMarket.length);					
//arabic
				for(var i=0; i<=arabic.length-1; i++){
					if (cookieInt==arabic[i]){window.location="http://arabic.disneylandparis.com/?c="+cookieInt+"-EN&"+trackCookie();}
				}
//russian
				for(var i=0; i<=russian.length-1; i++){
					if (cookieInt==russian[i]){window.location="http://www.disneylandparis.ru/?c="+cookieInt+"-EN&"+trackCookie();}
				}				
//polish
				for(var i=0; i<=polish.length-1; i++){
					if (cookieInt==polish[i]){window.location="http://www.disneylandresortparis.pl/?c="+cookieInt+"-EN&"+trackCookie();}
				}								
//greek
				for(var i=0; i<=greek.length-1; i++){
					if (cookieInt==greek[i]){window.location="http://www.disneylandparis.gr/?c="+cookieInt+"-EN&"+trackCookie();}
				}												
//czech
				for(var i=0; i<=czech.length-1; i++){
					if (cookieInt==czech[i]){window.location="http://www.disneylandresortparis.cz/?c="+cookieInt+"-EN&"+trackCookie();}
				}					
//hungarian
				for(var i=0; i<=hungarian.length-1; i++){
					if (cookieInt==hungarian[i]){window.location="http://www.disneylandparis.hu/?c="+cookieInt+"-EN&"+trackCookie();}
				}												
//romanian
				for(var i=0; i<=romanian.length-1; i++){
					if (cookieInt==romanian[i]){window.location="http://www.disneylandparis.ro/?c="+cookieInt+"-EN&"+trackCookie();}
				}
				
				window.location="http://international.disneylandparis.com/?market=INT-EN-Neutral-"+cookieInt+"&country="+cookieInt;			
				
			
		} else if (cookieMarket.indexOf('INT-EN-Neutral-US')!=-1 && cookieASV!='' && cookieCountry!='' && cookieChecked!='true'){
//			cookieInt = cookieMarket
			cookieInt = cookieMarket.substring(cookieMarket.indexOf('Neutral-')+8,cookieMarket.length);			
			window.location="http://us.disneylandparis.com/?market=INT-EN-Neutral-"+cookieInt+"&country="+cookieInt;			
		} else if (cookieMarket.indexOf('INT-FR-Neutral')!=-1 && cookieASV!='' && cookieCountry!='' && cookieChecked!='true'){
//			cookieInt = cookieMarket
			cookieInt = cookieMarket.substring(cookieMarket.indexOf('Neutral-')+8,cookieMarket.length);			
			window.location="http://fr.disneylandparis.com/?market=INT-FR-Neutral-"+cookieInt+"&country="+cookieInt;			
		}
	
//Redirect auto dlrp
	if (redirectFlag!='1'){
		var countryValues = new Array();//countryName | countryHp | countryIso | countryLang | countryLangBro | countryBro
		for(var i=0; i<=countryList.length-1; i++){
			 countryValues = parseCountry(countryList[i]).split('|');		 		 
			 if (cookieMarket == (countryValues[2]+'-'+countryValues[3]+'-DLRP')){
				window.location="http://www.disneylandparis.com/"+countryValues[1]+"/index.htm?c="+countryValues[2]+"&l="+countryValues[3];		 	
			 }
		}	
	}
//	else{
//		clearCookies();
//	}	
}else{
	clearCookies();
}
//alert (newCountry+'-'+newLanguage+'-'+newRegion+'-'+redirectURL)

}

function redirectWr(market){


var tracking = trackCookie();


if (tracking!=''){tracking = '&'+tracking}

if (market.indexOf('-f')!=-1){
	market = market.replace(/-f/g,'');
	window.location='http://fr.disneylandparis.com/index.xhtml?market=INT-FR-Neutral-'+market.toUpperCase()+'&country='+market.toUpperCase()+tracking;
}
else{

		switch (market) {
			case "uk": window.location='http://www.disneylandparis.co.uk/index.xhtml?market=GB-EN-Neutral&country=GB'+tracking; break;
			case "ie": window.location='http://www.disneylandparis.ie/index.xhtml?market=IE-EN-Neutral&country=IE'+tracking; break;
			case "frl": gotoFrancilien('http://idf.disneylandparis.fr/index.xhtml?market=FR-FR-Locale&country=FR'+tracking); break;
			case "frd": window.location='http://www.disneylandparis.fr/index.xhtml?market=FR-FR-Distant&country=FR'+tracking; break;
			case "befr": window.location='http://fr.disneylandparis.be/index.xhtml?market=BE-FR-Neutral&country=BE'+tracking; break;
			case "benl": window.location='http://nl.disneylandparis.be/index.xhtml?market=BE-NL-Neutral&country=BE'+tracking; break;
			case "nl": window.location='http://www.disneylandparis.nl/index.xhtml?market=NL-NL-Neutral&country=NL'+tracking; break;
			case "de": window.location='http://www.disneylandparis.de/index.xhtml?market=DE-DE-Neutral&country=DE'+tracking; break;	
			case "at": window.location='http://www.disneylandparis.at/index.xhtml?market=AT-DE-Neutral&country=AT'+tracking; break;	
			case "chfr": window.location='http://fr.disneylandparis.ch/index.xhtml?market=CH-FR-Neutral&country=CH'+tracking; break;			
			case "chde": window.location='http://de.disneylandparis.ch/index.xhtml?market=CH-DE-Neutral&country=CH'+tracking; break;	
			case "it": window.location='http://www.disneylandparis.it/index.xhtml?market=IT-IT-Neutral&country=IT'+tracking; break;
			case "es": window.location='http://www.disneylandparis.es/index.xhtml?market=ES-ES-Neutral&country=ES'+tracking; break;	
			case "dk": window.location='http://www.disneylandparis.dk/index.xhtml?market=DK-DA-Neutral&country=DK'+tracking; break;			
			case "se": window.location='http://www.disneylandparis.se/index.xhtml?market=SE-EN-Neutral&country=SE'+tracking; break;					
			case "no": window.location='http://international.disneylandparis.com/index.xhtml?market=NO-NO-Neutral&country=NO'+tracking; break;				
			case "us": window.location='http://us.disneylandparis.com/index.xhtml?market=US-EN-Neutral&country=US'+tracking; break;

//International			

			case "pl": window.location='http://www.disneylandresortparis.pl?'+tracking; break;									
			case "gr": window.location='http://www.disneylandparis.gr?'+tracking; break;						
			case "ru": window.location='http://www.disneylandparis.ru?'+tracking; break;			
			case "ar": window.location='http://arabic.disneylandparis.com?'+tracking; break;						
			case "hu": window.location='http://www.disneylandparis.hu?'+tracking; break;				
			case "ro": window.location='http://www.disneylandparis.ro?'+tracking; break;				
			case "cz": window.location='http://www.disneylandresortparis.cz?'+tracking; break;			
			case "pt": window.location='http://www.disneylandparis.pt?'+tracking; break;							
							

			
			default : 	if (market != 'arg'){			
							window.location='http://international.disneylandparis.com/index.xhtml?market=INT-EN-Neutral-'+market.toUpperCase()+'&country='+market.toUpperCase()+'&'+tracking; break;
						}else{
							window.location='http://international.disneylandparis.com/index.xhtml?market=INT-EN-Neutral-AR&country=AR&'+tracking; break;
						}	
				
		}
}		
return true;
}



// ****** COUNTRIES AND LANGAGE MENU ******

function setURL(){
	
	

	countryID = document.getElementById("countryList").value;
	countryValues = parseCountry(countryList[countryID]).split('|');
	
	langID = document.getElementById("langList").value;
		
	var currentCountry=countryValues[2];	
	eBroxSeason = "SUMMER10";
	redirectURL = "";


	
	// new websites
	if(countryID == "211" && langID == "uk") { redirectWr("uk") } /*UK*/
	else if(countryID == "67" && langID == "frl") {  redirectWr("frl") } /*FRL*/
	else if(countryID == "67" && langID == "fr") {  redirectWr("frd")  } /*FRD*/
	else if(countryID == "94" && langID == "uk") {  redirectWr("ie")  } /*IE*/
	else if(countryID == "211" && langID == "uk") {  redirectWr("us")  } /*INTUS*/
	else if(countryID == "18" && langID == "fr") {  redirectWr("befr")  } /*BEFR*/
	else if(countryID == "191" && langID == "fr") {  redirectWr("chfr")  } /*CHFR*/
	else if(countryID == "18" && langID == "nl") {  redirectWr("benl")  } /*BENL*/
	else if(countryID == "140" && langID == "nl") {  redirectWr("nl")  } /*NL*/	
	else if(countryID == "73" && langID == "de") {  redirectWr("de")  } /*DE*/	
	else if(countryID == "185" && langID == "es") {  redirectWr("es")  } /*ES*/		
	else if(countryID == "97" && langID == "it") {  redirectWr("it")  } /*IT*/			
	else if(countryID == "51" && langID == "dk") {  redirectWr("dk")  } /*IT*/				
	else if(countryID == "190" && langID == "se") {  redirectWr("se")  } /*SE*/					
	else if(countryID == "158" && langID == "pl") {  redirectWr("pl")  } /*Poland*/		
	else if(countryID == "76" && langID == "gr") {  redirectWr("gr")  } /*Geece*/		
	else if(countryID == "49" && langID == "gr") {  redirectWr("gr")  } /*Cypruss*/			
	else if(countryID == "164" && langID == "ru") {  redirectWr("ru")  } /*Russia*/				
	else if(countryID == "88" && langID == "hu") {  redirectWr("hu")  } /*HU*/		
	else if(countryID == "163" && langID == "ro") {  redirectWr("ro")  } /*RO*/		
	else if(countryID == "50" && langID == "cz") {  redirectWr("cz")  } /*CZ*/				
	else if(countryID == "160" && langID == "pt") {  redirectWr("pt")  } /*PT*/				

//arabic countries	
	else if (langID == "ar"){
		if(countryID == "2" || countryID == "15" || countryID == "28" || countryID == "57" || countryID == "92" || countryID == "93"  || countryID == "96" || countryID == "109"  || countryID == "1122" || countryID == "134" || countryID == "149" || countryID == "161" || countryID == "173" || countryID == "187" || countryID == "192" || countryID == "202" || countryID == "209" || countryID == "222"){
			redirectWr("ar");
		}		
	} 	
				
	// special ebrochures
	//langID == "ar" || 
	else if(langID == "zh" || langID == "fi" || langID == "el") { redirectURL = 'http://www.disneylandparis.com/BROCHURE/'+eBroxSeason+'/'+countryValues[5]+'/catalogue/appli.htm'; } /*INTFR*/		
	
	//Argentina exception
	else if(langID == "uk" && countryID == "8") { redirectWr("arg")}	
	
	// new international websites
	else if(langID == "uk") { redirectWr(currentCountry)}
//	else if(langID == "fr") { redirectWr(currentCountry+'-f')} /*INTFR*/
	else if(langID == "fr") { redirectWr(currentCountry+'-f')} /*INTFR*/
	
	//exceptions
//	else if(countryID == "158" && langID == "pl") { redirectURL = 'http://www.disneylandresortparis.pl/'; } /*PL*/	
//	else if(countryID == "76" && langID == "gr") { redirectURL = 'http://www.disneylandparis.gr/'; } /*GR*/	
//	else if(countryID == "49" && langID == "gr") { redirectURL = 'http://www.disneylandparis.gr/'; } /*CY*/	

	
	// old websites
	else {
		chp = countryValues[1];
	
	
		redirectURL = 'http://www.disneylandparis.com/'+langID+'/introduction.htm?c='+chp+'&l='+langID;
	}
	
//	alert(redirectURL+'/'+countryID+'/'+langID);
//	window.location.replace(redirectURL);
	if (redirectURL!=""){
		window.location=redirectURL;
	}	

}


-->
