

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";path=/;expires="+exdate.toGMTString());
}
function getCookie(c_name)
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	  }
	return "";
}




/*Author : C.Allen*/



/*	imgPath is defined here to allow developpers to change the
 *	images folder as some of them must be defined directly into
 *	the javascript code.
 * */
if(!imgPath){
	imgPath = "img";
}
if(!airportXML){
	airportXML = "http://www.aeromexico.com/en_us/handlers/fromtohandler.ashx";
}
var flag = 0;
var zindex = 999;
/* utils */
	/* addOnloadEvent(fct)
	 * fct : function
	 * unobstructive addition of functions that must be run when page is loaded
	 * ex : addOnloadEvent(function(){alert("hello world");});
	 */
	
	document.isLoaded = false;
	function addOnloadEvent(fct){
		if(document.isLoaded)fct();
		else{
			var oldonload = window.onload;
			if (typeof window.onload != 'function') {
				window.onload = fct;
			}
			else {
				window.onload = function() {
					oldonload();
					fct();
				}
			}
		}
	}
	addOnloadEvent(function(){document.isLoaded=true;});
	
	function addOnresizeEvent(fct){
		var oldonresize = window.onresize;
		if (typeof window.onresize != 'function') {
			window.onresize = fct;
		}
		else {
			window.onresize = function() {
				oldonresize();
				fct();
			}
		}
	}
	
	/* $i(val)
	 * val : String
	 * function that returns the HTML element with "id=val"
	 * ex: var a = $i("foo");
	 * */
	function $i(val){
		return document.getElementById(val);
	}
	
	/* $t(elemType,o)
	 * elemType : String
	 * o : HTML element (optional, "centerContent" as default element)
	 * function that returns the list of every "elemType" HTML element childrens of "o"
	 * ex: var arrayLi = $t("li",$i("foo")); // returns all "li" inside "foo"
	 * */
	function $t(elemType,o){
		if(!o)o=$i("centerContent");
		return o.getElementsByTagName(elemType);
	}
	
	/* $c(elemType,cssClass,o)
	 * elemType : String
	 * cssClass : String
	 * o : HTML element (optional, "centerContent" as default element)
	 * function that returns the list of every "elemType" HTML element with className "cssClass" childrens of "o"
	 * ex: var arrayLiFoocss = $c("li","foocss",$i("foo")); // returns all "li" with class "foocss" inside "foo"
	 * */
	function $c(elemType,cssClass,o){
		if(!o)o=$i("centerContent");
		var listLcl = o.getElementsByTagName(elemType);
		var list2return = new Array();
		for(var i=0;i<listLcl.length;i++){
			if(listLcl[i].className.indexOf(cssClass+" ")>-1 || listLcl[i].className.indexOf(" "+cssClass)>-1 || listLcl[i].className == cssClass)
				list2return.push(listLcl[i]);
		}
		return list2return;
	}
	
		
	/* $t1L(elemType,o)
	 * elemType : String
	 * o : XML element
	 * function that returns the list of every 1st level childnode of "o" of tagname "elemType" 
	 * ex: var arrayLi = $t1L("li",$i("foo"));
	 * */
	function $t1L(elemType,o){
		var lstLcl = new Array();
		for(var i=0;i<o.childNodes.length;i++){
			if(o.childNodes[i].tagName && o.childNodes[i].tagName.toLowerCase()==elemType){
				lstLcl.push(o.childNodes[i]);
			}
		}
		return lstLcl;
	}
	
	/* $c1L(elemType,cssClass,o)
	 * elemType : String
	 * cssClass : String
	 * o : XML element
	 * function that returns the list of every 1st level childnode of "o" of tagname "elemType" and className "cssClass"
	 * ex: var arrayLiFoocss = $c1L("li",$i("foo"));
	 * */
	function $c1L(elemType,cssClass,o){
		var lstLcl = new Array();
		for(var i=0;i<o.childNodes.length;i++){
			var lcl = o.childNodes[i];
			if(lcl.tagName && lcl.tagName.toLowerCase()==elemType && (lcl.className.indexOf(cssClass+" ")>-1 || lcl.className.indexOf(" "+cssClass)>-1 || lcl.className == cssClass)){
				lstLcl.push(lcl);
			}
		}
		return lstLcl;
	}
	
	/*shortcut to create an element*/
	function $dc(v){return document.createElement(v);}
/* utils */

var amex=(typeof(amex)!="undefined")?amex:{};
amex.IE = navigator.appVersion.split('MSIE ')[1]!=null;
amex.IE6 = (amex.IE && parseInt(navigator.appVersion.split('MSIE ')[1].substr(0,1))<7);


/*	Instead of addOnloadEvent; Avoid to wait the loading of every images of the page.
 * */
amex.initASAP = function(fct){
	if(($i("centerContent")&&amex.IE6)||document.readyState=="complete"){
		fct();
	}else{
		var fct1 = fct;
		setTimeout(function(){amex.initASAP(fct1)},100);
	}
}

/*	amex.IE6fix(o,forceIE)
 * 	o : HTML element within fix must apply (optional, "centerContent" as default element)
 * 	forceIE : boolean
 * 	Function used to fix IE6 png transparency AND IE6+ png transparency when used with filter:Alpha
 * 
 * note: this fix does not work on hidden element
 * */

amex.IE6fix = function(o,forceIE){
	try{
		if(amex.IE6 || forceIE && amex.IE){
			var imgs = $t("img",o);
			var s = amex.IE6fix.arguments[2];s=s?s:0;
			for(var i=s;i<imgs.length;i++){
				if(imgs[i].src.indexOf(".png")>-1){
					var tmpDiv = $dc("DIV");
					tmpDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src="+imgs[i].src+")";
					var w=imgs[i].offsetWidth;
					var h=imgs[i].offsetHeight;
					if(w>0)w+="px";else w=imgs[i].style.width;
					if(h>0)h+="px";else h=imgs[i].style.height;
					tmpDiv.style.width = w;
					tmpDiv.style.height = h;
					tmpDiv.className = imgs[i].className;
					iPar = imgs[i].parentNode;
					iPar.insertBefore(tmpDiv,imgs[i]);
					iPar.removeChild(imgs[i]);
					var o1=o,fIE=forceIE,i1=i;
					setTimeout(function(){amex.IE6fix(o1,fIE,i1);},5);
					break;
				}
			}
		}
	}catch(e){}
}



amex.addPng=function(imUrl,o,classname){
	if(o){
		var i;
		if(amex.IE6 && imUrl.indexOf(".png")>-1){
			i = $dc("DIV");
			i.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src="+imUrl+")";
		}else{
			var i = $dc("img");
			i.src=imUrl;
		}
		if(classname)i.className=classname;
		o.insertBefore(i,o.firstChild);
		return i;
	}
	return null;
}

/* amex.timer 
 * used as a timeline
 * */
amex.timer = new Object();
amex.timer.isRunning = false;
amex.timer.fct = new Array();

/* amex.timer.addFct(fct,arg)
 * fct : function
 * arg : Array (of arguments)
 * to add a function in the timeline 
 * ex : see "amex.displace" function
 * */
amex.timer.addFct = function(fct,arg){
	this.fct.push({fct:fct,arg:arg});
	if (!this.isRunning) {
		this.isRunning=true;
		this.run();
	}
};

/* amex.timer.run()
 * can be used directly to force timer to run
 * note : the delay of timeout is located here (20ms)
 * */
amex.timer.run = function(){
	if(amex.timer.fct.length>0){
		setTimeout(amex.timer.run,50);
		var lastFct = 0;
		for(var i=0;i<amex.timer.fct.length;i++){
			if (!amex.timer.fct[i].fct(amex.timer.fct[i].arg)) {
				amex.timer.fct[i] = null;
			}else{
				if(lastFct<i){
					amex.timer.fct[lastFct]=amex.timer.fct[i];
					amex.timer.fct[i] = null;
				}
				lastFct++;
			}
		}
		while(amex.timer.fct.length>0 && !amex.timer.fct[amex.timer.fct.length-1])amex.timer.fct.pop();
	}else{amex.timer.isRunning = false;}
}

/* amex.timer.displace(o,property,val,inc,limit,nxtFct,eachFct)
 * o : HTML element : item to displace
 * property : String : css property to change
 * val : int : starting value
 * inc : int : incremental value
 * limit : int : value to reach
 * nxtFct : function (optional) : function to execute when displacement is over
 * eachFct : function (optional) : function to execute at each occurence
 * 
 * used to change a style property expressed in px of an element based on the timer timeline 
 * 
 * ex:amex.timer.displace($i("foo"),"height",500,-10,50,function(){alert("over")},function(){alert("running")});
 * */
amex.displace=function(o,property,val,inc,limit,nxtFct,eachFct){
	amex.timer.addFct(function(args){
		args[2]+=args[3];
		if((args[3]>0 && args[2]<=args[4]) || (args[3]<0 && args[2]>=args[4])){
			args[0].style[args[1]]=args[2]+"px";
		}else{
			args[0].style[args[1]]=args[4]+"px";
			if(args[6])args[6](args);
			if(args[5])args[5](args);
			return false;
		}
		if(args[6])args[6](args);
		return true;
	},amex.displace.arguments);
}

/* amex.timer.appear(o,inc,nxtFct)
 * o : HTML element : item to fade
 * inc : int : incremental value
 * nxtFct : function (optional) : function to execute when fade is over
 * 
 * used to fade in or fade out an HTML item 
 * 
 * ex:amex.timer.appear($i("foo"),-10,function(){alert("over")}});
 * 
 * note:to avoid link supperposition or unclickable items, the display of o is set to "none" 
 * */
amex.appear=function(o,inc,nxtFct){

	amex.timer.addFct(function(args){
		if (!args[0].init) {
			args[0].init=true;
			args[0].opacity = args[1] > 0 ? 0 : 100;
		}
		args[0].opacity+=args[1];
		if((args[1]>0 && args[0].opacity<100) || (args[1]<0 && args[0].opacity>0)){
			args[0].style.display="block";
			if(amex.IE)args[0].style.filter="Alpha(Opacity="+args[0].opacity+")";
			else args[0].style.opacity=args[0].opacity/100;
		}else{
			args[0].init = false;
			args[0].style.display=args[1]<0?"none":"block";
			if(amex.IE)args[0].style.filter="Alpha(Opacity="+(args[1]<0?0:100)+")";
			else args[0].style.opacity=args[1]<0?0:1;
			if(args[2])args[2]();
			return false;
		}
		return true;
	},amex.appear.arguments);
}

/*	amex.createCntBg() , amex.expandCntBg()
 * main background generation and management with Alpha
 * */
amex.createCntBg = function(){
	var d = $dc("div");
	d.style.position="absolute";
	d.style.top=$i("header").offsetHeight+"px";
	d.style.left="0px";
	d.style.width=$i("centerContent").offsetWidth+"px";
	d.style.backgroundColor="#FFFFFF";
	d.style.opacity="0.5";
	d.style.filter="Alpha(Opacity=50)";
	$i("centerContent").insertBefore(d,$i("centerContent").firstChild);
	amex.mainBackground = d;
	amex.expandCntBg();
}
amex.expandCntBg = function(){
	if (amex.mainBackground && amex.mainBackground.style) {
		amex.mainBackground.style.height = ($i("middle").offsetHeight<20?0:($i("middle").offsetHeight-20)) + "px";
	}
}

/*MGA 20090608 - Background switching function*/
amex.bgs={
	dflt:"/img/common/bg1.jpg",
	rotating:[
		"/img/common/bg1.jpg",
		"/img/common/bg2.jpg",
		"/img/common/bg3.jpg",
		"/img/common/bg4.jpg",
		"/img/common/bg5.jpg",
		"/img/common/bg6.jpg",
		"/img/common/bg7.jpg"
	]
}
amex.initBg=(function(){
	return {
		getImgUrl:function(){
			var ct=(new Date()).getHours();
			if (ct<=4){return amex.bgs.rotating[0];}
			if (ct<=8){return amex.bgs.rotating[1];}
			if (ct<=12){return amex.bgs.rotating[2];}
			if (ct<=16){return amex.bgs.rotating[4];}
			if (ct<=20){return amex.bgs.rotating[5];}
			if (ct<=24){return amex.bgs.rotating[6];}
			return amex.bgs.dflt;
		},
		setImg:function(){document.getElementsByTagName("body")[0].style.backgroundImage="url("+this.getImgUrl()+")";}
	}
})();



/*	amex.initDrop()
 * used to initialize every item of className "drop" to add functions to show/hide the sub "UL"
 * add a png as background of items with "dropCustom1" className
 * */
amex.initDrop=function(){
	var dList = $c("div","drop");
	for(var i=0;i<dList.length;i++){
		dList[i].onclick = function(){
			this.show=!this.show;
			var width=$(this).find("span")[0].offsetWidth;
			if (this.show) {
				this.onmouseover(width);
			}else{
				try{$t("ul",this)[0].style.display="none";}catch(ex){}
			}
		}
		dList[i].onmouseover=function(w){
			try{
				if (this.show) {
					$t("ul", this)[0].style.width=(w)+"px";
					$t("ul", this)[0].style.display = "block";
					clearTimeout(this.TO);
				}
			}catch(ex){}
		}
		dList[i].onmouseout=function(){
			lclthis = this;
			clearTimeout(this.TO);
			this.TO = setTimeout(function(){
				lclthis.show=false;
				try{$t("ul",lclthis)[0].style.display="none";}catch(ex){}
			},1000);
		}
		if(dList[i].className.indexOf("dropCustom1")>-1){
			amex.addPng(imgPath+"/common/dropCustom.png",dList[i],"bg");
		}
	} 	
}

/*	amex.initNavStyle(aL)
 * al : Array : list of all "a" items of a navigation
 * 
 * used to initialize the png background of a navigation like the main navigation or "experience" navigation
 * 
 * ex: amex.initNavStyle($t("a",$("foo")));
 * */
amex.initNavStyle = function(aL){
	for(var i=0;i<aL.length;i++){
		var d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		d1.className="bgNav";d1.style.position="absolute";d1.style.top="0px";d1.style.left="-6px";d1.style.width="6px";d1.style.height="28px";d1.innerHTML='<img class="bgImg" src="'+imgPath+'/common/nL.png" alt=""/>';
		d2.className="bgNav";d2.style.position="absolute";d2.style.top="0px";d2.style.right="-6px";d2.style.width="6px";d2.style.height="28px";d2.innerHTML='<img class="bgImg" src="'+imgPath+'/common/nR.png" alt=""/>';
		d3.className="bgNav";d3.style.position="absolute";d3.style.top="0px";d3.style.left="13px";d3.style.width=aL[i].offsetWidth+"px";d3.style.height="28px";d3.style.zIndex=0;d3.style.overflow="hidden";d3.innerHTML='<img class="bgImg" src="'+imgPath+'/common/nC.png" alt=""/>';
		aL[i].parentNode.insertBefore(d3,aL[i].parentNode.firstChild);
		aL[i].appendChild(d1);
		aL[i].appendChild(d2);
	}
}


amex.initNav3=function(){
	amex.initNavStyle($t("a",$i("nav3")));
}

/* amex.initAlert01()
 * to initialize the item "Info & booking tools" in the navigation and its extensions :
 * tabs items on the homepage, expandable menu in the content
 * */
amex.initAlert01=function(){
	var ong = $c("div","onglet",$i("alert01"));
	if(!ong[0]){return false;}

	var d1=$dc("div");
	d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";
	if($i("alert01").className.indexOf("closed")!=-1){
		d1.innerHTML='<img src="'+imgPath+'/common/alert1o1.png" alt=""/>';
	}else{
		d1.innerHTML='<img src="'+imgPath+'/common/alert1o.png" alt=""/>';
	}
	ong[0].insertBefore(d1,ong[0].firstChild);

	/*used on the homepage only*/
	var tb = $c("div","tabs",$i("alert01"));
	if(tb.length>0){
		d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";d1.innerHTML='<img src="'+imgPath+'/common/alert1t.png" alt=""/>';
		d2.style.position="absolute";d2.style.bottom="-16px";d2.style.left="0px";d2.innerHTML='<img src="'+imgPath+'/common/alert1b.png" alt=""/>';
		d3.style.position="absolute";d3.style.top="30px";d3.style.left="0px";d3.style.width="380px";d3.style.height=(tb[0].offsetHeight<30?0:(tb[0].offsetHeight-30))+"px";d3.style.zIndex=0;d3.style.overflow="hidden";d3.innerHTML='<img src="'+imgPath+'/common/alert1m.png" alt=""/>';
		tb[0].appendChild(d1);
		tb[0].appendChild(d2);
		tb[0].appendChild(d3);
		tb[0].bg = d3;
		tb[0].foot = d2;
		tb[0].fct = function(){
			var h = this.offsetHeight+15;
			$i("block1").style.height=h>209?h+'px':209+'px';
			amex.expandCntBg();
		}
	}
}

/*	amex.initTabs()
 * to initialize all tabs events of the page 
 * 
 * HTML structure :
 	 <div class="tabs">
		<ul>
			<li>tab 1</li>
			<li>tab 2</li>
		</ul>
		<div class="tabsContent">
			<div class="cnt">
				content 1
			</div>
			<div class="cnt">
				content 2
			</div>
		</div>
	</div>
 *  
 *  note : className of clicked "li" is "selected"
 */
amex.initTabs=function(){
	var tL = $c("div","tabs");
	var hasid = false;
	for(var i=0;i<tL.length;i++){
		//try{
			var tabs = $t("li",$t("ul",tL[i])[0]);
			var cnts = $t1L("div",$t("div",tL[i])[0]);
			if(!$t("a",tabs[0])[0]){
				var initTab = 0; 
				for(var j=0;j<tabs.length;j++){
					if(tabs[j].className=="selected")initTab = j;
					tabs[j].tabs = tabs;
					tabs[j].cnts = cnts;
					tabs[j].cnt = cnts[j];
					tabs[j].ref = tL[i];
					tabs[j].onclick = function(){
						for(var k=0;k<this.tabs.length;k++){
							this.tabs[k].className=this.tabs[k].className.replace(/selected/g,"");
							this.cnts[k].style.display="none";
							this.tabs[k].style.cursor="pointer";
						}
						this.className+=" selected";
						this.cnt.style.display="block";
						amex.initButton1(this.cnt);
						amex.IE6fix(this.cnt);
						if (typeof(this.ref.bg)!="undefined") {
							this.ref.bg.style.height = this.cnt.parentNode.offsetHeight+ "px";
							if (typeof(this.ref.foot)!="undefined") {
								this.ref.foot.style.top = this.ref.bg.offsetTop + this.ref.bg.offsetHeight + "px";
							}
						}
						if (typeof(this.ref.fct)!="undefined") {this.ref.fct();}
						amex.checkContentHeight();
amex.expandCntBg();
amex.rescaleContent2bgtabs();
						if(this.id){setCookie('AM_tabs', this.id, 365);}
					}
					hasid = (tabs[j].id != '');
				}
				if(hasid){	
					if(getCookie('AM_tabs') == ""){
						setCookie('AM_tabs', "t_0", 365);
					}
					//MGA fix: cookies were supposed to be active
					var cookieVal=(getCookie('AM_tabs').length>3)?getCookie('AM_tabs').substring(2,3):0;
					tabs[cookieVal].onclick();
				}
				else {
					tabs[initTab].onclick();
				}
			}

		/*}catch(ex){
			alert("tabs initialization error :\nmore tabs than content, see red tab");
			tL[i].style.border="solid 5px #F00";
			tL[i].style.background="#F00";
		}*/
	}
}

amex.rescaleContent2bgtabs = function(){
	var cnt = $i("content2");
	if (cnt && cnt.bg) {
		var h = cnt.offsetHeight;
		cnt.bg.style.height = (h - 45) + "px";
		cnt.b.style.top = h+"px";
	}
}

/*	amex.initButton1()
 * to initialize dark blue png button "button1" 
 */
amex.initButton1 = function(o){
	var bL = $c("div","button1",o);
	for (var i = 0; i < bL.length; i++) {
		var ipt = $t("input",bL[i])[0];
		if(ipt.offsetWidth==0 || bL[i].set)continue;
		bL[i].set=true;
		var d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";d1.innerHTML='<img src="'+imgPath+'/common/bt1l.png" width="11" height="20" alt=""/>';
		d2.style.position="absolute";d2.style.top="0px";d2.style.right="0px";d2.innerHTML='<img src="'+imgPath+'/common/bt1r.png" width="18" height="20" alt=""/>';
		d3.style.position="absolute";d3.style.top="0px";d3.style.left="11px";d3.style.width=(ipt.offsetWidth<29?0:(ipt.offsetWidth-29))+"px";d3.style.height="20px";d3.style.zIndex=0;d3.style.overflow="hidden";d3.innerHTML='<img src="'+imgPath+'/common/bt1c.png" width="300" height="20" alt=""/>';
		bL[i].appendChild(d1);
		bL[i].appendChild(d2);
		bL[i].appendChild(d3);
		amex.IE6fix(bL[i]);
	}
}

/*	amex.initButton2()
 * to initialize light blue png button "button2" 
 */
amex.initButton2 = function(){
	var bL = $c("span","button2");
	for (var i = 0; i < bL.length; i++) {
		var d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		var ipt = $t("a",bL[i])[0];
		if(!ipt)ipt = $t("input",bL[i])[0];
		if(ipt)
		{
			d1.style.position="absolute";d1.style.top=amex.IE?"0px":"-1px";d1.style.left="0px";d1.style.zIndex=0;d1.innerHTML='<img src="'+imgPath+'/common/bt2l.png" alt=""/>';
			d2.style.position="absolute";d2.style.top=amex.IE?"0px":"-1px";d2.style.right="0px";d2.style.zIndex=0;d2.innerHTML='<img src="'+imgPath+'/common/bt2r.png" alt=""/>';
			d3.style.position="absolute";d3.style.top=amex.IE?"0px":"-1px";d3.style.left="15px";d3.style.width=(ipt.offsetWidth<37?0:(ipt.offsetWidth-37))+"px";d3.style.height="24px";d3.style.zIndex=0;d3.style.overflow="hidden";d3.innerHTML='<img src="'+imgPath+'/common/bt2c.png" alt=""/>';
			bL[i].appendChild(d1);
			bL[i].appendChild(d2);
			bL[i].appendChild(d3);
		}
	}
}

/*	amex.initBoxW()
 * to initialize boxes with gradient transparency of homepage
 */
amex.initBoxW = function(){
	var b = $c("div","boxW490");
	for(var i=0;i<b.length;i++){
		amex.addPng(imgPath+"/common/boxW490.png",b[i],"bg");
	}
	b = $c("div","boxW380");
	for(var i=0;i<b.length;i++){
		amex.addPng(imgPath+"/common/boxW380.png",b[i],"bg");
	}
}


/*	amex.initDefileur()
 * to initialize javascript animated "defileur" item on the homepage
 */
/* 
amex.hp_destinations={
	url:"/en_us/handlers/destinationteaserhandler.ashx",
	currentcity:0,
	max:69
}*/
amex.initDefileur = function(){
	var d = $c("div","defileur");
	var clickHandle=function(dir){
		$(lList[0]).hide();
		var target_city=(amex.hp_destinations.currentcity+dir);
			target_city=(target_city<0)?amex.hp_destinations.maxcount:target_city;
		$(lList[0]).load(amex.hp_destinations.url+'?currentcity='+target_city,function(){
			$(lList[0]).show('fast');
			amex.initButton2();
			amex.hp_destinations.currentcity=target_city;
		});
	}
	for (var i = 0; i < d.length; i++) {
		var lList = $t("li",d[i]);
		d[i].lList = lList;
		//on init shows li with index 0
		$(lList[0]).show("fast");
		var d1=$dc("div");
		var d2=$dc("div");
		d1.className="arrL";
		d1.onclick=function(){clickHandle(-1);}
		d2.className="arrR";
		d2.onclick=function(){clickHandle(1);}
		d[i].appendChild(d1);
		d[i].appendChild(d2);
		amex.addPng(imgPath+"/common/arr1L.png",d1,"arr1L");
		amex.addPng(imgPath+"/common/arr1R.png",d2,"arr1R");
	}
}


/*	amex.initQuickLinks1()
 * to initialize javascript animated "defileur" item on the homepage
 */
amex.initQuickLinks1 = function(){
	var ql = $i("quickLinks1");
	if(ql){
		amex.addPng(imgPath+"/common/bgQL.png",ql,"bg");
	}
}

/*	amex.initNavLeft1()
 * to initialize left navigation with png as background
 */
amex.initNavLeft1 = function(){
	var o=$i("navLeft1");
	if(o){
		var d2=$dc("div");
		var d3=$dc("div");
		d3.style.position="absolute";d3.style.width="174px";d3.style.top="30px";d3.style.left="11px";d3.className="bg";d3.style.zIndex=0;d3.style.backgroundColor='#FFFFFF';d3.style.opacity='0.7';d3.style.filter='Alpha(Opacity=70)';d3.innerHTML='&#160;';
		var im=$dc("img");
		d2.style.position="absolute";d2.style.width="174px";d2.style.top="100%";d2.style.left="11px";d2.style.zIndex=5;d2.innerHTML='<img src="'+imgPath+'/common/nLbg.png" width="174" height="16" alt="">';
		o.appendChild(d2);
		o.insertBefore(d3,o.firstChild);
		
		var nav=$t1L("li",$t("ul",o)[0]);
		for(var i=0;i<nav.length;i++){
			/*nav L2 highlight*/
			var subSel = $c("li","selected",nav[i])[0];
			if(subSel){
				var d4=$dc("div");
				d4.style.position="absolute";d4.style.top="-1px";d4.style.left="1px";d4.style.zIndex="1";
				d4.innerHTML = '<img src="'+imgPath+'/common/nLsub.png" width="185" height="22" alt=""/>';
				var lvl2=$c("li","selected",subSel)[0];
				if (lvl2) {
					subSel = lvl2;
					d4.style.left="-10px";
				}
				subSel.insertBefore(d4,subSel.firstChild);
			}

			/*nav L1 bg*/
			var d1 = $dc("div");
			d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";d1.style.zIndex="2";
			var img="",h="23";
			
			if(i==0){img="nL1";}
			else if(i==nav.length-1){img="nL3";h="28";}
			else{img="nL2";}
			if(nav[i].className=="selected"){img += "h";h="28";}
			
			d1.innerHTML='<img src="'+imgPath+'/common/'+img+'.png" width="175" height="'+h+'" alt=""/>';
				
			nav[i].insertBefore(d1,nav[i].firstChild);
		}

		d3.style.height=(o.offsetHeight<30?0:(o.offsetHeight-30))+"px";
	}
} 

amex.rescaleContent1bg = function(){
	var cnt = $i("content1");
	if (cnt && cnt.bg) {
		var h = cnt.offsetHeight;
		cnt.bg.style.height = (h - 45) + "px";
		cnt.b.style.top = h+"px";
	}
}

/* amex.initContent1()
 * to initialize "content1" background transparency
 * */
amex.initContent1 = function(){
	var cnt = $i("content1");
	if(cnt){
		var d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		d1.style.position="absolute";d1.style.top="15px";d1.style.left="-164px";d1.style.zIndex=0;d1.innerHTML='<img src="'+imgPath+'/common/cnt1Top.png" width="686" height="30" alt=""/>';
		d2.style.position="absolute";d2.style.top="100%";d2.style.left="10px";d2.style.zIndex=0;d2.innerHTML='<img src="'+imgPath+'/common/cnt1Bot.png" width="511" height="8" alt=""/>';
		d3.className="bg";d3.innerHTML='&#160;';
		cnt.t = d1;
		cnt.b = d2;
		cnt.bg = d3;
		cnt.appendChild(cnt.t);
		cnt.appendChild(cnt.b);
		cnt.appendChild(cnt.bg);
		amex.rescaleContent1bg();
	}
}

/* amex.initCnt1Table()
 * to initialize "content1" tables background transparency and rounded corners
 * */
amex.initCnt1Table = function(){
	var cnt = $i("content1");
	if(cnt){
		var tbl = $c("div","table",cnt);
		for(var i=0;i<tbl.length;i++){
			var d1=$dc("div");
			var d2=$dc("div");
			var d3=$dc("div");
			d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";d1.style.zIndex=0;d1.innerHTML='<img src="'+imgPath+'/common/tableTop.png" width="460" height="7" alt=""/>';
			d2.style.position="absolute";d2.style.top="100%";d2.style.left="0px";d2.style.zIndex=0;d2.innerHTML='<img src="'+imgPath+'/common/tableBot.png" width="460" height="8" alt=""/>';
			d3.className="bg";d3.innerHTML='&#160;';d3.style.height=(tbl[i].offsetHeight<10?0:(tbl[i].offsetHeight-10))+"px";
			tbl[i].appendChild(d1);
			tbl[i].appendChild(d2);
			tbl[i].appendChild(d3);
		}
	}
}


/* amex.checkContentHeight(), amex.initAccordeon
 * to initialize and manage accordion at the right of content
 * */
amex.checkContentHeight=function(){
	var cnt = $i("content1");
	var bg1 = true;
	decay=-43;
	if(!cnt){
		cnt = $i("content3");
		bg1=false;
		decay=-3;
	}
	if (cnt) {
		cnt.style.height="auto";

		if($i("accordeon")){
			var accordeonHeight = $i("accordeon").offsetHeight;
			if(cnt.offsetHeight<=accordeonHeight+decay+10){
				cnt.style.height=accordeonHeight+decay+"px";
			}
		}
		if(bg1)amex.rescaleContent1bg();
		amex.expandCntBg();
	}
}
amex.initAccordeon=function(){
	var ac = $i("accordeon");
	if(ac){
		var d1=$dc("div");
		var d2=$dc("div");
		d1.style.position="absolute";d1.style.top="0px";d1.style.left="0px";d1.style.zIndex=0;d1.innerHTML='<img src="'+imgPath+'/common/accorTop.png" width="200" height="11" alt=""/>';
		d2.style.position="absolute";d2.id="accordeonBottom";d2.style.top=(ac.offsetHeight-26)+"px";d2.style.left="0px";d2.style.zIndex=0;d2.innerHTML='<img src="'+imgPath+'/common/accorBot.png" width="200" height="45" alt=""/>';
		ac.appendChild(d1);
		ac.appendChild(d2);
		
		var items = $t1L("div",ac);
		for(var i=0;i<items.length;i++){
			if(items[i].className.indexOf("item")==-1)continue;
			items[i].lst = items[i];
			items[i].bottomForIE6fix = d2;
			items[i].ttl = $t1L("h2",items[i])[0];
			items[i].cnt = $t1L("div",items[i])[0];
			
			var d3=$dc("div");
			var d4=$dc("div");
			d3.className="top";
			d4.className="bot";
			items[i].cnt.appendChild(d3);
			items[i].cnt.appendChild(d4);
			
			items[i].ttl.onclick=function(){
				var curHeight = this.parentNode.cnt.offsetHeight+24;
				if(this.parentNode.className.indexOf("selected")>-1){
					this.parentNode.parentNode.actuSel=null;
					this.parentNode.className = this.parentNode.className.replace(/ selected/g,"").replace(/selected/g,"");
					amex.displace(this.parentNode,"height",curHeight,-80,24,function(){amex.checkContentHeight();},function(){$i("accordeonBottom").style.top=($i("accordeon").offsetHeight-26)+'px';});
				}else{
					if(this.parentNode.parentNode.actuSel){
						this.parentNode.parentNode.actuSel.onclick();
					}
					this.parentNode.parentNode.actuSel=this;
					this.parentNode.className += " selected";
					amex.displace(this.parentNode,"height",24,30,curHeight,function(){amex.checkContentHeight();},function(){$i("accordeonBottom").style.top=($i("accordeon").offsetHeight-26)+'px';});
				}
				setCookie('AM_accordeon', this.parentNode.id ,365);
			}
			//added by hho - dont animate when showing default open item
			items[i].ttl.show=function(){
				var curHeight = this.parentNode.cnt.offsetHeight+24;
				if(this.parentNode.className.indexOf("selected")>-1){
					this.parentNode.parentNode.actuSel=null;
					this.parentNode.className = this.parentNode.className.replace(/ selected/g,"").replace(/selected/g,"");
					amex.displace(this.parentNode,"height",curHeight,-80,24,function(){amex.checkContentHeight();},function(){$i("accordeonBottom").style.top=($i("accordeon").offsetHeight-26)+'px';});
				}else{
					if(this.parentNode.parentNode.actuSel){
						this.parentNode.parentNode.actuSel.onclick();
					}
					this.parentNode.parentNode.actuSel=this;
					this.parentNode.className += " selected";
					amex.displace(this.parentNode,"height",24,curHeight,curHeight,function(){amex.checkContentHeight();},function(){$i("accordeonBottom").style.top=($i("accordeon").offsetHeight-26)+'px';});
				}
			}
			/*if (items[i].className.indexOf("opened") != -1) {
				var lclTtl = items[i].ttl;
				addOnloadEvent(function(){
					lclTtl.onclick();
				});
			}*/
			//added by hho to open last active acc item by default
			if(getCookie('AM_accordeon') == "")
				setCookie('AM_accordeon', 't_0', 365);
			if(items[i].id == getCookie('AM_accordeon'))
			{
				var lclTtl = items[i].ttl;
				addOnloadEvent(function(){
					lclTtl.show();
				});
			}

		}
	}	
}


/* amex.initContent2()
 * to initialize "content2" background transparency
 * */
amex.initContent2 = function(){
	var cnt = $i("content2");
	if(cnt){
		var d1=$dc("div");
		var d2=$dc("div");
		var d3=$dc("div");
		d1.style.position="absolute";d1.style.top="15px";d1.style.left="-164px";d1.style.zIndex=0;d1.innerHTML='<img src="'+imgPath+'/common/cnt2Top.png" width="894" height="30" alt=""/>';
		d2.style.position="absolute";d2.style.top="100%";d2.style.left="10px";d2.style.zIndex=0;d2.innerHTML='<img src="'+imgPath+'/common/cnt2Bot.png" width="710" height="15" alt=""/>';
		d3.className="bg";d3.innerHTML='&#160;';
		cnt.t = d1;
		cnt.b = d2;
		cnt.bg = d3;
		cnt.appendChild(cnt.t);
		cnt.appendChild(cnt.b);
		cnt.appendChild(cnt.bg);
		amex.rescaleContent2bg();
	}
}

amex.rescaleContent2bg = function(){
	var cnt = $i("content2");
	if(cnt && cnt.bg)cnt.bg.style.height=(cnt.b.offsetTop - 45)+"px";
}

/* amex.initContent2()
 * to initialize "aboutList" (all about your flight page) background transparency 
 * and sub navigation with shadows
 * */
amex.initAboutList = function(){
	var aL = $i("aboutList");
	if(aL){
		var li = $t1L("li",aL);
		
		$t1L("div",li[0])[0].style.left="0px";
		$t1L("div",li[1])[0].style.left="-7px";
		$t1L("div",li[2])[0].style.left="-8px";
		$t1L("div",li[3])[0].style.right="14px";
		$t1L("div",li[4])[0].style.right="14px";
		
		for(var i=0;i<li.length;i++){
			li[i].lbl = $t1L("span",li[i])[0];
			li[i].sub = $t1L("div",li[i])[0];
			li[i].onmouseover=function(i){
				aL.className="about_"+this.id;
				this.sub.style.display="block";
				this.lbl.className+=" selected";
				this.d1.style.height=(this.sub.offsetHeight<1?0:(this.sub.offsetHeight-1))+"px";
				this.d3.style.width=(this.sub.offsetWidth<22?0:(this.sub.offsetWidth-22))+"px";
			}
			li[i].onmouseout=function(){
				aL.className="";
				this.sub.style.display="none";
				this.lbl.className=this.lbl.className.replace(/ selected/g,"");
			}
			var d1=$dc("div");
			var d2=$dc("div");
			var d3=$dc("div");
			var d4=$dc("div");
			d1.className="shad1";d1.innerHTML='<img src="'+imgPath+'/common/shadV.png" style="width:7px;height:530px" alt=""/>';
			d2.className="shad2";d2.innerHTML='<img src="'+imgPath+'/common/rCblueL.png" style="width:11px;height:19px" alt=""/>';
			d3.className="shad3";d3.innerHTML='<img src="'+imgPath+'/common/shadH.png" style="width:1024px;height:19px" alt=""/>';
			d4.className="shad4";d4.innerHTML='<img src="'+imgPath+'/common/rCblueR.png" style="width:18px;height:19px" alt=""/>';
			li[i].d1 = d1;li[i].d3 = d3;
			li[i].sub.appendChild(d1);
			li[i].sub.appendChild(d2);
			li[i].sub.appendChild(d3);
			li[i].sub.appendChild(d4);
		}
	}
}
/* amex.initExperience()
 * to initialize "experience" animated section
 * */
amex.initExperience = function(){
	var exp=$i("experience");
	if(exp){
		// experience background
		amex.addPng(imgPath+"/common/expBg.png",exp,"expBg");

		// experience navigation background
		amex.addPng(imgPath+"/common/expNavBg.png",exp,"navBg");
		
		var cnt = $c1L("div","cnt",$c1L("div","contents",exp)[0]);
		exp.cnt = cnt;

		for(var i=0;i<cnt.length;i++){
			cnt[i].bg = $c1L("div","bg",cnt[i])[0];
			
			//fix for all version of IE as IE does not display png transparency correctly with filter Alpha
			amex.IE6fix(cnt[i].bg,true);
			
			cnt[i].bg.style.display="none";
			cnt[i].exp = exp;
			cnt[i].cnt = cnt;
			
			/*to initialize text block when it exists*/
			var t=$c1L("div","text",cnt[i])[0];
			if(t){
				cnt[i].txt = t;
				t.style.left="720px";
				amex.addPng(imgPath+"/common/expCntBot.png",t,"bgBot");
				amex.addPng(imgPath+"/common/expCntTop.png",t,"bgTop");
				var d1=$dc("div");
				d1.className="bgMid";d1.style.height=(t.offsetHeight<43?0:(t.offsetHeight-43))+"px";
				t.appendChild(d1);
			}

			cnt[i].show=function(){
				this.style.display="block";
				this.exp.actuSel = this;
				if(this.txt)amex.displace(this.txt,"left",this.txt.offsetLeft,-50,400);
				this.exp.locked = true;
				var lclExp = this.exp;
				
				var lTs = this;
				/*when appear is over, sets all hidden cnt to display=none to allow links and text accessibility*/
				amex.appear(this.bg,15,function(){lclExp.locked=false;for(var j=0;j<lTs.cnt.length;j++)lTs.cnt[j].style.display=(lTs.cnt[j]==lTs?"block":"none");});
			}
			cnt[i].hide=function(nxt){
				if(this.txt)amex.displace(this.txt,"left",this.txt.offsetLeft,50,800);
				var lclNxt = nxt;
				var lclThis = this;
				amex.appear(this.bg,-15,function(){lclNxt.show();});
			}
		}
		
		/*to initialize experience navigation*/
		var aL = $t("a",$c1L("div","nav",exp)[0]);
		for(var i=0;i<aL.length;i++){
			aL[i].exp = exp;
			aL[i].cnt = cnt[i];
			aL[i].onclick=function(){
				if(!this.exp.locked){
					if(this.exp.actuNav)this.exp.actuNav.className="";
					this.exp.actuNav = this.parentNode;
					this.parentNode.className="selected";
					this.blur();
					if(this.exp.actuSel)this.exp.actuSel.hide(this.cnt);
					else this.cnt.show();
				}
			}
		}
		amex.initNavStyle(aL);
		var lclaL0 = aL[0]; 
		addOnloadEvent(function(){
			lclaL0.onclick();
		});
	}
}

/* amex.initSplitbox()
 * to initialize "splitbox" items (future flights)
 * */
amex.initSplitbox=function(){
	var sb=$c("div","splitBox");
	for(var i=0;i<sb.length;i++){
		amex.addPng(imgPath+"/common/bsT.png",sb[i],"top");
		amex.addPng(imgPath+"/common/bsB.png",sb[i],"bot");
	}
}

/* amex.initBoxBlue()
 * to initialize "boxBlue" items
 * */
amex.initBoxBlue=function(){
	var sb=$c("div","boxBlue");
	for(var i=0;i<sb.length;i++){
		amex.addPng(imgPath+"/common/bBlueT.png",sb[i],"top");
		amex.addPng(imgPath+"/common/bBlueB.png",sb[i],"bot");
	}
}

/* amex.initBoxLBlue()
 * to initialize "boxLBlue" items
 * */
amex.initBoxLBlue=function(){
	var sb=$c("div","boxLBlue");
	for(var i=0;i<sb.length;i++){
		amex.addPng(imgPath+"/common/bLBlueT.png",sb[i],"top");
		amex.addPng(imgPath+"/common/bLBlueB.png",sb[i],"bot");
	}
}

amex.popup = new Object();
amex.popup.visible = false;
amex.popup.delayresize = function(){
	if(amex.IE6)setTimeout(amex.popup.resize,50);
	else amex.popup.resize();
}
amex.popup.resize = function(){
	if (amex.popup.visible) {
		amex.popup.bg.style.width = amex.body.clientWidth + "px";
		amex.popup.bg.style.height = amex.body.clientHeight + "px";
		amex.popup.win.style.left = (amex.body.clientWidth/2)-(amex.popup.win.offsetWidth/2) + "px";
		var top = (document.documentElement.clientHeight/2)+document.documentElement.scrollTop-(amex.popup.win.offsetHeight/2);
		top=top<0?0:top;
		amex.popup.win.style.top = top + "px";
	}
}
amex.popup.show = function(uri, cfg){
	//cfg
	//amex.popup.show("uri",{type:"iframe",height:650}); 
	//amex.popup.show("uri") <- ajax request automatic height
	cfg=cfg||{type:"ajax"}
	if(!amex.popup.bg){
		amex.popup.bg = $dc("div");
		amex.popup.win = $dc("div");
		amex.popup.cnt = $dc("div");
		var s = amex.popup.bg.style; 
		s.position="absolute";
		s.background="#303129";
		s.zIndex="500";
		s.top="0px";
		s.left="0px";
		amex.popup.bg.innerHTML="&#160;";
		if (amex.IE) {s.filter = "Alpha(Opacity:70);";
		}else{s.opacity=0.7;}
		if(cfg.type==="iframe") 
  		    amex.popup.win.className="popupWin520";
		else
		    amex.popup.win.className="popupWin";
		s = amex.popup.win.style;
		s.position="absolute";
		s.zIndex="501";
		s.top="0px";
		s.left="0px";
		
		var topWin = $dc("div"),botWin = $dc("div");
		var tL = $dc("div"), tR = $dc("div"), bL = $dc("div"), bR = $dc("div");
		topWin.className="topWin";
		topWin.innerHTML="&#160;";
		botWin.className="botWin";
		botWin.innerHTML="&#160;";
		tL.className="tL";
		tR.className="tR";
		bL.className="bL";
		bR.className="bR";
		
		tR.onclick=amex.popup.hide;
		
		amex.addPng(imgPath+"/common/popup.png",tL,"corner");
		amex.addPng(imgPath+"/common/popup.png",tR,"corner");
		amex.addPng(imgPath+"/common/popup.png",bL,"corner");
		amex.addPng(imgPath+"/common/popup.png",bR,"corner");

		topWin.appendChild(tL);
		topWin.appendChild(tR);
		botWin.appendChild(bL);
		botWin.appendChild(bR);

		amex.popup.win.appendChild(topWin);
		amex.popup.win.appendChild(botWin);
		amex.popup.win.appendChild(amex.popup.cnt);
		
		amex.body.appendChild(amex.popup.bg);
		amex.body.appendChild(amex.popup.win);
		
		amex.popup.bg.onclick=amex.popup.hide;
		
		addOnresizeEvent(amex.popup.resize);
	}
	
	amex.popup.cnt.innerHTML = "";
	
	//AEMXDEV-2 MGA 20091015
	if (cfg.type==="ajax"){
		amex.HTMLrequest(function(val){amex.popup.cnt.innerHTML=val;amex.popup.delayresize();},uri);
	} else if (cfg.type==="iframe") {
		amex.popup.cnt.innerHTML='<iframe width="100%" height="'+cfg.height+'" src="'+uri+'" frameborder="0"></iframe>'
		amex.popup.delayresize();
	} else {
		
	}
	
	//hides select in IE6
	if(amex.IE6){var sel=$t("select");for(var i=0;i<sel.length;i++)sel[i].style.visibility="hidden";}
	
	amex.popup.bg.style.display="block";
	amex.popup.win.style.display="block";
	amex.popup.visible = true;
	amex.popup.resize();
}

amex.popup.showdiv = function(divID){
	if(!amex.popup.bg){
		amex.popup.bg = $dc("div");
		amex.popup.win = $dc("div");
		amex.popup.cnt = $dc("div");
		var s = amex.popup.bg.style; 
		s.position="absolute";
		s.background="#303129";
		s.zIndex="500";
		s.top="0px";
		s.left="0px";
		amex.popup.bg.innerHTML="&#160;";
		if (amex.IE) {s.filter = "Alpha(Opacity:70);";
		}else{s.opacity=0.7;}

		amex.popup.win.className="popupWin";
		s = amex.popup.win.style;
		s.position="absolute";
		s.zIndex="501";
		s.top="0px";
		s.left="0px";
		
		var topWin = $dc("div"),botWin = $dc("div");
		var tL = $dc("div"), tR = $dc("div"), bL = $dc("div"), bR = $dc("div");
		topWin.className="topWin";
		topWin.innerHTML="&#160;";
		botWin.className="botWin";
		botWin.innerHTML="&#160;";
		tL.className="tL";
		tR.className="tR";
		bL.className="bL";
		bR.className="bR";
		
		tR.onclick=amex.popup.hide;
		
		amex.addPng(imgPath+"/common/popup.png",tL,"corner");
		amex.addPng(imgPath+"/common/popup.png",tR,"corner");
		amex.addPng(imgPath+"/common/popup.png",bL,"corner");
		amex.addPng(imgPath+"/common/popup.png",bR,"corner");

		topWin.appendChild(tL);
		topWin.appendChild(tR);
		botWin.appendChild(bL);
		botWin.appendChild(bR);

		amex.popup.win.appendChild(topWin);
		amex.popup.win.appendChild(botWin);
		amex.popup.win.appendChild(amex.popup.cnt);
		
		amex.body.appendChild(amex.popup.bg);
		amex.body.appendChild(amex.popup.win);
		
		amex.popup.bg.onclick=amex.popup.hide;
		
		addOnresizeEvent(amex.popup.resize);
	}
	
	amex.popup.cnt.innerHTML = "";
	amex.popup.cnt.innerHTML = document.getElementById(divID).innerHTML;
	amex.popup.delayresize();
	//amex.HTMLrequest(function(val){amex.popup.cnt.innerHTML=val;amex.popup.delayresize();},uri);
	
	//hides select in IE6
	if(amex.IE6){var sel=$t("select");for(var i=0;i<sel.length;i++)sel[i].style.visibility="hidden";}
	
	amex.popup.bg.style.display="block";
	amex.popup.win.style.display="block";
	amex.popup.visible = true;
	amex.popup.resize();
}

amex.popup.hide = function(){
	amex.popup.bg.style.display="none";
	amex.popup.win.style.display="none";
	amex.popup.visible = false;
	//shows select in IE6
	if(amex.IE6){var sel=$t("select");for(var i=0;i<sel.length;i++)sel[i].style.visibility="visible";}
}

amex.HTMLrequest = function(fct,URI){
		var lclFct = fct;
		var lclURI = URI;
		
		var xmlhttp = null;
		if(window.XMLHttpRequest){xmlhttp = new XMLHttpRequest();}else if(window.ActiveXObject) {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
		xmlhttp.open("GET",lclURI,true);
		xmlhttp.setRequestHeader('content-type', 'text/xml');
		xmlhttp.send(lclURI);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if(xmlhttp.status == 200 || xmlhttp.status == 0){
					lclFct(xmlhttp.responseText);
				}
			}
		}	

}

amex.initMundo = function(){
	var mR = $c("div","mundoRegister");
	for(var i=0;i<mR.length;i++){
		amex.addPng(imgPath+"/common/mundoBoxT.png",mR[i],"top");
		amex.addPng(imgPath+"/common/mundoBoxB.png",mR[i],"bot");
	}
}

amex.initOffices = function(){
	var mR = $c("div","officesbox2");
	for(var i=0;i<mR.length;i++){
		amex.addPng(imgPath+"/common/mundoBoxT.png",mR[i],"top");
		amex.addPng(imgPath+"/common/mundoBoxB.png",mR[i],"bot");
	}
}


/* amex.initVideoTabs()
 * to initialize "videoTabs" items (page discoverExperience)
 * */
amex.initVideoTabs = function(){
	var vT = $c("div","videoTabs");
	for(var i=0;i<vT.length;i++){
		amex.addPng(imgPath+"/common/discovBtop.png",vT[i],"top");
		amex.addPng(imgPath+"/common/discovBbot.png",vT[i],"bot");
		
		var tbList = $t1L("ul",vT[i])[0];
		var thumb = $t1L("li",tbList);
		vT[i].tb = thumb;
		
		if(thumb.length>3){ /*arrows definition if more than 3 items*/
			vT[i].active=true;
			vT[i].goTo = function(val){
				this.active = false;
				var lclThis=this;
				var fctAct = function(){lclThis.active=true;};
				for(var k=0;k<this.tb.length;k++){
					var moveToX = this.tb[k].offsetLeft-(42*val);
					amex.displace(this.tb[k],"left",this.tb[k].offsetLeft,-10*val,moveToX,((k==this.tb.length-1)?fctAct:null),null);
				}

				var n = this.next;
				if(this.tb[this.tb.length-1].offsetLeft-(42*val)<124){
					n.style.opacity=0.3;
					n.style.cursor="default";
					n.style.filter="Alpha(Opacity=30)";
					n.active = false;
				}else if(!n.active){
					n.style.opacity=1;
					n.style.cursor="pointer";
					n.style.filter="Alpha(Opacity=100)";
					n.active = true;
				}

				var p = this.prev;
				if(this.tb[0].offsetLeft-(42*val)>=0){
					p.style.opacity=0.3;
					p.style.cursor="default";
					p.style.filter="Alpha(Opacity=30)";
					p.active = false;
				}else if(!p.active){
					p.style.opacity = 1;
					p.style.cursor = "pointer";
					p.style.filter = "Alpha(Opacity=100)";
					p.active = true;
				}
			}
			
			tbList.style.width="124px";
			tbList.style.marginLeft="27px";
			var d1=$dc("div");
			var d2=$dc("div");
			d1.className="prevButton";
			d2.className="nextButton";
			d1.onclick=function(){if(this.active && this.parentNode.active)this.parentNode.goTo(-3);}
			d2.onclick=function(){if(this.active && this.parentNode.active)this.parentNode.goTo(3);}
			vT[i].appendChild(d1);
			vT[i].appendChild(d2);
			vT[i].prev = d1;
			vT[i].next = d2;
			amex.addPng(imgPath+"/common/btArrPrev.png",d1,"");
			amex.addPng(imgPath+"/common/btArrNext.png",d2,"");
			amex.IE6fix(vT[i],true);
		}
		
		for(var j=0;j<thumb.length;j++){
			thumb[j].L=j*42;
			thumb[j].style.left=thumb[j].L+"px";
		}

		if(thumb.length>3)vT[i].goTo(0);
	}
}

/* amex.initVideoTab2()
 * to initialize "videoTabs2" items (page travelers)
 * */
amex.initVideoTab2 = function(){
	var vT = $c("div","videoTab2");
	for(var i=0;i<vT.length;i++){
		if(vT[i].className.indexOf("noBG")==-1){
			amex.addPng(imgPath+"/common/bBlue455T.png",vT[i],"top");
			amex.addPng(imgPath+"/common/bBlue455B.png",vT[i],"bot");
		}
		
		var tbList = $t1L("ul",vT[i])[0];
		var thumb = $t1L("li",tbList);
		vT[i].tb = thumb;
		
		if(thumb.length>3){ /*arrows definition if more than 3 items*/
			vT[i].active=true;
			vT[i].goTo = function(val){
				this.active = false;
				var lclThis=this;
				var fctAct = function(){lclThis.active=true;};
				for(var k=0;k<this.tb.length;k++){
					var moveToX = this.tb[k].offsetTop-(53*val);
					amex.displace(this.tb[k],"top",this.tb[k].offsetTop,-10*val,moveToX,((k==this.tb.length-1)?fctAct:null),null);
				}

				var n = this.next;
				if(this.tb[this.tb.length-1].offsetTop-(53*val)<124){
					n.style.opacity=0.3;
					n.style.cursor="default";
					n.style.filter="Alpha(Opacity=30)";
					n.active = false;
				}else if(!n.active){
					n.style.opacity=1;
					n.style.cursor="pointer";
					n.style.filter="Alpha(Opacity=100)";
					n.active = true;
				}

				var p = this.prev;
				if(this.tb[0].offsetTop-(53*val)>=0){
					p.style.opacity=0.3;
					p.style.cursor="default";
					p.style.filter="Alpha(Opacity=30)";
					p.active = false;
				}else if(!p.active){
					p.style.opacity = 1;
					p.style.cursor = "pointer";
					p.style.filter = "Alpha(Opacity=100)";
					p.active = true;
				}
			}
			
			tbList.style.height="156px";
			tbList.style.marginTop="27px";
			var d1=$dc("div");
			var d2=$dc("div");
			d1.className="prevButton";
			d2.className="nextButton";
			d1.onclick=function(){if(this.active && this.parentNode.active)this.parentNode.goTo(-3);}
			d2.onclick=function(){if(this.active && this.parentNode.active)this.parentNode.goTo(3);}
			
			
			
			vT[i].appendChild(d1);
			vT[i].appendChild(d2);
			vT[i].prev = d1;
			vT[i].next = d2;
			amex.addPng(imgPath+"/common/btArrUp.png",d1,"");
			amex.addPng(imgPath+"/common/btArrDown.png",d2,"");
			amex.IE6fix(vT[i],true);
		}
		
		for(var j=0;j<thumb.length;j++){
			thumb[j].T=j*53;
			thumb[j].style.top=thumb[j].T+"px";
		}

		if(thumb.length>3)vT[i].goTo(0);
	}
}

/* amex.runWorldClock() amex.initWorldClock()
 * to initialize "worldClock" items (page practicalInfo)
 * to preinstanciate the clock the following div must be present and first div inside "worldClock" div  
 * <div>hh:mm:ss</div>
 * */
amex.runWorldClock = function(o,time){
	o.s.style.top = (0-85*time[2])+"px";
	o.m.style.top = (0-85*time[1])+"px";
	o.h.style.top = (0-85*(time[0]%12))+"px";
	var s = (new Date()).getSeconds();
	if (time[2]>s){time[1]++;time[2]=time[2]%60;}
	if (time[1]>=60){time[0]++;time[1]=time[1]%60;}
	if (time[0]>=12){time[0]=time[0]%12;}
	time[2] = s;
	var o1=o,time1=time;
	setTimeout(function(){amex.runWorldClock(o1,time1);},1000);
}
amex.initWorldClock = function(){
	var wC = $c("div","worldClock");
	for (var i = 0; i < wC.length; i++) {
		var d1 = $dc("div");
		d1.className="clock";
		var time;

		var hDiv = $t1L("div", wC[i])[0];
		if(hDiv.innerHTML.indexOf(":")>-1){
			time = hDiv.innerHTML.split(":");
			time[0] = parseInt(time[0]);
			time[1] = parseInt(time[1]);
			time[2] = parseInt(time[2]);
			wC[i].removeChild(hDiv)
		}else{
			var now=new Date();
			time=[now.getHours(),now.getMinutes(),now.getSeconds()];
		}

		wC[i].appendChild(d1);
		amex.addPng(imgPath+"/common/clockDeco.png",d1,"clockDeco");
		wC[i].s = amex.addPng(imgPath+"/common/clockS.png",d1,"clockS");
		wC[i].m = amex.addPng(imgPath+"/common/clockM.png",d1,"clockM");
		wC[i].h = amex.addPng(imgPath+"/common/clockH.png",d1,"clockH");
		amex.addPng(imgPath+"/common/clockBg.png",d1,"clockBg");
		
		amex.runWorldClock(wC[i],time);
	}
}

amex.initCurrencyConverter = function(){
	var cc=$i("currencyConverter");
	if(cc){
		$t1L("select",cc)[0].onchange=function(){
			if(this[this.selectedIndex].value!=0){
				$i("ccEur1").innerHTML = this[this.selectedIndex].value +""+ this[this.selectedIndex].text;
				$i("ccEur100").innerHTML = (this[this.selectedIndex].value*100) +""+ this[this.selectedIndex].text;
			}else{
				$i("ccEur1").innerHTML = "";
				$i("ccEur100").innerHTML = "";
			}
		}
	}
}

/*amex.fixSelectIE6 
 * to hide select in IE6 that are under o (positionned in absolute) to avoid select to go through o
 */
amex.fixSelectIE6 = function(o){
	if(amex.IE6){
		var sLst = $t("select");
		if(o){
			var cZone = CEDjs.getPos(o);
			cZone.x2 = cZone.x+o.offsetWidth;
			cZone.y2 = cZone.y+o.offsetHeight;
			for(var k=0;k<sLst.length;k++){
				if (!sLst[k].zone) {
					sLst[k].zone = CEDjs.getPos(sLst[k]);
					sLst[k].zone.x2 = sLst[k].zone.x+sLst[k].offsetWidth; 
					sLst[k].zone.y2 = sLst[k].zone.y+sLst[k].offsetHeight; 
				}
				var x1=cZone.x,x2=cZone.x2,xa=sLst[k].zone.x,xb=sLst[k].zone.x2;
				var y1=cZone.y,y2=cZone.y2,ya=sLst[k].zone.y,yb=sLst[k].zone.y2;
				if(x1<xb&&xb-x1<x2-x1+xb-xa && y1<yb&&yb-y1<y2-y1+yb-ya){
					sLst[k].style.visibility="hidden";
				}else{
					sLst[k].style.visibility="visible";
				}
			}
		}else{
			for (var k = 0; k < sLst.length; k++) {
				sLst[k].style.visibility="visible";
			}
		}
	}
}

/*the calendar... too hard to comment... :-\ */
var CEDjs = new Object();
CEDjs.Calendar = new Object();
CEDjs.Calendar.DbyM = [31,28,31,30,31,30,31,31,30,31,30,31];
CEDjs.Calendar.display = function(o){var o = o.parentNode;if(!o.cal){o.cal=new Date();o.input = $t1L("input",o);o.getDate = CEDjs.Calendar.getDate;	o.target = $t1L("span",o)[$t1L("span",o).length-1];	o.redraw = this.redraw;	o.defDays = this.defDays;o.defMonth = this.defMonth;o.DbyM = this.DbyM;};var ipt = o.input[0].value.split("/");var Y = (ipt[2] && ipt[2]!="")?parseInt(ipt[2]):o.cal.getFullYear();var M = (ipt[1] && ipt[1]!="")?(parseInt(ipt[1].charAt(0)=="0"?ipt[1].charAt(1):ipt[1])-1):o.cal.getMonth();var D = (ipt[0] && ipt[0]!="")?parseInt(ipt[0].charAt(0)=="0"?ipt[0].charAt(1):ipt[0]):o.cal.getDate();o.cal.setFullYear(Y,M,D);o.current=new Date(Y,M,D);o.redraw(o.current);}
CEDjs.Calendar.redraw = function(d){var WR ='';var y = d.getFullYear();var m = d.getMonth();var cP= 'style="cursor:pointer;"';WR+='<span class="nav">';WR+='<span class="year"><span onclick="CEDjs.Calendar.nextMonth(this,-12);" class="prv" '+cP+'>&#171;</span>'+y+'<span onclick="CEDjs.Calendar.nextMonth(this,12);" class="nxt" '+cP+'>&#187;</span></span>';WR+='<span class="month"><span onclick="CEDjs.Calendar.nextMonth(this,-1);" class="prv" '+cP+'>&#171;</span>'+this.defMonth[m]+'<span onclick="CEDjs.Calendar.nextMonth(this,1);" class="nxt" '+cP+'>&#187;</span></span>';WR+='</span>';WR+='<table border="0" cellpadding="0" cellspacing="0">';WR+='<thead><tr>';for(var i=0;i<7;i++){WR+='<th class="day'+i+'">'+this.defDays[i].charAt(0)+'</th>';};WR+='</tr></thead>';WR+='<tbody><tr>';var sD=new Date(y,m,1).getDay();var dL;if(m==1 && y%4==0){dL=29+sD;}else{dL=this.DbyM[m]+sD;}var lines = Math.ceil(dL/7)*7;var YnMmatch = y==this.cal.getFullYear() && m==this.cal.getMonth();for(var i=0;i<lines;i++){var cls = "day"+i%7;if(YnMmatch && i-sD==this.cal.getDate()-1)cls="selected";if(i-sD>=0 && i<dL){WR+="<td onmouseover='this.className=\"over\";' onmouseout='this.className=\""+cls+"\";' onclick='CEDjs.Calendar.selDate(this,"+y+","+m+","+(i-sD+1)+");' class='"+cls+"' "+cP+">"+(i-sD+1)+"</td>";}else{WR+="<td class='empty'></td>";};if(i%7==6 && i-sD<dL-1)WR+="</tr><tr>";};WR+='</tr></tbody>';WR+='</table>';this.target.innerHTML = WR;this.target.style.display="block";}
CEDjs.Calendar.selDate = function(o,Y,M,D){while(o && !o.cal)o=o.parentNode;if (o) {o.input[0].value = (D<10?"0":"")+D + "/" + (M<9?"0":"")+(M + 1) + "/" + Y;o.cal.setFullYear(Y, M, D);o.current.setFullYear(Y, M, D);o.target.style.display = "none";o.style.zIndex = "5";amex.fixSelectIE6(o.target);};}
CEDjs.Calendar.nextMonth = function(o,m){while(o && !o.cal)o=o.parentNode;if(o){o.current.setFullYear(o.current.getFullYear(),o.current.getMonth()+m,1);o.redraw(o.current);}}
CEDjs.Calendar.defDays = ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'];
CEDjs.Calendar.defMonth = ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
CEDjs.getPos = function(o){var P={x:0,y:0};while(o){P.x+=o.offsetLeft;P.y+=o.offsetTop;o=o.offsetParent;};return P;};

amex.initCalendar = function(){
	var cal=$c("a","calendar");
	for(var i=0;i<cal.length;i++){
		var sp=cal[i].parentNode;
		sp.style.position="relative";
		var spCal = $dc("span");spCal.className="cedcalendar";sp.appendChild(spCal);
		var ipt = $t1L("input",sp)[0];
		cal[i].ipt = ipt;
		cal[i].href="javascript:void(0);";
		cal[i].onclick=function(){
			if(this.parentNode.target && this.parentNode.target.style.display=="block"){
				this.parentNode.target.style.display="none";
				this.parentNode.style.zIndex = 5;
			}else{
				CEDjs.Calendar.display(this);
				this.parentNode.style.zIndex = 5000;
			}
			amex.fixSelectIE6(this.parentNode.target);
			
		}
		ipt.cal=cal[i]
		ipt.style.cursor = "default";
		ipt.onfocus = function(){
			this.cal.focus();
			this.cal.onclick();
		}
		ipt.onmousedown = ipt.onkeyup = function(){
			this.value="";
			this.blur();
		}
		
		sp.onmouseover = function(){
			this.off=false;
			if(this.TO)clearTimeout(this.TO);
		}
		sp.onmouseout = function(){
			var lclThis=this;
			this.off=true;
			this.TO = setTimeout(function(){
				if(lclThis.off && lclThis.target){
					lclThis.target.style.display="none";
					lclThis.style.zIndex = 5;
					amex.fixSelectIE6(lclThis.target);
				}
			},300);
		}
	}
}

CEDjs.Xmlhttp = new Object();
CEDjs.Xmlhttp.get = function(url,fct,isXML){
	var xmlhttp = null;try{xmlhttp = new XMLHttpRequest();}catch(ex){try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){return false;}}
	try{
		xmlhttp.open("GET",url,true);
		var lclFct = fct,lclisXML = isXML;
		xmlhttp.onreadystatechange=function(){if (xmlhttp.readyState==4){if(xmlhttp.status == 200 || xmlhttp.status == 0){if(lclisXML){lclFct(xmlhttp.responseXML);}else{lclFct(xmlhttp.responseText);};};};};
		xmlhttp.send(url);
	}catch(ex){alert(ex);}
}




//MGA 20090625 AEMXCOORD-105
amex.escapeString=function(str){
	var i=0,t=[];
	while (i<str.length){
		t.push(amex.escapeChars(str.substring(i,i+1)));
		i++;
	}
	return t.join("");
}

amex.escapeChars=function(t){
	if (t.charCodeAt(0)<224){return t}
	t=t.toLowerCase();
	/*
	224 à 225 á 226 â 227 ã 228 ä 229 å 230 æ 231 ç 232 è 233 é 234 ê 235 ë 236 ì 237 í 238 î 239 ï 240 ð 241 ñ 242 ò 243 ó 244 ô 245 õ 246 ö 247 ÷ 248 ø 249 ù 250 ú 251 û 252 ü 253 ý 
	*/
	var n=t.charCodeAt(0);
	if (n>=224 && n<231){return "a"}
	if (n===231){return "c"}
	if (n>=232 && n<235){return "e"}
	if (n>=236 && n<239){return "i"}
	if (n===241){return "n"}
	if (n>=242 && n<246){return "o"}
	if (n>=249 && n<252){return "u"}
	if (n===253){return "y"}
	return t;
}
//end of AEMXCOORD-105





/*airport management*/
amex.airport = new Object();
amex.airport.isLoading = false;
amex.airport.target;
amex.airport.drawList=function(o){
	//MGA 20090625 AEMXCOOR-107 removes the currently displayed overlays 
	try{
		if(o.id.indexOf("_txtFrom")>-1){amex.overlays[1].style.display="none";}
		if(o.id.indexOf("_txtTo")>-1){amex.overlays[0].style.display="none";}
	} catch (e) {}
	//end of AEMXCOOR-107
	o.expand.innerHTML = "";
	var ul = $dc("ul");
	var lst;
	//var flag=0;

	if (o.trg.listRestrict && o.trg.listRestrict.list && o.trg.listRestrict.instance != o) {
		lst = new Object();
		var Rlst = o.trg.listRestrict.list;
		for(var i=0;i<Rlst.length;i++){
			lst[Rlst[i]]=amex.airport.list[Rlst[i]];
		} 
	}else {
		lst = amex.airport.list;
	}
	var str = o.value;
	o.sel=-1;
	var counter=0;

	for(var i in lst){
		//MGA 20090625 AEMXCOOR-105
		if(!lst[i] || !lst[i].t){continue;}
		lst[i].escaped=amex.escapeString(lst[i].t);
		if ( ( lst[i].t.toLowerCase().indexOf(str.toLowerCase())==-1 && lst[i].escaped.toLowerCase().indexOf(str.toLowerCase())==-1) && lst[i].c.toLowerCase().indexOf(str.toLowerCase())==-1){
			continue;
		}
		// end of AEMXCOOR-105
		var li = $dc("li");
		li.innerHTML = lst[i].t+" ("+lst[i].c+")";
		li.code = lst[i].c;
		li.ref = lst[i];
		li.input = o;
		li.count = counter;
		li.onmouseover=function(){
			if(this.input.sel>-1)this.input.list.childNodes[this.input.sel].style.backgroundColor="";
			this.input.sel=this.count;
			this.input.list.childNodes[this.input.sel].style.backgroundColor="#FFF";
		}
		li.onmouseout=function(){
			this.input.list.childNodes[this.input.sel].style.backgroundColor="";
			this.input.sel=-1;
		}
		li.onclick=function(){
			this.input.code = this.code;
			this.input.value = this.innerHTML;
			this.input.expand.style.display="none";
			this.input.blur();
			if(!this.input.trg.listRestrict || this.input.trg.listRestrict.instance==this.input){
				if(this.input.trg.listRestrict && this.input.trg.listRestrict.toReset){
					this.input.trg.listRestrict.toReset[0].value="";
					this.input.trg.listRestrict.toReset[1].value="";
				}
				if(!this.ref.r)this.ref.r = this.ref.xml.getAttribute("r").split(",");
				this.input.trg.listRestrict={instance:this.input,list:this.ref.r};
			}else{
				this.input.trg.listRestrict.toReset = [this.input,$t1L("input",this.input.parentNode)[1]];
			}
			$t1L("input",this.input.parentNode)[1].value=this.code;
		}
		ul.appendChild(li);
		counter++;
	}
	o.list = o.expand.appendChild(ul);
	amex.fixSelectIE6(o.expand);
};
amex.airport.initInput = function(o,trg){
zindex = zindex +1
	o.loading.style.display = "none";
	o.input.style.display = "inline";
	o.input.trg = trg;
		o.input.onfocus=function(){
		this.value="";
		this.parentNode.style.zIndex=zindex;
		this.expand.style.display="block";
		amex.airport.drawList(this);
		flag=1;
	}
	o.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.onclick=function(){
		if(flag==1){}else{
			$c("span","airportFrom")[0].getElementsByTagName("span")[0].style.display="none";
			$c("span","airportTo")[0].getElementsByTagName("span")[0].style.display="none";
			this.parentNode.style.zIndex=2;
		}
	}

	o.input.onblur = function(){
		flag=0;
		//this.expand.style.display="none";
		this.parentNode.style.zIndex=2;
		if(this.sel>-1){
			this.list.childNodes[this.sel].onclick();
		}else if(this.sel==-1 && this.list.childNodes.length==1){
			this.list.childNodes[0].onclick();
		}else{
			this.trg.listRestrict = null;
			this.value="";
			$t1L("input",this.parentNode)[1].value="";
		}
		amex.fixSelectIE6();
	}
	o.input.onkeyup=function(e){
		if(!e)e=event;
		if(e.keyCode==40 || e.keyCode==38 || e.keyCode == 13) {
			return false;
		}else{
			this.expand.style.display = "block";
			amex.airport.drawList(this);
		}
	}
	o.input.onkeydown=function(e){
		if(!e)e=event;
		if(e.keyCode==40){this.goTo(1);}
		else if(e.keyCode==38){this.goTo(-1);}
		else if (e.keyCode == 13) {
			this.list.childNodes[this.sel].onclick();
			return false;
		}
	};
	o.input.goTo = function(val){
		var li = this.list.childNodes;
		if(this.sel>=0)li[this.sel].style.backgroundColor="";
		this.sel+=val;
		if(this.sel<0)this.sel=0;
		if(this.sel>=li.length)this.sel=li.length-1;
		if (this.sel > -1) {
			li[this.sel].style.backgroundColor = "#FFF";
			this.expand.scrollTop = li[this.sel].offsetTop;
		}
	}
}

amex.airport.init=function(ap){
	if (!amex.airport.list) {
		amex.airport.list=new Object();
		var tmpLcl = $t1L("a", $t1L("airports", ap)[0]);
		for(var i=0;i<tmpLcl.length;i++){
			var code = tmpLcl[i].getAttribute("c");
			amex.airport.list[code]={c:code,t:(amex.IE?tmpLcl[i].text:tmpLcl[i].textContent),xml:tmpLcl[i]};
		}
	}
	var trg=amex.airport.target;
	for(var i=0;i<trg.length;i++){
		if(trg[i].F){amex.airport.initInput(trg[i].F,trg[i]);}
		if(trg[i].T){amex.airport.initInput(trg[i].T,trg[i]);}
	}
}
amex.airport.getXML=function(){
	CEDjs.Xmlhttp.get(airportXML,amex.airport.init,true);
};
amex.initFirstInput=function(o){
	o.loading = amex.addPng(imgPath + "/common/loadingMini.gif", o, "pT pL");
	o.input = $t1L("input",o)[0];
	o.input.style.display="none";
	o.input.expand = $dc("span");
	o.appendChild(o.input.expand); 
}
amex.initAirportList = function(){
	var aL = amex.airport.target = $c("div","airportList");
	for(var i=0;i<aL.length;i++){
		aL[i].F = $c("span","airportFrom",aL[i])[0];
		aL[i].T = $c("span","airportTo",aL[i])[0];
		if (aL[i].F)amex.initFirstInput(aL[i].F);
		if (aL[i].T)amex.initFirstInput(aL[i].T);
	}
	if(aL.length>0)addOnloadEvent(function(){setTimeout(amex.airport.getXML,1000);});
}

amex.initIconsList = function(){
	var iL = $c("ul","iconsList");
	for(var i=0;i<iL.length;i++){
		var ic = $t1L("li",iL[i]);
		for(var j=0;j<ic.length;j++){
			var im = $t1L("img",ic[j])[0];
			if(!im)im=$t1L("div",ic[j])[0];
			im.onmouseover=function(){
				this.parentNode.style.zIndex = 300;
				$t1L("span",this.parentNode)[0].style.display="block";
			}
			im.onmouseout=function(){
				this.parentNode.style.zIndex = 2;
				$t1L("span",this.parentNode)[0].style.display="none";
			}
		}
	}
};


amex.initPage=function(){
	amex.body = document.documentElement.getElementsByTagName("body")[0];
	
	amex.addPng(imgPath+"/common/head1.png",$i("header"),"bg");
	amex.addPng(imgPath+"/common/foot1.png",$i("footer"),"bg");
	amex.initDrop();
	amex.initNav3();
	amex.initAlert01();
	amex.initTabs();
	amex.initVideoTabs();
	amex.initVideoTab2();
	amex.initButton1();
	amex.initButton2();
	amex.initBoxW();
	amex.initDefileur();
	amex.initQuickLinks1();
	amex.initNavLeft1();
	amex.initContent1();
	amex.initCnt1Table();
	amex.initAccordeon();
	amex.initContent2();
	amex.initAboutList();
	amex.initExperience();
	amex.initSplitbox();
	amex.initBoxBlue();
	amex.initBoxLBlue();
	amex.initMundo();
	amex.initOffices();
	amex.initWorldClock();
	amex.initCurrencyConverter();
	amex.initCalendar();
	amex.initAirportList();
	amex.initIconsList();
}

amex.isInitialized = false;

amex.initASAP(function(){
	if(!amex.isInitialized){
		amex.isInitialized = true;
		amex.initPage();
		amex.createCntBg();
		amex.IE6fix();
	}
});

addOnloadEvent(function(){
	if(!amex.isInitialized){
		amex.isInitialized = true;
		amex.initPage();
		amex.createCntBg();
		amex.IE6fix();
	}

	amex.rescaleContent1bg();
	amex.rescaleContent2bg();
	amex.checkContentHeight();
	amex.expandCntBg();

	amex.initBg.setImg();

	//MGA 20090625 AEMXCOOR-107
if($c("span","airportFrom")[0]){
	amex.overlays=[$c("span","airportFrom")[0].getElementsByTagName("span")[0], $c("span","airportTo")[0].getElementsByTagName("span")[0]]
	document.getElementsByTagName("body")[0].onclick=function(){
		if(!flag){
			amex.overlays[0].style.display="none";
			amex.overlays[1].style.display="none";
		}
	};
}
	//end of AEMXCOOR-107
});


//MGA 20090926 AEMXCOOR-143
amex.labels={
	dow:["D","L","M","M","J","V","S"],
	ml:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],
	ms:["ENE","FEB","MAR","ABR","MAY","JUN","JUL","AGO","SEP","OCT","NOV","DIC"]
}
amex.c=function(){
	/*Default calendar*/
	var cfg=arguments[1]||{};
	var x=new Date();
	this.trg=arguments[0];
	this.today=(!cfg.day)?new Date(x.getFullYear(),x.getMonth(),x.getDate()):cfg.day;
	this.aday=86400000;//a day in milliseconds
	this.minDate=(!cfg.minDate)?new Date(this.today.getUTCFullYear(),this.today.getMonth(),this.today.getDate()):cfg.minDate;
	this.maxDate=(!cfg.maxDate)?new Date(this.today.getUTCFullYear()+1,this.today.getMonth(),this.today.getDate()):cfg.maxDate;
	this.showMonth=(!cfg.showMonth)?1:cfg.showMonth;
	this.modal=(!cfg.modal)?false:cfg.modal;
	this.autoselect=(!cfg.autoselect)?false:cfg.autoselect;
	this._callback=(!cfg.cb)?function(){}:cfg.cb;
	this._init=false;
	this.options={
		day:			this.today,
		days:			1,
		showMonths:		this.showMonth,
		modal:			this.modal,
		minDate:		this.minDate,
		maxDate:		this.maxDate,
		monthSelect:	false,
		autoselect:		this.autoselect,
		_callback:		this._callback,
		dayOffset:		0, // 0=week start with sunday, 1=week starts with monday
		dow:            amex.labels.dow,// days of week - change this to reflect your dayOffset
		ml:             amex.labels.ml,
		dCheck:			function (day) {
		/*return false for disabled days || return false for alloweddays*/
			if ( day.getTime() < (new Date(this.minDate)).getTime() ) {return false;} // minDate = 10/01/2008
			else if ( day.getTime() > (new Date(this.maxDate)).getTime() ) {return false;} // maxDate = 11/01/2008
			else return true;
			/*if ( day.getTime() == (new Date('8/7/2008')).getTime() ) return false;
			return (day.getDate() != 3);*/
		},
		callback:		function (day, days) {
			if(this.modal){this._target.parent().hide();};
			this._callback(day,days);
			return true;
		}
	}
	this.init=function(){
		var t=this.trg;
		if(this.modal){
			var _id=t.replace("#","");
			//putting calendar wrapper in the page
			$("body").append("<div id=\"wcal_"+_id+"_wrapper\" class=\"cal_wrapper\" onclick=\"event.cancelBubble=true;return false;\"><div id=\"wcal_"+_id+"\"></div><\/div>");
			//writing calendar
			$("#wcal_"+_id).css({"float":"left"}).jCal(this.options);
			$(t).bind("click",function(e,opt){
				//iframe blocker + positioning
				$(".cal_wrapper").hide();
				$("#wcal_"+$(this).attr("id")+"_wrapper").bgiframe().css({left:$(this).offset().left-101,top:$(this).offset().top+5+$(this).height()}).toggle();
				$("body").bind("click",function(e){$(".cal_wrapper").hide();});
				return false;
			});
		} else {
			$(t).jCal(this.options);
		}
		//setting default day
		$(t).data("day",this.options.day);
		$(t).val(this.options.day.getDate()+"/"+amex.labels.ms[this.options.day.getMonth()]+"/"+this.options.day.getFullYear())
		//click on the calendar icon simulates the click on the field
		$(t).parent().find(".jcalendar").bind("click",function(){$(t).trigger("click");return false;});
		this._init=true;
	}
	this.redraw=function(){
		var cfg=arguments[0]||{};
		
		var _id=this.trg.replace("#","");
		$("#wcal_"+_id+"_wrapper").remove();//removing previous instance of calendar
		
		var selectedDay=(!cfg.day)?new Date():cfg.day;
		this.options.minDate=selectedDay;
		this.options.day=selectedDay;
		$("#wcal_"+_id).data("day",selectedDay);
		return this.init()
	}
	return this.init();
}
//end of AEMXCOOR-143