// Block J - Tab Management 
//Change Style
function findObj(n, d) { //v4.0
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function changestyle(couche, style) {
  if (!(layer = findObj(couche))) return;
  layer.style.display = style;  
}

function changecolor(couche, name) {
  if (!(layer = findObj(couche))) return;
   layer.className = name;
  
}

function switchLine (nbTab, position, tabName){
//	var tempTabName;
	tempTabName = tabName+'8';	
	if (nbTab>4){
		if (!(layer1 = findObj('line1'))) return;
		if (!(layer2 = findObj('line2'))) return;
		if (position<=4){
	  		layer1.style.top = '31px';
	  		layer2.style.top = '-31px';
	  		if (nbTab!=8){
				changecolor(tempTabName,'tabButtonVide3');	  				  			
	  		} 
	  		 		
		}	
		if (position>4){
	  		layer1.style.top = '0px'; 
	  		layer2.style.top = '0px';	  	  			
	  		if (nbTab!=8){
				changecolor(tempTabName,'tabButtonVide2');	  				  			
	  		}	  		
		}  			
	}	
}

function generateBlockJ (nbTab, position, divName, tabName){	
	var tempDivName;
	var tempTabName;
	var tempTabButton;
	var tempLine;
	
	if (position<=4){tempLine=8}else{tempLine=4} 	
	
	for (var i=1; i<=nbTab; i++){
		tempDivName = divName + i;
		tempTabName = tabName + i;
		if (i != position){
			changestyle(tempDivName,'none');
			if (i== tempLine){ 
				changecolor(tempTabName,'tabButtonOff2');				
			}else{
				changecolor(tempTabName,'tabButtonOff');
			} 			
		}else{
			changestyle(tempDivName,'block');
			if (i== tempLine){
				changecolor(tempTabName,'tabButtonOn2');				
			}else{
				changecolor(tempTabName,'tabButtonOn');
			} 	
			
			if(i!=1 && i!=5){
				tempTabName = tabName + (i-1);
				changecolor(tempTabName,'tabButtonOff3');				
			}
		}		
	}	
	switchLine (nbTab, position, tabName);	
}
// End Block J - Tab Management




//These functions repair the transparent PNG problem - not used
/*
function correctPNG()  {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }

var User = navigator.userAgent;
var opr = User.indexOf("Firefox")
var ff = User.indexOf("Opera")
if(opr == -1 && ff == -1){
	window.attachEvent("onload", correctPNG);	
	//alert("MS IE")
}
*/

var listOn = false;



// Management of the footer listbox

var inited = false;
function myload() {
    if (inited) return;
    inited = true;
   document.body.onclick = function() {kill();};//alert('body.onclick')
   add_handler(document.body, 'body', 'click', false);
}

function add_handler(obj, objname, evname, useCapture, as_string) {
   var desc;
   var func;
   if (obj.addEventListener) {
      if (!func) func = evname == 'load' ? function() { myload();} : function() {};
      obj.addEventListener(evname, func, useCapture);
   }
   else if (obj.attachEvent) {
       if (useCapture && !as_string) return; 
       if (!func) func = evname == 'load' ? function() {myload();} : function() {};
       obj.attachEvent('on' + evname, func);
   }
}

add_handler(window, 'window', 'load', false);
add_handler(window, 'window', 'load', true);


function openSelect(id){
	if(document.getElementById(id).style.display == 'none'){
		changestyle(id,'block');
		a=window.pageYOffset;
		/*pagel= window.document.body.offsetHeight-200;
		document.getElementById(id).style.top = pagel+"px"; */
//		window.scroll(0,a);
		listOn = true;		
		//setTimeout("openSelect('selectOpt');",time)
	}else{
		changestyle(id,'none');
		a=window.pageYOffset;
//		window.scroll(0,a);
	}	
}

function openSelect1(id,left,top){
	openSelect(id);
	top -= document.getElementById(id).offsetHeight+8;
	document.getElementById(id).style.left=left+"px";
	document.getElementById(id).style.top=top+"px";
}

function ExOpen(idLink){	
	openSelect1('selectOpt',(findPosX(document.getElementById(idLink))- 75),(findPosY(document.getElementById(idLink))));
}

function kill(){
	if(document.getElementById('selectOpt')){
		if(document.getElementById('selectOpt').style.display == 'block'){
			if (listOn == false){
				document.getElementById('selectOpt').style.display = 'none';
			}else{
				listOn = false;
			}		
		}
	}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



/*@cc_on
@if (@_win32 && @_jscript_version>4)

var minmax_elements;

minmax_props= new Array(
  new Array('min-width', 'minWidth'),
  new Array('max-width', 'maxWidth'),
  new Array('min-height','minHeight'),
  new Array('max-height','maxHeight')
);

// Binding. Called on all new elements. If <body>, initialise; check all
// elements for minmax properties

function minmax_bind(el) {
  var i, em, ms;
  var st= el.style, cs= el.currentStyle;

  if (minmax_elements==window.undefined) {
    // initialise when body element has turned up, but only on IE
    if (!document.body || !document.body.currentStyle) return;
    minmax_elements= new Array();
    window.attachEvent('onresize', minmax_delayout);
    // make font size listener
    em= document.createElement('div');
    em.setAttribute('id', 'minmax_em');
    em.style.position= 'absolute'; em.style.visibility= 'hidden';
    em.style.fontSize= 'xx-large'; em.style.height= '5em';
    em.style.top='-5em'; em.style.left= '0';
    if (em.style.setExpression) {
      em.style.setExpression('width', 'minmax_checkFont()');
      document.body.insertBefore(em, document.body.firstChild);
    }
  }

  // transform hyphenated properties the browser has not caught to camelCase
  for (i= minmax_props.length; i-->0;)
    if (cs[minmax_props[i][0]])
      st[minmax_props[i][1]]= cs[minmax_props[i][0]];
  // add element with properties to list, store optimal size values
  for (i= minmax_props.length; i-->0;) {
    ms= cs[minmax_props[i][1]];
    if (ms && ms!='auto' && ms!='none' && ms!='0' && ms!='') {
      st.minmaxWidth= cs.width; st.minmaxHeight= cs.height;
      minmax_elements[minmax_elements.length]= el;
      // will need a layout later
      minmax_delayout();
      break;
  } }
}

// check for font size changes

var minmax_fontsize= 0;
function minmax_checkFont() {
  var fs= document.getElementById('minmax_em').offsetHeight;
  if (minmax_fontsize!=fs && minmax_fontsize!=0)
    minmax_delayout();
  minmax_fontsize= fs;
  return '5em';
}

// Layout. Called after window and font size-change. Go through elements we
// picked out earlier and set their size to the minimum, maximum and optimum,
// choosing whichever is appropriate

// Request re-layout at next available moment
var minmax_delaying= false;
function minmax_delayout() {
  if (minmax_delaying) return;
  minmax_delaying= true;
  window.setTimeout(minmax_layout, 0);
}

function minmax_stopdelaying() {
  minmax_delaying= false;
}

function minmax_layout() {
  window.setTimeout(minmax_stopdelaying, 100);
  var i, el, st, cs, optimal, inrange;
  for (i= minmax_elements.length; i-->0;) {
    el= minmax_elements[i]; st= el.style; cs= el.currentStyle;

    // horizontal size bounding
    st.width= st.minmaxWidth; optimal= el.offsetWidth;
    inrange= true;
    if (inrange && cs.minWidth && cs.minWidth!='0' && cs.minWidth!='auto' && cs.minWidth!='') {
      st.width= cs.minWidth;
      inrange= (el.offsetWidth<optimal);
    }
    if (inrange && cs.maxWidth && cs.maxWidth!='none' && cs.maxWidth!='auto' && cs.maxWidth!='') {
      st.width= cs.maxWidth;
      inrange= (el.offsetWidth>optimal);
    }
    if (inrange) st.width= st.minmaxWidth;

    // vertical size bounding
    st.height= st.minmaxHeight; optimal= el.offsetHeight;
    inrange= true;
    if (inrange && cs.minHeight && cs.minHeight!='0' && cs.minHeight!='auto' && cs.minHeight!='') {
      st.height= cs.minHeight;
      inrange= (el.offsetHeight<optimal);
    }
    if (inrange && cs.maxHeight && cs.maxHeight!='none' && cs.maxHeight!='auto' && cs.maxHeight!='') {
      st.height= cs.maxHeight;
      inrange= (el.offsetHeight>optimal);
    }
    if (inrange) st.height= st.minmaxHeight;
  }
}

// Scanning. Check document every so often until it has finished loading. Do
// nothing until <body> arrives, then call main init. Pass any new elements
// found on each scan to be bound   

var minmax_SCANDELAY= 500;

function minmax_scan() {
  var el;
  for (var i= 0; i<document.all.length; i++) {
    el= document.all[i];
    if (!el.minmax_bound) {
      el.minmax_bound= true;
      minmax_bind(el);
  } }
}

var minmax_scanner;
function minmax_stop() {
  window.clearInterval(minmax_scanner);
  minmax_scan();
}

minmax_scan();
minmax_scanner= window.setInterval(minmax_scan, minmax_SCANDELAY);
window.attachEvent('onload', minmax_stop);

@end @*/



/***********************
       Forms utils 
***********************/

function optionYearPlus2(selectName, selectId, firstValue){		
	currentYear = new Date().getFullYear();
	
	document.write("<select name='"+selectName+"' id='"+selectId+"'>");
        document.write("<option>"+firstValue+"</option>");	
	document.write("<option value='2006'>"+currentYear+"</option>");
	document.write("<option value='2006'>"+(currentYear+1)+"</option>");
	document.write("<option value='2006'>"+(currentYear+2)+"</option>");	
	document.write("</select>");							
}	 

function optionLast90Year(selectName, selectId, firstValue){		
	currentYear = new Date().getFullYear();
	last90 = currentYear-90;
	
	document.write("<select name='"+selectName+"' id='"+selectId+"'>");
        document.write("<option>"+firstValue+"</option>");
	for (var i=currentYear; i>last90; i--) {
		document.write("<option value='"+i+"'>"+i+"</option>");
	}	
	document.write("</select>");	
}	

function optionDRPOpenYear(selectName, selectId, firstValue){		
	currentYear = new Date().getFullYear();
	DRPOpen = 1992;
	document.write("<select name='"+selectName+"' id='"+selectId+"'>");
        document.write("<option>"+firstValue+"</option>");	
	for (var i=currentYear; i>=DRPOpen; i--) {
		document.write("<option value='"+i+"'>"+i+"</option>");
	}	
	document.write("</select>");						
}	 


/***********************
       Browser detection 
***********************/

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


/***********************
       Footer utils 
***********************/

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}


function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

/*
function openPrint(){
printPage=window.open('#', 'print', 'width=500,height=600);
printPage.document.all('print').href='/system/Styles/print.css';
//setTimeout('window.printPage.document.getElementById("print").href="/system/Styles/print.css"',0);
}
*/


function openPrint(dns){
printPage=window.open(document.location.href+'?print', 'print', 'width=540,height=600,scrollbars=yes');
}


function checkPrint(dns){
if(document.location.href.indexOf('?print')!=-1){
document.getElementById('print').href=dns+'print.css';
window.print();
}
}



function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}



function Set_Cookie2( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" + value  +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}




// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
if (start!=1){start = document.cookie.indexOf(" "+ name + "=" );}

var len = start + name.length + 1;
if ( ( !start ) &&
(name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
	


// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}	


function getURLVariable(strVarNameToSearch){ 
 if(location.search.substring(1)){ 
         // Get all the argument in the URL in a table 
         tbVar = location.search.substring(1).split('&'); 
         for(i=0 ; i<tbVar.length ; i++){ 
                 // Look for equal character 
                 intPosEgal = (tbVar[i].indexOf("=",0)); 
                 // Get the name of the variable 
                 strVarName = tbVar[i].substring(0,intPosEgal); 
                if(strVarNameToSearch == strVarName){ 
                         // Return the variable value 
                         return tbVar[i].substring(intPosEgal+1,tbVar[i].length); 
                 } 
         } 
 } 
 // variable not found 
 return "" 
} 



function logout(redirect){

   Delete_Cookie('LOGIN', '/', '');
   Delete_Cookie('LOGIN', '/', '.disneylandparis.com.webrelaunch-prod.dlp.disney.com');
   Delete_Cookie('LOGIN', '/', '.disneylandparis.com');

//   Set_Cookie( 'LOGOUT', 'yes', '', '/', '', ''); 
   window.document.location.href=redirect;
} 	


function Test_Login(){
   var bitLogged;
   Get_Cookie( 'LOGIN' )? bitLogged=true : bitLogged=false;
   if (document.location.href.indexOf("logout=true")!=-1){bitLogged=false;Delete_Cookie('LOGIN', '/', '');}
   return bitLogged;
}




/***********************
       Campaign utils 
***********************/


function trackParam(){

	// TDUID
	// récupère le Tradedoubler ID et le stocke dans un cookie sous le nom TDUID
	var tduid = getURLVariable('tduid'); 

	// AFFID
	// récupère l'Affilié ID et le stocke dans un cookie sous le nom AFFID
	var affid = getURLVariable('affId'); 
	
	// CAMID
	var camid = getURLVariable('camid'); 
	
	// MAUID	
	var mauid = getURLVariable('mauid'); 

	// 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;
	}	
	return wr1;

}

function OmniAffiliate(){

			var affiliation = "";	
			var param="";
			

			document.write("<span id='affiliateSpan'></span>"); 
			affiliate = document.getElementById("affiliateSpan");			
			if (trackParam()!=''){param='?'+trackParam();}
			

		   if(affiliate!=null && param!=''){
				affiliate.innerHTML = "<iframe src='http://www.disneylandparis.com/affiliation.htm"+param+"' width='0' height='0' scrolling='none' frameborder='0' name='affiliation' align='center'>"; 			   
			}
}
	




<!-- Copyright 2009 Cedexis Inc. -->
var cedexis=function(){return{_objectUrl:null,_objectId:null,_startClock:null,

_customerId:"1-10041",

_sources:[
  "http://exp.francetv.fr/cdn5.js?13",
  "http://cloudfront.cedexis.com/cdn5.js?14",
  "http://testcdn.chinacache.com/cedexis/cdn5.js?17",
  "http://hwcdn.net/z5t8n6p8/cds/cdn5.js?18",
  "http://atanarglobal.http.internapcdn.net/atanarglobal_vitalstream_com/cdn5.js?19",
  "http://limelight.cedexis.com/cdn5.js?20",
  "http://cedexis.com.lg1x8.simplecdn.net/cdn5.js?21",
  "http://http5.mhvcdn.yacast.net/mhvcdn/cdn5.js?22",
  "http://edgecast.cedexis.com/cdn5.js?24",
  "http://cedexis.panthercustomer.com/cdn5.js?25",
  "http://mi.cedexis.com/cdn5.js?31",
  "http://level3.cedexis.com/cdn5.js?32",
  "http://cotendo.cedexis.com/cdn5.js?33",
  "http://bitgravity.cedexis.com/cdn5.js?35",
  "http://cedexis.cdn.on.net/cdn5.js?126",
  "http://ngenix.cedexis.com/cdn5.js?168",
  "http://cdx-eu.s3.amazonaws.com/cdn5.js?15",
  "http://cdx-us.s3.amazonaws.com/cdn5.js?16",
  "http://services.nirvanix.com/Interchange/cedexis/cdn5.js?23",
  "http://cdn.cloudfiles.mosso.com/c58712/cdn5.js?85",

],loadScript:function(url,onload){var _s=document.createElement('script');_s.setAttribute('src',url);_s.setAttribute('type','text/javascript');_s.onload=onload;_s.onreadystatechange=function(){if(_s.readyState=='loaded')onload();};document.getElementsByTagName("head")[0].appendChild(_s);},postLoad2:function(){_stopClock=new Date().getTime();_elapsed=Math.round((_stopClock-cedexis._startClock)/10)*10;
var _report="http://"+_elapsed+"."+cedexis._objectId+"."+cedexis._customerId+".a.radar.cedexis.net:4";cedexis.loadScript(_report,null);},postLoad1:function(){cedexis._startClock=new Date().getTime();cedexis.loadScript(cedexis._objectUrl+"?"+Math.random(),cedexis.postLoad2);},sample:function(){_testObject=this._sources[Math.floor(Math.random()*this._sources.length)].split( "?" );this._objectUrl=_testObject[0];this._objectId=_testObject[1];this.loadScript(this._objectUrl+"?"+Math.random(),this.postLoad1);}}}();setTimeout('cedexis.sample()',2000);



/************************************************************************/
/************************************************************************/
/*************     IDENTIFICATION ANNUAL PASSPORT    ********************/
/*Annual Passport Management : this script enables a password section to
 fill in. If the required password is ok, the user can be connected to
            new offers. The script used ajax commons dev tools
/************************ EOS - spt. 2009 ********************************/
/************************************************************************/


//Définitions des variables globales :

// Chemin vers le XML des mots de passe
var pathXmlPass = "/FR/FR/Distant/system/XML/annual-passport/password.xml";
//Chemin vers les XML des messages d'erreur
var pathXmlErrorUrl = "/FR/FR/Distant/system/XML/annual-passport/errors.xml";
//Nom de l'élement HTML où sont affichés les messages d'erreur
var elementId = "message";
//Nom du cookie
var cookieNamePassword = "password";


// Méthode permettant de créer une instance asynchrone (AJAX) - private

function P_getRequester() {
    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
        return xhr;
    }
    else if (window.ActiveXObject) {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
        return xhr;
    }
    if (!xhr) {
        alert("Your browser does not accept AJAX, use another browser (Internet Explorer, Firefox, GoogleChrome...)");
        return false;
    }
}

/* Méthode permettant de charger le fichier XML des mots de passe et de rencoyer la réponse (responseXML)
     Cette méthode appelle P_checkPassword qui renvoie le message d'erreur approprié - private  */

function P_loadPassData(index) {
    var requester = P_getRequester();
    requester.onreadystatechange = function() {
        if (4 == requester.readyState && 200 == requester.status) {
            var xml = requester.responseXML;
            switch(index){
                case 1 : P_checkPassword(xml);
                    break;
                case 2 : P_checkUrlPassword(xml);
                    break;
            }
        }
    };
    requester.open('GET', pathXmlPass, true);
    requester.send(null);
}




/* Méthode permettant de charger le fichier XML des messages d'erreur et de renvoyer la réponse (responseXML)
    Cette méthode appelle P_parserXml qui permet de surcharger la méthode P_loadErrorData - private  */

function P_loadErrorData(div,index) {
    var requester = P_getRequester();
    requester.onreadystatechange = function() {
        if (4 == requester.readyState && 200 == requester.status) {
            var xml = requester.responseXML;
            P_parserXml(xml,div,index);
        }
    };
    requester.open('GET', pathXmlErrorUrl, true);
    requester.send(null);
}

/* Méthode de redirection appelée dans toutes les pages sauf la page d'identification
   permettant de rediriger l'utilisateur vers l'url (méthode P_getUrlRedirection) du fichier XML.
   Cette méthode est appelée via sa méthode public P_redirect - private */


function P_loadUrlData(cookieNamePassword) {
    var requester = P_getRequester();
    requester.onreadystatechange = function() {

        if (4 == requester.readyState && 200 == requester.status) {
            var url = "";
            var xml = requester.responseXML;
            if (P_getCookie(cookieNamePassword)==null) {
                url = P_getUrlRedirection(xml);
                window.location = url;
            }
        }
    };
    requester.open('GET', pathXmlErrorUrl, true);
    requester.send(null);
}


function P_getUrlEnter(xml){
    var lien = xml.getElementsByTagName('txt');
    var lienTab = new Array();
    for(var i = 0;i<lien.length;i++){
        lienRead = lien[i].getElementsByTagName('urlOk')[0];
        lienTab[i] = lienRead.firstChild.data;

    }
    return 	lienTab[0];
}


function P_getUrlId() {
    var requester = P_getRequester();
    requester.onreadystatechange = function() {
        if (4 == requester.readyState && 200 == requester.status) {
            var xml = requester.responseXML;
            window.location = P_getUrlEnter(xml);
        }
    };
    requester.open('GET', pathXmlErrorUrl, true);
    requester.send(null);
}


function P_getUrlRedirection(xml){
    var urlTab = new Array();
    var url = xml.getElementsByTagName('txt');
    for(var i = 0;i<url.length;i++){
        urlRead = url[i].getElementsByTagName('urltxt')[0];
        urlTab[i] = urlRead.firstChild.data;
    }
    return 	urlTab[0];
}

// Méthode d'appel de méthode permettant de renvoyer les réponses via des méthodes spécifiques, en dessous - private

function P_parserXml(xml,div,index){
    var result="";
    switch (index){
        case 1 : result=P_getErrorUrl(xml);
            break;
        case 2 : result=P_getErrorMsg(xml);
            break;
        case 3 : result=P_getValidationMsg(xml);
            break;
        case 4 : result=P_getEmptyMsg(xml);
            break;
        case 5 : result=P_getErrorMsgUrl(xml);
            break;
    }
    if (result) {
        document.getElementById(div).innerHTML = result;
    }
}

/* Ces six méthodes permettent d'extraire les listes de type chaine des fichier XML et de les renvoyer
   sous forme d'un tableau - private */

//Début


function P_getMdp(xml){
    var mdp = xml.getElementsByTagName('mdp');
    var mdpTab = new Array();
    for(var i = 0;i<mdp.length;i++){
        mdpRead = mdp[i].getElementsByTagName('mdptxt')[0];
        mdpTab[i] = mdpRead.firstChild.data;
    }
    return 	mdpTab;
}

function P_getErrorUrl(xml){
    var msg = xml.getElementsByTagName('txt');
    var msgTab = new Array();
    for(var i = 0;i<msg.length;i++){
        msgRead = msg[i].getElementsByTagName('errorUrl')[0];
        msgTab[i] = msgRead.firstChild.data;
    }
    return 	msgTab[0];
}

function P_getErrorMsgUrl(xml){
    var msg = xml.getElementsByTagName('txt');
    var msgTab = new Array();
    for(var i = 0;i<msg.length;i++){
        msgRead = msg[i].getElementsByTagName('errorUrlMdp')[0];
        msgTab[i] = msgRead.firstChild.data;
    }
    return 	msgTab[0];
}

function P_getErrorMsg(xml){
    var msg = xml.getElementsByTagName('txt');
    var msgTab = new Array();
    for(var i = 0;i<msg.length;i++){
        msgRead = msg[i].getElementsByTagName('errorMdp')[0];
        msgTab[i] = msgRead.firstChild.data;
    }
    return 	msgTab[0];
}

function P_getValidationMsg(xml){
    var msg = xml.getElementsByTagName('txt');
    var msgTab = new Array();
    for(var i = 0;i<msg.length;i++){
        msgRead = msg[i].getElementsByTagName('mdpOk')[0];
        msgTab[i] = msgRead.firstChild.data;
    }
    return 	msgTab[0];
}

function P_getEmptyMsg(xml){
    var msg = xml.getElementsByTagName('txt');
    var msgTab = new Array();
    for(var i = 0;i<msg.length;i++){
        msgRead = msg[i].getElementsByTagName('emptyMdp')[0];
        msgTab[i] = msgRead.firstChild.data;
    }
    return 	msgTab[0];
}

//Fin


// Méthode permettant de vérifier la valeur du mot de passe. Les messages renvoyés sont fonctions de la langue du site

function P_checkPassword(xml) {
    var password = document.getElementById('myPass').value;
    var msg = new Array();
    if (password) {
        msg = P_loadErrorData(elementId,2);
        var i;
        for(i=0; i<P_getMdp(xml).length;i++) {
            // le mot de passe est OK
            if (P_getMdp(xml)[i]==password) {
                msg = P_loadErrorData(elementId,3);
                P_setCookie(cookieNamePassword, password);
                P_getUrlId();
            }
        }
    }
    else {
        msg = P_loadErrorData(elementId,4);
    }
    return msg;
}

//Méthode permettant de modifier le type de l'input en password

function P_setFocusPassword() {

    var element = document.getElementById("test45");
    var elementList = element.getElementsByTagName("input");
    var child=elementList.item(0);
    element.removeChild(child);
    var input = document.createElement('input');
    input.setAttribute('id','myPass');
    input.setAttribute('type','password');
    input.setAttribute('size','17');
    input.setAttribute('value','');
    element.appendChild(input);
    if (document.all) {
        var span = document.createElement('span');
        span.innerHTML="&nbsp;";
        element.appendChild(span);
    }
    elementList[0].focus();

}



// Fonctions de cookies - private

function P_setCookie(name, value)	{
    var argv=P_setCookie.arguments;
    var argc=P_setCookie.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=name+"="+escape(value)+((expires==null) ? "" : ("; expires="+expires.toGMTString()))+((path==null) ? "" : ("; path="+path))+
    ((domain==null) ? "" : ("; domain="+domain))+((secure==true) ? "; secure" : "");
}

function P_getCookieVal(offset) {
    var endstr=document.cookie.indexOf (";", offset);
    if (endstr==-1)
        endstr=document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function P_getCookie (cookieNamePassword) {
    var arg=cookieNamePassword+"=";
    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 P_getCookieVal (j);
        i=document.cookie.indexOf(" ",i)+1;
        if (i==0) break;
    }
    return null;
}

// Méthode permettant d'extraire les paramètres de l'url sous forme d'un tableau - private

function P_extractUrlParams(){
    var t = location.search.substring(1).split('&');
    var urlParams = [];
    for (var i=0; i<t.length; i++){
        var x = t[ i ].split('=');
        urlParams[x[0]]=x[1];
    }
    return urlParams;
}

//Méthode qui permet de récupérer le paramètre spécifique password passé dans l'url - private

function P_getUrlPassword() {
    var password = P_extractUrlParams()[cookieNamePassword];
    if (password !=null && password != "") {
        return password;
    } else {
        return null;
    }
}

/* Méthode de vérification du mot de passe envoyé dans l'url : si le mot de passe de l'url
   se trouve dans le fichier XML, l'utilisateur est automatiquement identifié; on place le cookie et
   on n'affiche pas le formulaire d'identification, sinon on affiche un message invitant l'utilisateur à s'identifier - private*/

function P_checkUrlPassword(xml) {
    var urlPassword = P_getUrlPassword();
    var msg = P_loadErrorData(elementId,5);
    var validate = false;
    for (var i = 0;i<P_getMdp(xml).length; i++) {
        if (P_getMdp(xml)[i]==urlPassword) {
            P_setCookie(cookieNamePassword, urlPassword);
            P_loadErrorData(elementId,3);
            P_loadUrlData(cookieNamePassword);
            validate = true;
        }
    }
    if (!validate) {
        return msg;
    }
}

/* Appel de la méthode qui vérifie les paramètres passés par l'url pour une identification automatique - public */

function P_checkUrlParam() {
    if (P_getUrlPassword() != null) {
        return  P_loadPassData(2);
    }else {
        return false;
    }
}

/* Cette méthode permet de renommer P_loadErrorData pour plus de clarté dans le code - public */

function P_submitPass() {
    return P_loadPassData(1);
}


function P_displayLink() {
    if (P_getCookie(cookieNamePassword)!=null) {
        var element = document.getElementById("test45");
        var elementList = element.getElementsByTagName("input");
        var child=elementList.item(0);       
        element.removeChild(child);
        document.getElementById("submitPass").style.display="none";
        document.getElementById("txtLink").style.marginLeft="30px";
        document.getElementById("txtLink").style.display="block";

        
    }
}

/* Cette méthode permet de renommer P_loadUrlData pour plus de clarté dans le code - public */

function P_redirect() {
    return P_loadUrlData(cookieNamePassword);
}

/* Méthode permettant d'ajouter un écouteur dans le code javascript, quelque soit le navigateur.
     Cette méthode permet d'éviter d'inclure du code javascript dans le code HTML. Private */

function P_addListener(element, baseName, handler) {
    if (element.addEventListener) { //Firefox Safari
        element.addEventListener(baseName, handler, false);
    }
    else if (element.attachEvent) { //IE
        element.attachEvent('on'+baseName, handler);
    }
}

/* Méthode permettant l'accès au bouton qui soumet le mot de passe. Cette méthode appelle l'écouteur
    dans son contexte.  Public */

function P_displayMessage(id) {
    var element = document.getElementById(id);
    P_addListener(element, 'click', P_submitPass);
}

function P_changeInputType(id) {
    var element = document.getElementById(id);
    P_addListener(element, 'click', P_setFocusPassword);
}
/*************************************************************
*METHODS ENABLE TO APPLY RULES OF PRESENTATION TO THE HEADER** 
****************AND THE MENU ABOVE****************************
************Code by EOS -- JANUARY 2010 --********************
**************************************************************/

/* The both methods below enables to apply rules of presentation to the header.
If the my disneyland si not linked, the method moveLayerWithoutLink is called , else the
method moveLayerWithLink is called by the public method moveDownLayer */

// Private

function moveLayerWithLink() {
    var menuHeader = document.getElementById("menuHeader");
    var roundFrame = document.getElementById("menuRoundFrame");
    var menuInsideHeader = document.getElementById("menuInsideHeader");
    var menuHeaderLink = document.getElementById("menuHeaderLink").offsetWidth;
    var frameWidth = roundFrame.offsetWidth;
    var menuHeaderWidth = menuHeader.offsetWidth;    
    var widthMenuInsideHeader = menuHeaderWidth- (menuHeaderLink+ frameWidth+ 30);
    var menuInsideHeaderUl = new Array()
    menuInsideHeaderUl = menuInsideHeader.getElementsByTagName("ul");
    menuInsideHeader.style.width=widthMenuInsideHeader+"px";
    var menuHeaderHeight = menuInsideHeader.offsetHeight;    
    if (menuHeaderHeight > 31) {
        for (var i=0; i<menuInsideHeaderUl.length; i++) {
            menuInsideHeaderUl[i].style.height="22px";
        }
        menuInsideHeader.style.width=(widthMenuInsideHeader-20)+"px";
        menuInsideHeader.style.marginTop="20px";
        menuInsideHeader.style.marginLeft="30px";
    }
    menuHeader.style.visibility="visible";
}
// Private

function moveLayerWithoutLink() {
    var menuHeader = document.getElementById("menuHeader");
    var menuInsideHeader = document.getElementById("menuInsideHeader");
    menuInsideHeader.style.width="600px";
    menuInsideHeader.style.height="10px";
    var menuInsideHeaderli = new Array();
    menuInsideHeaderli = menuInsideHeader.getElementsByTagName("li");
    for (var i = 0; i<menuInsideHeaderli.length; i++) {
        menuInsideHeaderli[i].style.cssFloat="left";
        menuInsideHeaderli[i].style.width="auto";
    }
    menuHeader.style.visibility="visible";
}

// Public

function moveDownLayer() {
    if (document.getElementById("menuRoundFrame") != null) {
        moveLayerWithLink();
    } else {
        moveLayerWithoutLink();
    }
}

// This method enables to make distinction between Internet Explorer Versions - Private

function msieVersion() {
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf ( "MSIE " );
    if ( msie > 0 ) {
        return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )));
    }
    else {
        return 0;
    }
}

// This method applies specific presentation rules to the rollover menu
// If the text of the menu is longer than the box, the menu is affected by
// a sepific styleSheet which allows to display the menu on two lines
// - Public


function displayTwoLines() {
    var menu = document.getElementById("menuContainer");
    var menuUl = new Array();
    menuUl = menu.getElementsByTagName("ul");
    var menuUlFirstLevel = new Array();
    var j = 0;
    var navigateur = navigator.appName;
    var ie = "Microsoft Internet Explorer";
    var menuLi = menu.getElementsByTagName("li");
    var size = "";
    (msieVersion() > 6) ? size = 17 : size = 19;
    // Test Platform Apple
    if (navigator.platform=="MacPPC") {
        document.getElementById("blueLine").style.marginTop="-1px";
    }
    // Test IE & OPERA
    if (msieVersion() > 6 || navigateur=="Opera") {
        document.getElementById("blueLine").style.marginTop="-1px";
    }
    for (var n=0; n<menuLi.length; n++) {
        if (menuLi[n].childNodes[0].firstChild.length>30) {
            menuLi[n].firstChild.style.lineHeight="18px";
            menuLi[n].firstChild.style.height="35px";
        }
    }
    for (var i =0; i<menuUl.length; i+=2) {
        menuUlFirstLevel[j++]=menuUl[i];
    }
    for (var y=0; y<menuUlFirstLevel.length;y++) {
        if (navigateur == ie ) {
             if (menuUlFirstLevel[y].firstChild.firstChild.firstChild.length==18) {
                menuUlFirstLevel[y].firstChild.firstChild.style.letterSpacing="0.05em";
             }
            if (menuUlFirstLevel[y].firstChild.firstChild.firstChild.length>=size) {
                menuUlFirstLevel[y].firstChild.firstChild.style.lineHeight="14px";
                if (msieVersion() == 6) {
                    menuUlFirstLevel[y].firstChild.firstChild.style.marginTop="4px";
                }
                if ( menuUlFirstLevel[y].firstChild.firstChild.style.lineHeight=="14px") {
                    if (msieVersion() > 6) {
                        menuUlFirstLevel[y].firstChild.firstChild.style.backgroundPosition="-0.45em -0.3em";
                    } else {
                        menuUlFirstLevel[y].firstChild.firstChild.style.backgroundPosition="0em -0.118em";
                    }
                    if (menuUlFirstLevel[y].firstChild.firstChild.firstChild.length==19) {
                        menuUlFirstLevel[y].firstChild.firstChild.style.letterSpacing="0.05em";
                    }
                }
            }
        }else { 
 

               if (menuUlFirstLevel[y].childNodes[1].firstChild.firstChild.length>=18) {
                                       menuUlFirstLevel[y].childNodes[1].firstChild.style.lineHeight="14px";
                                       menuUlFirstLevel[y].childNodes[1].firstChild.style.letterSpacing="1pt";                
            }
         }
    }
}


/* This method enables to display the login/logout system depending
of the identification mode of the guest - Public */

function displayLoginLogout(){
    var menuInsideHeaderRight = document.getElementById("menuInsideHeaderRight");
    var navBarLi = menuInsideHeaderRight.getElementsByTagName("li");
    if (Get_Cookie( 'LOGIN' )) {
        navBarLi[2].style.display="block";
        navBarLi[1].style.display="none";
    }
    else {
        navBarLi[1].style.display="block";
        navBarLi[2].style.display="none";
    }
}

// This method enables to highlight rollover menu depending where the guest is
// connected - Public

function highLightLink(menuHeaderSelected) {

    var menu = document.getElementById("menuContainer");
    var menuUl = new Array();
    menuUl = menu.getElementsByTagName("ul");
    var menuUlFirstLevel = new Array();
    var j = 0;
    var ApplyToMenu = "";
    var navigateur = navigator.appName;
    var ie = "Microsoft Internet Explorer";
    for (var i =0; i<menuUl.length; i+=2) {
        menuUlFirstLevel[j++]=menuUl[i];
    }
    if (navigateur == ie) {
        ApplyToMenu =  menuUlFirstLevel[menuHeaderSelected].firstChild.firstChild;
        with(ApplyToMenu.style) {
            background="url(http://www.disneylandparis.fr/Images/107x28-backBlueMenu.jpg)";
            backgroundRepeat="no-repeat";
            backgroundPosition="center";
            color="#fff";
            if (msieVersion() > 6) {
                width="106px";
                marginLeft="-1px";
                marginTop="-1px";
            }
            }
        if (ApplyToMenu.style.lineHeight == "14px"){
            ApplyToMenu.style.marginTop="2px";
            if (msieVersion() > 6) {
                ApplyToMenu.style.marginTop="0px";
            } else {
                ApplyToMenu.style.marginTop="2px";
            }
        }
    }
    else {
        ApplyToMenu =  menuUlFirstLevel[menuHeaderSelected].childNodes[1].firstChild;
        with(ApplyToMenu.style) {
            background="url(http://www.disneylandparis.fr/Images/107x28-backBlueMenu.jpg)";
            backgroundRepeat="no-repeat";
            backgroundPosition="center";
            width="106px";
            marginLeft="0px";
            color="#fff";
            if (ApplyToMenu.style.lineHeight == "14px"){
                marginTop="1px";
            }
            }
        if (navigateur == "Opera") {
            ApplyToMenu.style.backgroundPosition="50% -0.03em";
        }
    }
}
