// Content: js resize
// 2008-05-28. FM 22832 CB: 
// Set the correct domain (klm.com) for the ICI pages on klm.com so that IFrame information can be read 
// when the IFrame is located on a different server than where the klm.com pages are located.
setDomainForICI();
setDomainForEcomplaints();
// End set correct domain

function setDomainForICI()
{
	var strLocation = this.location.href;

	if ( ( strLocation.indexOf("klm.com") >= 0 ) && 
	     ( strLocation.indexOf("internet_checkin/ici_flightpax") >= 0 ) )
	{
		document.domain = "klm.com";
	}
}

function setDomainForEcomplaints()
{
	var strLocation = this.location.href;

	if ( ( strLocation.indexOf("klm.com") >= 0 ) &&
	( strLocation.indexOf("customer_support/ecomplaints") >= 0 ) )
	{
		document.domain = "klm.com";
	}
}

var w=null;function log(m){if(!w)w=window.open();w.document.write(m+'<br />');}

function updateSize () {
	updateIt();
}

function updateIt () {

	if (top.mainContainer)
	{
		/* Disable optimizing width 800 layout if bluebiz is running with a 4 column application */
		if ((document.body.offsetWidth < 988) && (!document.getElementById('bb_login') || !document.getElementById('app4jffp'))) {
			top.mainContainer.className = "main800";
			var d = document.getElementById("language_selector");
			if (d) d.style.width = "773px";
		}
		else {
			top.mainContainer.className = "main1024";
			var d = document.getElementById("language_selector");
			if (d) d.style.width = "987px";
		}
		/* Force correct positioning */
		if (navigator.product && navigator.product == "Gecko") {
			top.mainContainer.style.position = "relative";
			top.mainContainer.style.position = "";
		}
	}
}
// Content: js navigation
Navigation.prototype.HEIGHT_CLOSED = 25;
Navigation.prototype.BOTTOM_MARGIN = 20;
Navigation.prototype.WIN_IE50 = (navigator.userAgent.toLowerCase().indexOf("msie 5.0") > 0); 
Navigation.prototype.WIN_IE5PLUS = ((navigator.userAgent.toLowerCase().indexOf("msie") > 0) && (navigator.userAgent.toLowerCase().indexOf("msie 5.0") < 0)); 
Navigation.prototype.WIN_IE60 = (navigator.userAgent.toLowerCase().indexOf("msie 6.0") > 0);

function Navigation (container, bottomImage, HTML, extFrame) {
	this.navigation = document.getElementById(container);
	this.navigation.innerHTML = HTML;
	this.closing = -1;
	this.opening = -1;
	this.openImage = document.getElementById(bottomImage);
	this.logoImage = document.getElementById('navlogo');
	this.allItems = this.navigation.getElementsByTagName("li");
	this.initAllItems();
	this.subLists = this.navigation.getElementsByTagName('ul')[0].getElementsByTagName('ul');
	//this.targetHeight = this.getHeight() + this.HEIGHT_CLOSED + this.BOTTOM_MARGIN;
	this.targetHeight = 280 + this.HEIGHT_CLOSED + this.BOTTOM_MARGIN;
	this.isOpen = false;
	if (!document.all || this.WIN_IE50) this.initExtFrame();	
	/* iframe behind navigation for IE 5.5+ to hide selectboxes */
	if (document.all && !this.WIN_IE50) {
		this.selectHider = this.createHider();
	}
	if (this.WIN_IE50) {
		this.selectBoxes = document.getElementsByTagName('select');
	}
	this.navigation.onmouseover = createContextFunction(this, "open");
	this.navigation.onmouseout = createContextFunction(this, "close");
	/* IE initialization for navigation entries */
	if (document.all) {
		this.initIE();
	}
	this.placeItems();
	if (document.getElementById('sitemap')) {
//		generateSitemap();
		if (this.WIN_IE50) window.resizeBy(0, 1);
	}
	this.setFullHeight();
	if (getCookie('jffp')) {if (getCookie('jffp').length > 10) this.clearLoginEntries()};
}
Navigation.prototype.initIE = function () {
	for (var i=0; i < this.allItems.length; i++) {
		var node = this.allItems[i];
		node.onmouseover = function () {
			this.className += "over";
		}
		node.onmouseout = function () {
			this.className = this.className.replace("over", "");
		}
	}
}
Navigation.prototype.initExtFrame = function () {
	this.extFrame = document.getElementById('extFrame');
	if (this.extFrame) this.extFrame.style.position = 'relative'; /* ppkpatch: give iframe position: relative so top can be used instead of marginTop */
	if (this.extFrame) this.extFrame.startPos = calculateTop(this.extFrame);
}
Navigation.prototype.initAllItems = function () {
	for (var i = 0; i < this.allItems.length; i++) {
		if (this.allItems[i].className.indexOf('submenu') != -1) {
			this.allItems[i].submenu = this.allItems[i].getElementsByTagName('ul')[0];
			this.allItems[i].subItem = this.allItems[i].submenu.getElementsByTagName('li')[0];
		} else {
			this.allItems[i].submenu = null;
			this.allItems[i].subItem = null;
		}
	}
}
Navigation.prototype.open = function (e) {
	if (!isSafari()) {
		if (e) if (e.originalTarget.innerHTML == "Home") return;
		if (e) if (e.originalTarget.id == "navigation") return;
	}
	if (e) var dest = e.relatedTarget; else var dest = window.event.toElement;
	if (dest) if (dest.parentNode.id == 'home' || dest.parentNode.id == 'top' || dest.parentNode.id == 'ls_top' || dest.parentNode.id == 'maincontainer') return;
	//alert(dest.parentNode.id);
	//this.allItems[0].getElementsByTagName('a')[0].focus();
	//this.allItems[0].getElementsByTagName('a')[0].blur();
	if (this.WIN_IE50) {
		this.slideOpen()
	} else {
		if (this.closing > 0) {
			clearTimeout(this.closing);
			this.closing = -1;
		}
		if (this.opening < 0 && !this.isOpen) {
			this.opening = setTimeout(createContextFunction(this, "slideOpen"), 300);
		}
	}
}
Navigation.prototype.slideOpen = function () {
	this.openImage.style.display = 'block';
	this.logoImage.style.display = 'block';
	this.navigation.style.height = this.targetHeight + "px";
	if (this.selectHider) this.selectHider.style.display = 'block';
	if (this.selectBoxes) updateSelectBoxes(this.selectBoxes, 'hidden');
	if (this.extFrame && !this.isOpen) {
		this.extFrame.overLap = (this.HEIGHT_CLOSED + this.targetHeight - this.extFrame.startPos);
		this.extFrame.style.top = this.extFrame.overLap + "px"; /* ppkpatch: marginTop -> top */
	}
	if (!this.WIN_IE50) clearTimeout(this.opening);
	this.opening = -1;
	this.isOpen = true;
}
Navigation.prototype.close = function (e) {
	if (e) var dest = e.relatedTarget; else var dest = window.event.toElement;
	if (!isChild(this.navigation, dest)) {
		if (this.WIN_IE50) {
			this.slideClose();
		} else {		
			if (this.opening > 0) {
				clearTimeout(this.opening);
				this.opening = -1;
			}
			if (this.closing < 0 && this.isOpen) {
				this.closing = setTimeout(createContextFunction(this, "slideClose"), 300);
			}
		}
	}
	if (e) e.cancelBubble = true; else window.event.cancelBubble = true;
}
Navigation.prototype.slideClose = function () {
	this.openImage.style.display = 'none';
	this.logoImage.style.display = 'none';
	this.navigation.style.height = this.HEIGHT_CLOSED + "px";
	if (this.selectHider) this.selectHider.style.display = 'none';
	if (this.selectBoxes) updateSelectBoxes(this.selectBoxes, 'visible');
	if (this.extFrame) {
		this.extFrame.style.top = "0"; /* ppkpatch: marginTop -> top */
	}
	if (!this.WIN_IE50) clearTimeout(this.closing);
	this.closing = -1;
	this.isOpen = false;
}
Navigation.prototype.getHeight = function () {
	var targetHeight = 0;
	var height3rdLevel = 0;
	this.show();
	for (var i = 0; i < this.subLists.length; i++) {
		if (this.subLists[i].offsetHeight > targetHeight) targetHeight = this.subLists[i].offsetHeight;
		height3rdLevel = get3rdLevelHeight(this.subLists[i]);
		if (height3rdLevel > targetHeight) targetHeight = height3rdLevel;
	}
	this.hide();
	return targetHeight;
}
Navigation.prototype.show = function () {
	for (var i = 0; i < this.allItems.length; i++) {
		this.allItems[i].persistentClassName = this.allItems[i].className;
		this.allItems[i].className +="over";
		this.allItems[i].className +=" show";
	}
}
Navigation.prototype.hide = function () {
	for (var i = 0; i < this.allItems.length; i++) {
		this.allItems[i].className = this.allItems[i].persistentClassName;
	}
}
Navigation.prototype.setFullHeight = function () {
	for (var i = 0; i < this.subLists.length; i++) {
		this.subLists[i].style.height = "700px";
	}
}
Navigation.prototype.createHider = function () {
	var iframe = document.createElement('iframe');
	iframe.src = '/travel/fr_fr/static/empty.html';
	iframe.style.height = this.targetHeight + "px";
	iframe.style.width = this.navigation.offsetWidth + "px";
	iframe.frameBorder = '0';
	this.navigation.appendChild(iframe);
	return (iframe);
}
Navigation.prototype.clearLoginEntries = function () {
	var a;
	for (var i = 0; i < this.allItems.length; i++) {
		a = this.allItems[i].getElementsByTagName('a')[0];
		if (a.className.indexOf('login') != -1) a.className = '';
	}
}

Navigation.prototype.placeItems = function () {
	var mainItems = new Array();
	
	for (var i = 0; i < this.allItems.length; i++) {
		if (this.allItems[i].parentNode.className == 'level1') mainItems[mainItems.length] = this.allItems[i];
	}
	if (document.body.offsetWidth < 988) {
		mainItems[mainItems.length - 1].className += 'left';
		mainItems[mainItems.length - 1].id = 'lastleft';
		mainItems[mainItems.length - 2].className += 'left';
	}
	// force width of right-side nav items to display properly in ie
	if ((this.WIN_IE50) || (this.WIN_IE5PLUS)) {
		for (var i = 0; i < this.allItems.length; i++) {
			if (this.allItems[i].className == 'submenuleft') { 
				this.menu_item = this.allItems[i];
				this.checkWidth(this.menu_item);
			}
		}
	}
}
Navigation.prototype.checkWidth = function(menu_item) {
	this.menu_item = menu_item;
	this.wid = this.menu_item.offsetWidth;
	this.oddOrEven(this.wid);
	if (!this.WIN_IE60) {
		this.newWid += 15; //add right padding back on for ie6.0
	}
	this.menu_item.style.width = this.newWid;
}
Navigation.prototype.oddOrEven = function(wid) {
	this.wid = wid - 15; //remove right padding
	this.oe = this.wid % 2;
	if ((this.oe == 1) && (this.menu_item.id != "lastleft")) { this.wid++; }
	else if ((this.oe != 1) && (this.menu_item.id == "lastleft")) { this.wid++; }
	this.newWid = this.wid;
}
function get3rdLevelHeight(ul) {
	var height = 0;
	var maxHeight = 0;
	var currentYPos = 0;
	var secondLevelCounter = 0;
	var entries = ul.getElementsByTagName('li');
	
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].parentNode.className == 'level2') {
			if (entries[i].className == 'submenuover') {
				currentYPos = entries[i].offsetTop;
				height = currentYPos + entries[i].getElementsByTagName('ul')[0].offsetHeight;
			}
			if (height > maxHeight) maxHeight = height;
		}
	}
	return maxHeight;
}
function updateSelectBoxes(boxes, visibility) {
	for (var i = 0; i < boxes.length; i++) {
		boxes[i].style.visibility = visibility;
	}
}
// Content: js language selector
var lsFrame;

LanguageSelector.prototype.WIN_IE50 = (navigator.userAgent.toLowerCase().indexOf("msie 5.0") > 0); 

function LanguageSelector () {
	this.clData = null;
	this.curC = null;
	this.curL = null;
	this.countrySelector = document.getElementById('countries');
	this.languageList = document.getElementById('languageList');
	this.normal = document.getElementById('normal');
	this.external = document.getElementById('external');
	this.externalimg = document.getElementById('externalimg');
	this.externallinkimg = document.getElementById('externallinkimg');
	this.externallink = document.getElementById('externallink');
	this.ls = document.getElementById('ls_content');
	this.ls.obj = this;
	this.country = document.getElementById('lscountry');
	this.lang = document.getElementById('lslanguages');
	this.countryBut = document.getElementById('countryBut');
	if (this.countryBut) this.countryBut.onclick = createContextFunction(this, "openCountry");
	this.langBut = document.getElementById('langBut');
	this.langBut.onclick = createContextFunction(this, "openLang");
	this.closing = null;
	this.ls.onmouseout = createContextFunction(this, "close");
	this.ls.onmouseover = function () {if (this.obj.closing) clearTimeout(this.obj.closing)};
	this.canBeClosed = true;
	
	this.countrySelector.ls = this;
	this.countrySelector.onfocus = function () {this.ls.canBeClosed = false;}
	this.countrySelector.onblur = function () {this.ls.canBeClosed = true;}
	this.countrySelector.onchange = createContextFunction(this, "updateLanguages", "updateLanguages");
}
LanguageSelector.prototype.openCountry = function () {
	if (this.WIN_IE50) document.location.href = '/travel/klm_splash/splashpage.html';
	if (!this.clData) this.getData();
	this.country.style.visibility = 'visible';
	if (this.WIN_IE50) {
		this.country.style.display = 'block';
		this.lang.style.marginLeft = 'auto';
	}
	if (this.initialOption) {
		this.initialOption.selected = true;
		this.updateLanguages();
	}
	this.open();
}
LanguageSelector.prototype.openLang = function () {
	if (!this.clData) this.getData();
	this.country.style.visibility = 'hidden';
	if (this.WIN_IE50) {
		this.country.style.display = 'none';
		this.lang.style.marginLeft = '100px';
	}
	if (this.initialOption) {
		this.initialOption.selected = true;
		this.updateLanguages();
	}
	this.open();
}
LanguageSelector.prototype.open = function () {
	document.getElementById('ls_top').style.display = 'none';
	document.getElementById('ls_content').style.display = 'block';
	document.getElementById('ls_content').style.position = 'relative';
}
LanguageSelector.prototype.close = function (e) {
	if (e) var dest = e.relatedTarget; else var dest = window.event.toElement;
	if (!isChild(this, dest)) {
		if (this.canBeClosed) this.closing = setTimeout(createContextFunction(this, "closeIt"), 3000);
	}
	return true;
}
LanguageSelector.prototype.closeIt = function () {
	document.getElementById('ls_top').style.display = 'block';
	document.getElementById('ls_content').style.display = 'none';
	clearInterval(this.closing);
}
LanguageSelector.prototype.updateLanguages = function () {
	var c, l;
	var newLi;
	this.clearLanguages();
	c = this.countrySelector.options[this.countrySelector.selectedIndex].value;
	if (!c) return;
	var entries = this.clData.getHTMLById(c).getElementsByTagName('li');
	for (var i = 0; i < entries.length; i++) {
		newLi = document.createElement('li');
		if (entries[i].getAttribute('url'))
		{
			this.normal.style.display = 'none';
			if (entries[i].getAttribute('img') != "")
			{
				this.external.style.display = 'block';
				this.externalimg.src = entries[i].getAttribute('img');
				this.externallinkimg.href = entries[i].getAttribute('url');
				this.externallink.href = entries[i].getAttribute('url');
			}	
			else
			{
				this.external.style.display = 'none';
				this.normal.style.display = 'block';
				if (entries[i].id == 'selected')
					newLi.innerHTML = '<a href="javascript:changeLanguage(\'' + this.curC + '_' + this.curL + '\', \'' + entries[i].getAttribute('url') + '\');" class="current">' + entries[i].innerHTML + '</a>'
				else 
					newLi.innerHTML = '<a href="javascript:changeLanguage(\'' + this.curC + '_' + this.curL + '\', \'' + entries[i].getAttribute('url') + '\');">' + entries[i].innerHTML + '</a>';
				this.languageList.appendChild(newLi);
			}				
		} else {
			this.external.style.display = 'none';
			this.normal.style.display = 'block';
			if (entries[i].id == 'selected')
				newLi.innerHTML = '<a href="javascript:changeLanguage(\'' + this.curC + '_' + this.curL + '\', \'' + c + '_' + entries[i].className + '\');" class="current">' + entries[i].innerHTML + '</a>'
			else 
				newLi.innerHTML = '<a href="javascript:changeLanguage(\'' + this.curC + '_' + this.curL + '\', \'' + c + '_' + entries[i].className + '\');">' + entries[i].innerHTML + '</a>';
			this.languageList.appendChild(newLi);
		}
	}
	this.countrySelector.blur();
}
LanguageSelector.prototype.clearLanguages = function () {
	var list;
	list = this.languageList;
	while (list.hasChildNodes()) {
		list.removeChild(list.firstChild);
	}
}
LanguageSelector.prototype.fill = function () {
	this.clData = lsFrame;
	var entries = this.clData.getHTMLByTag('li')
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'selected') this.curC = entries[i].id;
	}
	var l = this.clData.getHTMLById('selected');
	this.curL = l.className;
	this.fillSelectbox();
	this.updateLanguages();
}
LanguageSelector.prototype.fillSelectbox = function () {
	var current;
	var newOption;
	var txt, value;
	var entries = this.clData.getHTMLByTag('li');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].parentNode.parentNode.id == 'langdata') {
			txt = entries[i].innerHTML.substr(0, entries[i].innerHTML.toUpperCase().indexOf('<UL>'));
			value = entries[i].id;
			newOption = document.createElement('option');
			newOption.innerHTML = txt;
			newOption.value = value;
			this.countrySelector.appendChild(newOption);
			if (entries[i].className == 'selected') {
				newOption.selected = true;
				this.initialOption = newOption;
			}
		}
	}
}
LanguageSelector.prototype.getData = function () {
	lsFrame = new RPCFrame(window);
	lsFrame.setLocation('/travel/fr_fr/languages.html', createContextFunction(this, "fill"));
}

function changeLanguage (cur, fut) {
	if (fut.indexOf('http:') != -1)
			document.location.href = fut;
	else
	{
		if (document.frmLs.remember.checked == true) {
			setCookie('countryLanguage', fut, 365);
		}
		var params = fut.split("_");
		var curr_params = cur.split("_");

		// if the country has changed, then do not pass a forward URL
		if (curr_params[0] != params[0])
		{
			document.location.href = "/travel/klm_splash/index.html?country=" + params[0] + "&language=" + params[1] + "&remember=" + document.frmLs.remember.checked;
		}
		else
		{
			var newURL = document.location.href.replace('/' + cur + '/', '/' + fut + '/');
			var newHREF = "/travel/klm_splash/index.html?country=" + params[0] + "&language=" + params[1] + "&remember=" + document.frmLs.remember.checked + "&forwardURL=" + newURL;
			document.location.href = newHREF;		
		}
	}	
}
// Content: js cookies
// Content: js cookies
function setCookie(inName, inValue, inNumberOfDays)
{
	var expDate = new Date ();
	var cookieString;
	
	expDate.setTime (expDate.getTime() + (86400000 * inNumberOfDays));
	var gmtExpDate = expDate.toGMTString();
	
	cookieString = inName + "=" + inValue;
	if (inNumberOfDays != 0)
		cookieString += ";expires=" + gmtExpDate;	
	
	cookieString += ";path=/";	
	document.cookie = cookieString;
}

//this function gets the value of a cookie given it's name
function getCookie (inName)	{
	var dCookie = document.cookie; 
	var cName = inName + "=";
	var cLen = dCookie.length;
	var cBegin = 0;
	while (cBegin < cLen) 	{
		var vBegin = cBegin + cName.length;
		if (dCookie.substring(cBegin, vBegin) == cName) { 
			var vEnd = dCookie.indexOf (";", vBegin);
		    if (vEnd == -1) 
				vEnd = cLen;
			return unescape(dCookie.substring(vBegin, vEnd));
		}
		cBegin = dCookie.indexOf(" ", cBegin) + 1;
		if (cBegin == 0)
			 break;
	}
	return null;
}

//this function will delete a cookie by setting the expiration date in the past
function deleteCookie(inName)	{
	document.cookie = inName + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
// Content: js global
var navFrame, fbFrame;
var arDestinations = new Array();

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : 
    oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function initHome() {
	checkBrowser();
	top.mainContainer = document.getElementById('maincontainer');
	updateSize();
	if (document.getElementById('language_selector')) ls = new LanguageSelector();
	FBfill(true);
	setTriggersHome();
	setOtherKLMSites();
	webSensor();
	loadNav();
}
function initLocalHome() {
	setTriggersHome();
	setOtherKLMSites();
	webSensor();
	loadNav();
}
function init() {
	checkBrowser();
	top.mainContainer = document.getElementById('maincontainer');
	if (document.getElementById('language_selector')) ls = new LanguageSelector();
	FBfill();
	BBfill(false);
	updateSize();
	setTriggers();
	setOtherKLMSites();
	webSensor();
	loadNav();
	preloadImages();
	var divbuttonleft = document.getElementById("appleft");
	if (divbuttonleft) {
		divbuttonleft.style.width = 1 +"px";
	}
	var divbuttonright = document.getElementById("appright");
	if (divbuttonright) {
		divbuttonright.style.width = 1 +"px";
	}
	addSaveThisPageLink();
}
function addSaveThisPageLink()
{
	if ( (document.getElementById("backtotop") != null) && (document.getElementById("savethisdoclink") != null) )
	{
		var element = document.getElementById("printthispg")
		if (element != null)
		{
			if (element.parentNode.getAttribute("id") == "backtotop")
			{
				var newElement = document.createElement('div');
				newElement.className = 'savethispage';
				newElement.innerHTML = document.getElementById("savethis2").innerHTML;
				element.parentNode.appendChild(newElement);
			}
		}
		
	}
}
function webSensor() {
	var cook=document.cookie;
	var i=cook.indexOf('KLMCOM_SESSIONCOOKIE');
	var strResolutie=window.screen.width+"x"+window.screen.height;
	if(i<0)
	{
		var id1=parseInt(Math.random()*2147418112);		
		document.cookie='KLMCOM_SESSIONCOOKIE='+id1+new Date().getTime()+'--'+strResolutie+';path=/;domain=.klm.com'
	}	
	
	
	strCDom=document.location.host.substring(document.location.host.lastIndexOf('.',document.location.host.lastIndexOf('.') - 1));
	keepdays=180;
	
	cook=document.cookie;
	i=cook.indexOf('MfTrack_js');
	if(i<0){
	        // the cookie was not yet present, create a new cookie
	        id1=parseInt(Math.random()*2147418112);
	        strCVal=id1+'.'+new Date().getTime()+'--'+strResolutie;
	        document.cookie='MfTrack_js='+strCVal+'; path=/; domain='+strCDom;
	}
	strPVal='';
	i=cook.indexOf('MfPers_js=');
	if(i<0){
	        // the cookie was not yet present, create a new cookie
	        id1=parseInt(Math.random()*2147418112);
	        strPVal=id1+'.'+new Date().getTime()+'--'+strResolutie;
	}
 	else {
	        // change expire date of persistent cookie, with same value
	        j=cook.indexOf(";",i+10);
	        if (j<0)
	                strPVal=cook.substring(i+10);
	        else
	                strPVal=cook.substring(i+10, j);
	       // Temperaly check if cookie is oke, keep test till 1-1-2009
	       re = /^\d+\.\d+(\-){2}\d+x\d+$/
	       // cookie not oke, create new value
	       if (!re.test(strPVal))
	       {
	                id1=parseInt(Math.random()*2147418112);
	                 strPVal=id1+'.'+new Date().getTime()+'--'+strResolutie;
	       }  
	}
	expires=new Date();
	expires.setTime(expires.getTime()+(keepdays*24*60*60*1000));
	document.cookie='MfPers_js='+strPVal+'; path=/; domain='+strCDom+'; expires='+expires.toGMTString();
	
	var qs = window.location.search
	var adcamp = getParameter(qs, "adcamp")
	if (adcamp)
	{
		expires=new Date();
		expires.setTime(expires.getTime()+(30*24*60*60*1000));
		var content = "&adcamp=" + adcamp + "&adchan=" + getParameter(qs, "adchan") + "&adtype=" +
			getParameter(qs, "adtype") + "&adctry=" + getParameter(qs, "adctry") + "&adlang=" +
			getParameter(qs, "adlang") + "&http_referrer=" + document.referrer;
		document.cookie="SADCAMP=" + content + "; path=/; domain=" + strCDom;
		document.cookie="PADCAMP=" + content + "; path=/; domain=" + strCDom + "; expires="+expires.toGMTString();
	}
}
function FBfill (home) {
	if (document.getElementById('jffp_login')) {
		fbFrame = new RPCFrame(window);
		if (home)
			fbFrame.setLocation('/travel/fr_fr/jffp.htm?loadProfile=true&date=' + new Date(), FBfillItHome, 'GET')
		else
			fbFrame.setLocation('/travel/fr_fr/jffp.htm?loadProfile=true&date=' + new Date(), FBfillIt, 'GET')
	}
}

function FBfillIt () {
  if (!fbFrame.getHTMLById('content')){
               var seealsoblocknewtop= document.getElementById('seealsoblocknewtop');
               var contentblock = document.getElementById('contentblock');
               var seealsobot= document.getElementById('seealsobot');
               if (!seealsoblocknewtop) {
                   if(contentblock && seealsobot) {
                      contentblock.style.background='white';
                      seealsobot.style.background='white';
                   }
               }
		return;
  }
	document.getElementById('jffp_login').innerHTML = fbFrame.getHTMLById('content').innerHTML;
	initFbbox();
	toggleMilesPlus();
	try {
		checkBB();
	} catch (e) {}
	var fbNumber = getCookie('fbNumber');
	if (fbNumber)
	{
		var elems = document.getElementsByName('miles');
		for (var i = 0; i < elems.length; i++)
		{
			elems[i].value = fbNumber;
		}
	}
}

function FBfillItHome () {
	document.getElementById('jffp_login').innerHTML = fbFrame.getHTMLById('content').innerHTML;
	initFbbox(true);
	var fbNumber = getCookie('fbNumber');
	if (fbNumber)
	{
		var elems = document.getElementsByName('miles');
		for (var i = 0; i < elems.length; i++)
		{
			elems[i].value = fbNumber;
		}
	}
}

function initFbbox(home)
{
	var dashboarddiv = document.getElementById('dashboard')
	var fbbox = getElementsByClassName(document,'div','fbbox');
	if(fbbox.length == 1)
	{
		var fbboxesBig = getElementsByClassName(fbbox[0],'div','fbboxbig');
		var fbboxesVisual = getElementsByClassName(fbbox[0],'img','fbbox-visual');
		var fbboxesInloggenLabel = getElementsByClassName(fbbox[0],'a','fbbox-inloggen-label');
		var fbboxesInloggen = getElementsByClassName(fbbox[0],'a','fbbox-inloggen');
		var fbboxesContentBg = getElementsByClassName(fbbox[0],'div','fbbox-content-bg');
		var fbboxesContent = getElementsByClassName(fbbox[0],'div','fbbox-content');
		var fbboxesOpacitylayer = getElementsByClassName(fbbox[0],'div','fbbox-opacitylayer');
		var fbboxesLoginlayer = getElementsByClassName(fbbox[0],'div','fbbox-loginlayer');
		var fbboxesLoginlayerMessage = getElementsByClassName(fbbox[0],'p','fbbox-loginlayer-message');
		var fbboxesSluit = getElementsByClassName(fbbox[0],'a','fbbox-sluit');
		var fbboxesPushin = getElementsByClassName(fbbox[0],'div','fbbox-pushin');
		var fbboxPromotion = document.getElementById('fbbox-promotion');
		var pagecontent = document.getElementById('content');
		var seealsoblock = document.getElementById('seealso');
		var seealsoblockspacetop= document.getElementById('seealsoblockspacetop');
		var seealsoblockpush= document.getElementById('seealsoblockpush');
		var seealsoDivBot = document.getElementById('seealsobot')

		if (!(seealsoDivBot)){
			var seealsoDivBot = getElementsByClassName(document,'div','largeseealsobot')
		}
				
		if (seealsoblockpush){
			var strSeeAlsoHeight=(seealsoblockpush.offsetHeight);
		}
		if (pagecontent){
			var strPagecontent=(pagecontent.offsetHeight);
		}else{
			var pagecontent = document.getElementById('contentblock4col');
			if (pagecontent){
				var strPagecontent=(pagecontent.offsetHeight);
				var bExtraIframe = true
			}
		}
		
		
		if (!(seealsoblock)){
			seealsoblock = document.getElementById('recent');
		}
		if ((seealsoblock) && (bExtraIframe)){
			var contentcontainer = document.getElementById('contentcontainer');
			contentcontainer.style.background=("transparent url(/travel/fr_fr/images/content_y_tcm92-120640.gif) repeat-y scroll 0% 50%");
		}
		var fbboxesHeight = fbboxesContent[0].offsetHeight - 35;
		if (fbboxesBig.length == 0) {
			fbboxesHeight += 45;
		}
		if(fbboxesInloggen.length == 1 && fbboxesOpacitylayer.length == 1 && fbboxesLoginlayer.length == 1 && fbboxesSluit.length == 1) {
			addEventHandler(fbboxesInloggen[0],'click', function(e) {
				if (fbboxesLoginlayerMessage.length == 2 && fbboxPromotion) {
				if (!navigator.cookieEnabled) {
					fbboxesLoginlayerMessage[0].style.display = 'none';
					fbboxesLoginlayerMessage[1].style.display = 'block';
					fbboxPromotion.className = 'fbbox-warning';
				} else {
					fbboxesLoginlayerMessage[0].style.display = 'block';
					fbboxesLoginlayerMessage[1].style.display = 'none';
					fbboxPromotion.className = '';
				}
				}
				fbboxesOpacitylayer[0].style.display = 'block';
				fbboxesLoginlayer[0].style.display = 'block';
				fbboxesSluit[0].style.display = 'block';
				fbboxesInloggen[0].style.display = 'none';
			});
			addEventHandler(fbboxesSluit[0],'click', function(e) {
				fbboxesOpacitylayer[0].style.display = 'none';
				fbboxesLoginlayer[0].style.display = 'none';
				fbboxesSluit[0].style.display = 'none';
				fbboxesInloggen[0].style.display = 'block';										 
			});			
		}
		if(fbboxesInloggenLabel.length == 1 && fbboxesPushin.length == 1 && fbboxesContentBg.length == 1 && fbboxesContent.length == 1) {
			addEventHandler(fbboxesInloggenLabel[0],'click', function(e) {
				fbboxesPushin[0].className = 'fbbox-pushin';
				fbboxesContent[0].style.display = 'block';
				fbboxesContentBg[0].style.display = 'block';
				if(fbboxesVisual.length == 1){fbboxesVisual[0].style.display = 'block';}
				if(fbboxesInloggenLabel.length == 1){fbboxesInloggenLabel[0].style.display = 'none';}
				if(fbboxesInloggen.length == 1){fbboxesInloggen[0].style.display = 'none';}
				if(fbboxesOpacitylayer.length == 1){fbboxesOpacitylayer[0].style.display = 'block';}
				if(fbboxesLoginlayer.length == 1){fbboxesLoginlayer[0].style.display = 'block';}
				if(fbboxesSluit.length == 1){fbboxesSluit[0].style.display = 'block';}									 
			});
		}
		if(fbboxesPushin.length == 1 && fbboxesContentBg.length == 1 && fbboxesContent.length == 1) {
		    	addEventHandler(fbboxesPushin[0],'click', function(e) {
				if(fbboxesPushin[0].className == 'fbbox-pushin') {
					fbboxesPushin[0].className = 'fbbox-pushout';
					fbboxesContentBg[0].style.display = 'none';
					fbboxesContent[0].style.display = 'none';
					if(fbboxesVisual.length == 1){fbboxesVisual[0].style.display = 'none';}
					if(fbboxesInloggenLabel.length == 1){fbboxesInloggenLabel[0].style.display = 'block';}
					if(fbboxesInloggen.length == 1){fbboxesInloggen[0].style.display = 'none';}
					if(fbboxesOpacitylayer.length == 1){fbboxesOpacitylayer[0].style.display = 'none';}
					if(fbboxesLoginlayer.length == 1){fbboxesLoginlayer[0].style.display = 'none';}
					if(fbboxesSluit.length == 1){fbboxesSluit[0].style.display = 'none';}
					setCookie("mpopen", "false", 0);
					if (seealsoblock) seealsoblock.style.paddingTop = 0;
					if ((seealsoblockspacetop) && (dashboarddiv)){
						seealsoblockspacetop.style.height= 0 + "px";
					}
					if ((seealsoblockspacetop) && (!(dashboarddiv))){
						seealsoblockspacetop.style.height= 41 + "px";
					}
					if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (bExtraIframe)){
						pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + 50 + "px";
						pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + 50 + "px";
					}				
					if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (!(bExtraIframe))){
						pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + "px";
						pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + "px";
				}
				} else {
					fbboxesPushin[0].className = 'fbbox-pushin';
					fbboxesContentBg[0].style.display = 'block';
					fbboxesContent[0].style.display = 'block';
					if(fbboxesInloggenLabel.length == 1){fbboxesInloggenLabel[0].style.display = 'none';}
					if(fbboxesVisual.length == 1){fbboxesVisual[0].style.display = 'block';}
					if(fbboxesInloggen.length == 1){fbboxesInloggen[0].style.display = 'block';}
					setCookie("mpopen", "true", 0);

					if (seealsoblock) {
						seealsoblock.style.paddingTop = (fbboxesHeight-17) + "px";
					}
					if ((seealsoblockspacetop) && (dashboarddiv)){
						seealsoblockspacetop.style.height= 33+ "px";
					}
					if ((seealsoblockspacetop) && (!(dashboarddiv))){
						seealsoblockspacetop.style.height= 74 + 'px';
					}
					if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (bExtraIframe)){
						pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + 50 + "px";
						pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + 50 + "px";
						if (!(seealsoDivBot)){
							var seealsoDivBot = document.createElement('div');
							seealsoDivBot.setAttribute('id','');
							seealsoDivBot.setAttribute('class','largeseealsobot');
							pagecontent.appendChild(seealsoDivBot);
						}
					}
					if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (!(bExtraIframe))){
						pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + "px";
						pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + "px";
					}
				}
		    	});
		}
		if (home && home == true) {
			fbbox[0].className = 'fbbox';
			if (fbboxesBig.length == 1) {
				fbboxesBig[0].className = 'fbboxbig';
			}
		
		} else {
			var mpopen = getCookie("mpopen");
			var b_open = mpopen == null ? top.FBopen : (mpopen == "true");
			if (!b_open) {
				fbboxesPushin[0].className = 'fbbox-pushout';
				fbboxesContentBg[0].style.display = 'none';
				fbboxesContent[0].style.display = 'none';
				if(fbboxesVisual.length == 1){fbboxesVisual[0].style.display = 'none';}
				if(fbboxesInloggenLabel.length == 1){fbboxesInloggenLabel[0].style.display = 'block';}
				if(fbboxesInloggen.length == 1){fbboxesInloggen[0].style.display = 'none';}
				if(fbboxesOpacitylayer.length == 1){fbboxesOpacitylayer[0].style.display = 'none';}
				if(fbboxesLoginlayer.length == 1){fbboxesLoginlayer[0].style.display = 'none';}
				if(fbboxesSluit.length == 1){fbboxesSluit[0].style.display = 'none';}
				
				if ((seealsoblockspacetop) && (!(dashboarddiv))){
					seealsoblockspacetop.style.height= 33 + "px";
				}				
				if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (bExtraIframe)){
					pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + 50 + "px";
					pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + 50 + "px";
					if (seealsoDivBot.length == 0){
						var seealsoDivBot = document.createElement('div');
						seealsoDivBot.setAttribute('id','');
						seealsoDivBot.setAttribute('class','largeseealsobot');
						pagecontent.appendChild(seealsoDivBot);
					}
				}				
				if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (!(bExtraIframe))){
					pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + "px";
					pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, false) + "px";
				}
			} else {
				if (seealsoblock) seealsoblock.style.paddingTop = (fbboxesHeight-17) + "px";
				if ((seealsoblockspacetop) && (dashboarddiv)) 
				                seealsoblockspacetop.style.height=33+ "px";
				if ((seealsoblockspacetop) && (!(dashboarddiv))){
					seealsoblockspacetop.style.height= 74 + 'px';
				}				
				if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (bExtraIframe)){
					pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + 50 + "px";
					pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + 50 + "px";
					if (seealsoDivBot.length == 0){
						var seealsoDivBot = document.createElement('div');
						seealsoDivBot.setAttribute('id','');
						seealsoDivBot.setAttribute('class','largeseealsobot');
						pagecontent.appendChild(seealsoDivBot);
					}
				}
				if((strSeeAlsoHeight > 0) && (strPagecontent > 0) && (!(bExtraIframe))){
					pagecontent.style.minHeight=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + "px";
					pagecontent.style.height=setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, true) + "px";
				}
			}
		}
	}
	// FM - ID: 29498 - Tijdelijke link naar AF in het FB frame onder de login 
	var agt = navigator.userAgent.toLowerCase(); 
	if (agt.indexOf("safari") == -1)
	{
		var ele = document.getElementById("safari_fb_link");
		if (ele != null)
			ele.style.display = "none";
			
		ele = document.getElementById("safari_fb_link_img");
		if (ele != null)
			ele.style.display = "none";
			
		ele = document.getElementById("safari_fb_link_pro");
		if (ele != null)
			ele.style.display = "none";
			
		ele = document.getElementById("safari_fb_link_pro_img");
		if (ele != null)
			ele.style.display = "none";

	}
}

function setPageContentDivHeight(fbboxesHeight, strSeeAlsoHeight, strPagecontent, bLarge){
	if (bLarge){
		var strExtraOffsetHeight=(fbboxesHeight);
		var strExtraScaleHeight=(28);
	} else {
		var strExtraOffsetHeight=(0);
		var strExtraScaleHeight=(0);
	}
	var strSeeAlsoHeight=(strSeeAlsoHeight + strExtraOffsetHeight);
	var strPagecontent=(strPagecontent);
	var strScaleUp=(strSeeAlsoHeight - strPagecontent);
	if (strScaleUp > 0){
		var pageHeight=(strPagecontent + strScaleUp + strExtraScaleHeight);
		return pageHeight;
	} else {
		if (strPagecontent <= 640){
			var pageHeight=(640);
			return pageHeight;
		} else{
			return (strPagecontent);
		}
		
	}
}

function BBfill (home) {
	if (document.getElementById('bb_login')) {
		fbFrame = new RPCFrame(window);
		if (home) { fbFrame.setLocation('/travel/fr_fr/business/bluebiz_/bluebiz.htm?redirect=no&pageID=' + window.pageID + '', BBfillItHome); }
		else { fbFrame.setLocation('/travel/fr_fr/business/bluebiz_/bluebiz.htm?redirect=no&pageID=' + window.pageID + '', BBfillIt); }
                                initBlueBizAppFrame();
	}
}
function BBfillIt () {
	var sUserName = readCookie("bbloginname");
	var sChecked = readCookie("rememberbblogin");
	document.getElementById('bb_login').innerHTML = fbFrame.getHTMLById('content').innerHTML;
	BBLoggedfill();
	var oForm = document.getElementById("bbloginbox");
	if (oForm != null) {
		if ((sUserName != null) && (sUserName != '')) { 
			oForm.elements["username"].value = sUserName;
		}
		if ((sChecked != null) && (sChecked == 'false')) {
			oForm.elements["rememberbblogin"].checked = false;
		}
	}
	toggleMilesPlus();
	try {
		if (bluebiz != undefined) checkBB();
	} catch (e) {}
}
function BBfillItHome () {
	document.getElementById('bb_login').innerHTML = fbFrame.getHTMLById('content').innerHTML;
	document.getElementById('bottom').innerHTML = '';
	BBLoggedfill();
}
function BBLoggedfillIt() {
	document.getElementById('login-status').innerHTML = fbFrame.getDocument().innerHTML;
}
function BBLoggedfill () {
	if (document.getElementById('login-status')) {
		fbFrame = new RPCFrame(window);
		try{
		fbFrame.setLocation("/le2/passage/noseb2b/company/CompanyProfile/MemberInfo", BBLoggedfillIt);
		} catch (e) { }
	}
}
function loadNav() {
	if (document.getElementById('navlogo')) {
		new Navigation('navigation', 'navopen', document.getElementById('navigation').innerHTML);
	}
	else {
		/* Prevent double loading, since older jsps, still load the navigation with a setTimeout */
		if (!navFrame && document.getElementById('navigation')) {
			navFrame = new RPCFrame(window);
			navFrame.setLocation('/travel/fr_fr/navigation.html', initNavigation);
			try {
				clearInterval(n);
				} catch (e) {
			}
		}	
		else {
			return false;
		}
	}	
}
function initNavigation () {
	new Navigation('navigation', 'navopen', navFrame.getHTMLById('navcontent').innerHTML);
}
function isChild(ancestor, candidate) {
	if (!ancestor || !ancestor.parentNode || !candidate) return false;
	while (candidate && candidate != ancestor.parentNode) {
		if (candidate == ancestor) return true;
		try {
			candidate = candidate.parentNode;
		} catch (c) {return false}
	}
}
function createContextFunction(context, method, method2) {
	return (function(x){
		method = (method == "post") ? method2 : method;
		eval("context."+method+"(x)");
		return false;
	});
}
function initSpecials() {
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'specials') {
			var specials = entries[i].getElementsByTagName('li');
			for (var j = 0; j < specials.length; j++) {
				if (specials[j].getElementsByTagName('a').length > 0)
				{
					specials[j].link = specials[j].getElementsByTagName('a')[0].href;
					specials[j].getElementsByTagName('a')[0].removeAttribute("href");
					if (specials[j].getElementsByTagName('a')[0].target=='_blank')
						specials[j].onclick = function () {window.open(this.link)};
					else
						specials[j].onclick = function () {document.location.href = this.link};
				}
				specials[j].onmouseover = function () {this.className = "over"}
				specials[j].onmouseout = function () {this.className = ""};
			}
		}
	}
}
function initSpecials_mp() {
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'specials_jffp') {
			var specials = entries[i].getElementsByTagName('li');
			for (var j = 0; j < specials.length; j++) {
				specials[j].link = specials[j].getElementsByTagName('a')[0].href;
				specials[j].getElementsByTagName('a')[0].removeAttribute("href");
				specials[j].onclick = function () {document.location.href = this.link};
				specials[j].onmouseover = function () {this.className = "over"}
				specials[j].onmouseout = function () {this.className = ""};
			}
		}
	}
}
function setTriggers() {
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className.indexOf('TRIG') != -1) {
			entries[i].outline = entries[i].getElementsByTagName('div')[0];
			// create an exception for specials trigger
			if(entries[i].outline.className.indexOf('specials') == -1) {
				entries[i].link = entries[i].getElementsByTagName('a')[0];
				entries[i].onmouseover = function (e) {
					this.outline.oldClassName = this.outline.className;
					this.outline.className += "over";
                                                                                if (this.className.indexOf('widetrigger_pic') != -1 ) return;
					this.className += "  TRIGOVER";
				}
				entries[i].onmouseout = function (e) {
					this.outline.className = this.outline.oldClassName;
                                                                                if (this.className.indexOf('widetrigger_pic') != -1 ) return; 
					this.className = this.className.replace(" TRIGOVER","")
				}
				entries[i].onclick = function () {
					if (this.className.indexOf('newWin') != -1) {
						if (this.className.indexOf('KANA') !=-1) {
							window.open(this.link,'kana','width=400,height=300');
						}
						else if (this.className.indexOf('LSW') !=-1) { //local shop window
							window.open(this.link,'lsw','width=815,height=600,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes');
						}
						else {
							window.open(this.link);
						}	
					}
					else {
						document.location.href = this.link;
					}
				}
			}
		}
	}
}
function setTriggersHome() {
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className.indexOf('TRIG') != -1) {
			entries[i].link = entries[i].getElementsByTagName('a')[0];
			entries[i].onmouseover = function (e) {
				if (this.className.indexOf('widetrigger_pic') != -1 ) return;
				this.className += " TRIGOVER";
			}
			entries[i].onmouseout = function (e) {
				if (this.className.indexOf('widetrigger_pic') != -1 ) return;
				this.className = this.className.replace(" TRIGOVER","");
			}
			entries[i].onclick = function () {
				if (this.className.indexOf('newWin') != -1) {
					if (this.className.indexOf('KANA') !=-1) {
						window.open(this.link,'kana','width=400,height=300');
					}
					else if (this.className.indexOf('LSW') !=-1) { //local shop window
						window.open(this.link,'lsw','width=815,height=600,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes');
					}
					else {
						window.open(this.link);
					}
					this.link.disabled = true;
				}
				else {
					document.location.href = this.link;
				}
			}
		}
	}
}
function setPromos() {
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className.indexOf('nonair') != -1) {
			entries[i].outline = entries[i].getElementsByTagName('span')[0];
			entries[i].link = entries[i].getElementsByTagName('a')[0];
			entries[i].onclick = function () {document.location.href = this.link};
			entries[i].onmouseover = function (e) {
				this.outline.oldClassName = this.outline.className;
				this.outline.className += "over";
                                                                if (this.className.indexOf('widetrigger_pic') != -1 ) return;
                       			this.className += "  TRIGOVER";
			}
			entries[i].onmouseout = function (e) {
				this.outline.className = this.outline.oldClassName;
                                                                if (this.className.indexOf('widetrigger_pic') != -1 ) return; 
				this.className = this.className.replace(" TRIGOVER","")
			}
		}
	}
}

function toggleMilesPlus() {
	var miles = document.getElementById('mpopen');
	var milesplusblock = document.getElementById('jffpcontentcontainer');
	var seealsoblock = document.getElementById('seealso');
                var contentblock = document.getElementById('contentblock');
                var recent= document.getElementById('recent');
                var seealsobot= document.getElementById('seealsobot');
                var seealsoblockspacetop= document.getElementById('seealsoblockspacetop');
                var seealsoblocknewtop= document.getElementById('seealsoblocknewtop');
// mf 03/07 - in case no seealsoblock is present, then set seealsoblock to recent. this feature enables 
// mf 03/07 - the overview newsblock to also shift along with the FBlogging box 
// mdijk 05/05 - ALWAYS CHECK IF AN OBJECT EXISTS BEFORE ADDRESSING IT!!!!!!! In this case check if contentblock exists 
                if (!(seealsoblock) && (contentblock)){
                     contentblock.style.width=745+'px';}
                if (!seealsoblocknewtop) {
                    if(contentblock && seealsobot) {
                       contentblock.style.background='white';
                       seealsobot.style.background='white';
                    }
                }

                if (!(seealsoblock))
                {
                    seealsoblock = document.getElementById('recent');

                   }        
	if (milesplusblock != null) {
		milesplusblock.style.display = "none";
		var milesclose = document.getElementById('bottom');
		miles.onclick = function() {
			setCookie("mpopen", "true", 0);
			if (milesplusblock.style.display == 'none') {
				milesplusblock.style.display = 'block';
                                                                if (seealsoblock) seealsoblock.style.paddingTop = (milesplusblock.offsetHeight- 35) + "px";
if (seealsoblockspacetop) { seealsoblockspacetop.style.height= 17 + "px";}

			} else {
				milesplusblock.style.display = 'none';
				if (seealsoblock) seealsoblock.style.paddingTop = "0";
if (seealsoblockspacetop) { seealsoblockspacetop.style.height= "0";}


			}
		}
		milesclose.onclick = function() {
			setCookie("mpopen", "false", 0);
			if (milesplusblock.style.display == 'none') {
				milesplusblock.style.display = 'block';
				if (seealsoblock) seealsoblock.style.paddingTop = (milesplusblock.offsetHeight - 35) + "px";
if (seealsoblockspacetop) {seealsoblockspacetop.style.height= 17 + "px";}



			} else {
				milesplusblock.style.display = 'none';
				if (seealsoblock) seealsoblock.style.paddingTop = "0";
if (seealsoblockspacetop) { seealsoblockspacetop.style.height= "0";}


			}
		}
		var mpopen = getCookie("mpopen");
		var b_open = mpopen == null ? top.FBopen : (mpopen == "true");
		if (b_open) {
			milesplusblock.style.display = 'block';
			if (seealsoblock) seealsoblock.style.paddingTop = (milesplusblock.offsetHeight - 35) + "px";
if (seealsoblockspacetop) { seealsoblockspacetop.style.height= 17 + "px";}
		}
	}
}
function addEventHandler(element, type, handler) {
	try {
		element.addEventListener(type, handler, false);
	} catch(inferiorBrowserException) {
		if(element.attachEvent) 
			element.attachEvent('on'+type, handler);
		else 
			element['on'+type] = handler;
	}
	return [element, type, handler];
}
function isSafari() {
	return (/safari/i).test(navigator.userAgent);
}

function removeEventHandler(o, eventName, handler) {
	if (o.removeEventListener) {
		o.removeEventListener(eventName, handler, true);
	} else {
		o.detachEvent("on"+eventName, handler);
	}
}
function cancelEvent(e) {
	try {
		e.preventDefault();
		e.stopPropagation();
	} catch (someException) {
		e.cancelBubble = true;
		e.returnValue = false;
	}
	if (isSafari()) {
		var target = e.target;
		while (target.nodeType > 1) target = target.parentNode;
	 	if (/^a$/i.test(target.nodeName)) {
	 		target.onclick = function() {
				return false;
			};
		}
	}
	return false;
}

function calculateTop(object) {if (object) return object.offsetTop + calculateTop(object.offsetParent); else return 0;}
function calculateLeft(object) {if (object) return object.offsetLeft + calculateLeft(object.offsetParent); else return 0;}

function scaleFrame() {
	var f = document.getElementById('extFrame');
	var top;
	top = calculateTop(f);
	f.style.height = getWindowHeight() - top + "px";
	document.body.style.overflow = "hidden"; // for firefox and mozilla
	document.body.parentNode.style.overflow = "hidden"; // for ie
}
function getWindowHeight() {
var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		} else if (document.body&&document.body.clientHeight) windowHeight=document.body.clientHeight;
	}
	return parseInt(windowHeight);
}
function setOtherKLMSites() {
	var s = document.getElementById('otherKLMsites');
	if (s) {
		s.onchange = function () {
			var strArr = this.options[this.selectedIndex].value.split("|");
			if (strArr[0] != "#") {
				if (strArr[1] == "New window" || strArr[1] == "Popup") {
					window.open(strArr[0],"_blank");
				} else {
					document.location.href = strArr[0];
				}
			}
		}
	}
}

function logOutJFFP () {
	deleteCookie('jffp');
	var location = '/travel/logon/fr_fr?logOut=true';
	if (typeof(currentDashboard) != "undefined")
		if (currentDashboard != null)
			location += "&db=" + currentDashboard.selectedTab;
	document.location.href = location
}
function checkBB () {
	if (getCookie('klmcomcaas') == 'b2b') {
		document.getElementById('loginbar').style.display = 'none';
		document.getElementById('loggedinbar').style.display = 'block';
	} else {
		document.getElementById('loginbar').style.display = 'block';
		document.getElementById('loggedinbar').style.display = 'none';
	}
}
function checkLoggedin () {
	if (getCookie('jffp')) {
		if (getCookie('jffp').length > 10) {
			return true;
		}
	}
	return false;
}

function checkLogin () {
	if (getCookie('jffp')) {
		if (getCookie('jffp').length > 10) {
			document.getElementById('IN').style.display = 'block';
		} else {
			document.getElementById('OUT').style.display = 'block';
		}
	} else {
		document.getElementById('OUT').style.display = 'block'
	}
}

function initConditions() {
	var entries = document.getElementsByTagName('a');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'CONDITIONS') {
			entries[i].layer = entries[i].parentNode.getElementsByTagName('div')[0];
			entries[i].container = entries[i].parentNode.parentNode.parentNode.parentNode.parentNode;
			entries[i].layer.closer = entries[i].layer.getElementsByTagName('div')[0];
			entries[i].layer.closer.container = entries[i].container;
			entries[i].layer.closer.onclick = function () {
				this.parentNode.style.display = 'none';
				//this.container.style.position = 'static';
			}
			entries[i].onclick = function () {
				closeOthers();
				//this.container.style.position = 'relative';
				this.layer.style.display = 'block';
				var high = this.layer.offsetHeight;
				var newY = 0 - high + 'px';
				this.layer.style.marginTop=newY;
			}
		}
	}
}
function closeOthers () {
	var entries = document.getElementById('content').getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'conditionslayer')
			entries[i].style.display = 'none';
		if (entries[i].className == 'webawards')
			entries[i].style.position = 'static';
	}
}
function initWABanner () {
    var wa = document.getElementById('webawards');
    if (wa) {
        var anchors = wa.getElementsByTagName('a');
        if (anchors.length) {
            wa.link = anchors[0].href;
            wa.anchorfound = true;
            anchors[0].onclick = function() {wa.anchorfound = false;}
            wa.onclick = function () { 
                        if (wa.anchorfound) {
                                     document.location.href = this.link;
                        }else{
                                     wa.anchorfound = true;
                        } 
            }
        }
    }
}
function milesPlusLogon(){
	var strLocation;
	strLocation = "https://" + document.location.hostname + "/travel/logon/fr_fr?forwardurl=/fr_fr";
	if (typeof(currentDashboard) != "undefined") {
		if (currentDashboard != null) {
			strLocation += "?db=" + currentDashboard.selectedTab;
		}
	}
	document.forms.frmJFFP.action=strLocation;
	document.forms.frmJFFP.submit();
}

function checkBrowser() {
	if (getCookie('disableUnsupportedBrowserRedirect')){
                                return;
                }
	var browser = 'unknown';
	browser = getBrowser();
	if ((browser == 'TUX_FF') || (browser == 'TUX_MOZ') || (browser == 'TUX_OP') || (browser == 'MAC_OP') || (browser == 'WIN_OP') || (browser == 'WIN_IE8') ||  (browser == 'WIN_IE7') || (browser == 'WIN_IE6') || (browser == 'WIN_IE55') || (browser == 'WIN_IE50') || (browser == 'WIN_MOZ')|| (browser == 'WIN_FF') || (browser == 'MAC_SAF') || (browser == 'MAC_FF') || (browser == 'MAC_MOZ') || (browser = 'WIN_CHR') || (browser = 'MAC_CHR')|| (browser = 'TUX_CHR')) {
		//browser ok, so to 'normal' site
		return;
	}
	else {
		//wrong browser, so to 'browsersupport' page
		document.location.href = '/travel/klm_splash/browsersupport.html';
	}
}
function getParameter ( queryString, parameterName ) {
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) {
		begin = queryString.indexOf ( parameterName );
		if ( begin != -1 ) {
			begin += parameterName.length;
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) {
				end = queryString.length
			}
			return unescape ( queryString.substring ( begin, end ) );
		}
	return null;
	}
}
function getBrowser () {
	var mvIndex;
	var mozVers;
	var os = navigator.platform.toLowerCase(); 
	var agt = navigator.userAgent.toLowerCase(); 
	var ver = navigator.appVersion.toLowerCase();
	
	if (os.indexOf('win') != -1) {
		if (agt.indexOf("opera")!=-1) return "WIN_OP";
		else if (agt.indexOf("msie 8.0")!=-1) return "WIN_IE8";
		else if (agt.indexOf("msie 7.0")!=-1) return "WIN_IE7";
		else if (agt.indexOf("msie 6.0")!=-1) return "WIN_IE6";
		else if (agt.indexOf("msie 5.5")!=-1) return "WIN_IE55";
		else if (agt.indexOf("msie 5.0")!=-1) return "WIN_IE50";
		else if (agt.indexOf("netscape")!=-1) return "Netscape";
		else if (agt.indexOf("firefox")!=-1) return "WIN_FF";
		else if (agt.indexOf("chrome")!=-1) return "WIN_CHR";
		else if (agt.indexOf("mozilla")!=-1) {
			var mvIndex = agt.indexOf('; rv:1.');
			var mozVers = agt.substr(mvIndex + 7, 1); 
			if (mozVers > 3) return "WIN_MOZ";
		}
	}
	else if (os.indexOf('mac') != -1) {
		if (agt.indexOf("opera")!=-1) return "MAC_OP";
		else if (agt.indexOf("safari")!=-1) {
			var safIndex = agt.indexOf('safari/');
			var safVers = agt.substr(safIndex + 7, 3);
			if (safVers >= 110) return "MAC_SAF";
		}
		else if (agt.indexOf("netscape")!=-1) return "Netscape";
		else if (agt.indexOf("firefox")!=-1) return "MAC_FF";
		else if (agt.indexOf("mozilla")!=-1) {
			var mvIndex = agt.indexOf('; rv:1.');
			var mozVers = agt.substr(mvIndex + 7, 1); 
			if (mozVers > 3) return "MAC_MOZ";
		}
		else if (agt.indexOf("chrome")!=-1) return "MAC_CHR";
	}
	else {
		if (agt.indexOf("opera")!=-1) return "TUX_OP";
		else if (agt.indexOf("netscape")!=-1) return "Netscape";
		else if (agt.indexOf("firefox")!=-1) return "TUX_FF";
		else if (agt.indexOf("chrome")!=-1) return "TUX_CHR";
		else if (agt.indexOf("mozilla")!=-1) {
			return "TUX_MOZ";
		}
	}	
}

function checkReturnKey(event, varForm, blnMilesPlusLogon)
{
	var key;
	if(window.event)
		key = window.event.keyCode;     //IE
	else
		key = event.which;     //firefox

	if (key == 13)
	{
		if (blnMilesPlusLogon)
			milesPlusLogon();
		else
		{
			if(varForm!=null)
				varForm.submit();
			return true; // handle submittingoutside after exiting this function if varForm==null
		}
	}
	return false;
}

function include_css(uri, media) {
    var head = document.getElementsByTagName('head').item(0);
    var link = document.createElement('link');
    link.setAttribute('type', 'text/css');
    link.setAttribute('rel', 'stylesheet');
    link.setAttribute('href', uri);
    if (media)
        link.setAttribute('media', media);
    head.appendChild(link);
    return false;
}

function include_jscript(uri) {
    var head = document.getElementsByTagName('head').item(0);
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', uri);
    head.appendChild(script);
    return false;
}

function preloadImages(){
	var strLocation = document.location;
	if (strLocation.toString().indexOf('ebt/ebt7') > -1){
		image1 = new Image();
		image1.src = "/travel/fr_fr/images/InformationMouseover_tcm92-125620.jpg";
		image2 = new Image();
		image2.src = "/travel/fr_fr/images/NeedhelpMouseover_tcm92-125623.jpg";
		image3 = new Image();
		image3.src = "/travel/fr_fr/images/Information_NL_2b_tcm92-125617.jpg";
		image4 = new Image();
		image4.src = "/travel/fr_fr/images/Start-buttonENMouseover_tcm92-125625.jpg";
	}
}
var first = true;
function formshowhideICIinputField(inputValue) {
	if ( first )
	{
		formshowhideICIvalue(inputValue);
		selectButton(inputValue);
	}
}

function checkRadio(buttons) {
	var radioEmpty = false;
		if (buttons[i].checked) {
		radioEmpty = true;
	}
}

function formshowhideICIradioBtn(radio) {
	formshowhideICIvalue(radio.value);
}

function selectButton(inputValue) {
	switch (inputValue) {
		case 'ET':
			document.getElementById("eticket_input").checked = true;
		break;
		case 'PNR':
			document.getElementById("booking_input").checked = true;
		break;
	}
}

function formshowhideICIvalue(radioValue) {
	if ( first )
	{
		first = false;
	}
	switch (radioValue) {
		case 'ET':
			var objTextBox = document.getElementById("eticketnumbDiv");
			objTextBox.className = "textbox1";
		break;
		case 'PNR':
			var objTextBox = document.getElementById("eticketnumbDiv");
			objTextBox.className = "textbox2";
		break;
		}
		var objInputField = document.getElementById("eticketnumb");
		var attrDisabled = objInputField.attributes["disabled"];
			if ( attrDisabled ) {
				objInputField.removeAttribute('disabled');
		}
		hideLayer();
		clearinputText(objInputField);
		objInputField.focus();
}

var el = window;
if (el.addEventListener)
{
	el.addEventListener('load', addFBJavascripts, false); 
}
else if (el.attachEvent)
{
	el.attachEvent('onload', addFBJavascripts);
}


function addFBJavascripts()
{
	var sPath = window.location.pathname;
	var sPageName = sPath.substring(sPath.lastIndexOf('/') + 1);
		
	if ((sPageName.substring(sPageName.length - 5, sPageName.length).toUpperCase() != ".HTML") &&  (document.getElementById("jffp_login")))
	{
		var aScriptURLs = [
			'/travel/widgetbroker/interface/Widget.js' ,
			'/travel/widgetbroker/engine.js',
			'/travel/widgetbroker/util.js'
			];
		YAHOO.util.Get.script(aScriptURLs, { onSuccess: successFBJS  });
	}
	
}


var successFBJS = function(oData) 
{
	
	var scripts = document.getElementsByTagName("script");
	for (var i = 0; i < scripts.length; i++)
		eval(scripts[i]);

	if (getCookie("jffp") && (!(document.getElementById("fbbox-username"))))
                	requestmmbwidget ();

}




function requestmmbwidget ()
{

                var sBVSessionId =  getURLParameters("FBSessionID");
	
	
	if (sBVSessionId == "")
	{
		if (getCookie("jffp"))
			sBVSessionId = getCookieURLParameters ("FBSessionID", "?" + getCookie("jffp"));
	}

	var sBVEngineId = getURLParameters("FBCloneID")
	if (sBVEngineId == "")
	{
		if (getCookie("jffp"))
			sBVEngineId = getCookieURLParameters ("FBCloneID", "?" + getCookie("jffp"));
	}

 	var SesEngId = { 
 			"BV_SessionID" : sBVSessionId, 
   			"BV_EngineID" : sBVEngineId  
		}
   
   	var WidgetRequest = {
   		country : "fr",
   		lang : "fr",
   		pos : "fr",
   		type : "mmb",
   		attributes : SesEngId
   		}


	dwr.engine.setTimeout(15000);
 	dwr.engine.setErrorHandler(HandleMMBError);
	Widget.getWidget(WidgetRequest, HandleMMBDataResponse);
	
}


function getURLParameters(name)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );

	var results = regex.exec( window.location.href );

	if( results == null )    
		return "";
	else   
		return results[1];
}


function getCookieURLParameters(name, URL)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );

	var results = regex.exec(URL);

	if( results == null )    
		return "";
	else   
		return results[1];
}


function HandleMMBError()
{
	var diverrmsg = document.getElementById("fberrormsg");
	
	if (diverrmsg)
	{
		diverrmsg.style.display = "";

		var divimg = document.getElementById("fbwaiting");
		if (divimg)
			divimg.style.display = "none";
	}
	else
	{
		if (!(document.getElementById("fbbox-username")))
			setTimeout ("WaitForJFFPAndFill('', 1)", 1000);
	}
}



function HandleMMBDataResponse(strWidgetResponse)
{
	if ((strWidgetResponse == null) || (strWidgetResponse == ""))
	{
			var diverrmsg = document.getElementById("fberrormsg");
			if (diverrmsg)
			{
				diverrmsg.style.display = "";

				var divimg = document.getElementById("fbwaiting");
				if (divimg)
					divimg.style.display = "none";
			}
			else
			{
				if (!(document.getElementById("fbbox-username")))
					setTimeout ("WaitForJFFPAndFill('', 1)", 1000);
			}
			
	}
	else
	{
		var div = document.getElementById("fbmmbnextflight");
		if (div)
		{
			div.innerHTML = strWidgetResponse;
		}
		else
		{
			if (!(document.getElementById("fbbox-username")))
				setTimeout ("WaitForJFFPAndFill('" + strWidgetResponse + "', 1)", 1000);
		}	
                 }
}

function WaitForJFFPAndFill(strWidgetResponse, iNoofAttempts)
{

	if (strWidgetResponse == "")
	{
			var diverrmsg = document.getElementById("fberrormsg");
			if (diverrmsg)
			{
				diverrmsg.style.display = "";


				var divimg = document.getElementById("fbwaiting");
				if (divimg)
					divimg.style.display = "none";
			}
			else if(iNoofAttempts <= 120)
			{
				iNoofAttempts = iNoofAttempts +1 ;
				setTimeout ("WaitForJFFPAndFill('', " + iNoofAttempts + ")", 1000);
			}
	}

	else
	{
		var div = document.getElementById("fbmmbnextflight");
		if (div)
		{
			div.innerHTML = strWidgetResponse;
		}
		else if(iNoofAttempts <= 120)
		{
			iNoofAttempts = iNoofAttempts +1 ;
			setTimeout ("WaitForJFFPAndFill('" + strWidgetResponse + "', " + iNoofAttempts + ")", 1000);
		}
	}

}


function hideLayer() {
	document.getElementById("eticketnumbDummyDiv").style.visibility = "hidden";
}

function clearinputText(el) {
	el.value='';
}
// Content: js RPCFrame
var autoID = 1;
function OldRPCFrame(targetWindow) {
	this.ID = autoID++;
	this.parent = targetWindow;
	if ((window.navigator.appVersion.search("MSIE 5.0") != -1) && (navigator.platform.indexOf('Mac')==-1)) {
		this.IE50 = true;
		var newFrameHTML = "<iframe id='iframe"+this.ID+"' style='position:absolute;top:" + this.ID + "px;display:block;border:0px;width:1px;height:1px;'></iframe>";
		var d = document.createElement("div");
		d.innerHTML = newFrameHTML;
		document.body.appendChild(d);
		this.HTMLObject = targetWindow.document.getElementById('iframe'+this.ID);
	} else {
		this.IE50 = false;
		var newFrame = document.createElement("iframe");
		newFrame.setAttribute("id", "iframe"+this.ID);
		newFrame.style.position = "absolute";
		newFrame.style.border = "0px";
		newFrame.style.width = "0px";
		newFrame.style.height = "0px";
		this.HTMLObject = document.body.appendChild(newFrame);
	}
	return this;
}
OldRPCFrame.prototype.setLocation = function (newURL, callBack) {
	this.HTMLObject.src = newURL;
	addEventHandler(this.HTMLObject, "load", callBack);
	if (this.IE50) {
		if (callBack) top.callBack = callBack; else top.callBack = null;
		this.getDocument().onreadystatechange = this.returnToCaller;
	}
}
OldRPCFrame.prototype.returnToCaller = function () {
	if (this.readyState == "complete") {
		if (top.callBack) top.callBack();
	}
}

OldRPCFrame.prototype.getDocument = function () {
	if (this.HTMLObject.contentDocument) {
		return this.HTMLObject.contentDocument;
	} else if (this.HTMLObject.contentWindow) {
		return this.HTMLObject.contentWindow.document;
	} else if (this.HTMLObject.document) {
		if (navigator.platform.indexOf('Mac') != -1) {
			return this.parent.document.frames["iframe"+this.ID].document;
		} else {
			return this.parent.frames["iframe"+this.ID].document;
		}
	}
}
OldRPCFrame.prototype.destroy = function () {
	this.ID = null;
	this.HTMLObject.removeNode(true);
}
OldRPCFrame.prototype.getHTMLById = function (id) {
	return this.getDocument().getElementById(id);
}
OldRPCFrame.prototype.getHTMLByTag = function (tag) {
	return this.getDocument().getElementsByTagName(tag);
}

function getHTMLById(element, id) {
	var children = element.childNodes
	for (var i=0;i<children.length;i++) {
		if (children[i].id) {
			if (children[i].id == id) {
				return children[i];
			}
		}
		var child = getHTMLById(children[i], id);
		if (child != null) {
			return child;
		}
	}
	return null;	
}

var oldResponseText="";
function RPCFrame(targetWindow) {
	this.setLocation = function (newURL, callBack) {
		mycallback = callBack;
		xmlhttp.open("GET", newURL ,true);
		xmlhttp.onreadystatechange = this.myonreadystatchange;
		xmlhttp.send(null);
	}

	this.myonreadystatchange = function() {
		if (xmlhttp.readyState == 4 && oldResponseText!=xmlhttp.responseText) {
			var container = document.createElement("DIV");
			container.innerHTML = xmlhttp.responseText; 
                                                oldResponseText=xmlhttp.responseText;
			mycontent = container;
			mycallback();
		}
	}
	
	this.getDocument = function () {
		return mycontent;
	}

	this.destroy = function () {
		mycontent = null;;
	}

	this.getHTMLById = function (id) {
		return getHTMLById(mycontent, id);
	}

	this.getHTMLByTag = function (tag) {
		return mycontent.getElementsByTagName(tag);
	}


	var xmlhttp;
	var mycallback;
	var mycontext;
	var mycontent;
	try {
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
	} catch (e) {
		try {
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		} catch (E) {
			xmlhttp=false
		}
	}
	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	// In case xmlrpc is not supported we will fallback to the old method.
	if(!xmlhttp) {
		return new OldRPCFrame(targetWindow);
	}
	return this;
}
// Content: js kana
function getMfinfoPage() {
  	page = window.location.pathname;
  	index = page.indexOf('/fr_fr/');
  	if (index != -1) {
  		page = page.substr(index);	
  	}
  	return 'klmcom' + page;
}
function iqWindow(url) {
  var w=740;
  var h=527;
  var X=(screen.width-w)/2;
  var Y=(screen.height-h)/2;
  if(X<=0) {
    X=0;
    Y=0;
  }
  url = 'http://faq.klm.com/SRVS/CGI-BIN/WEBCGI.EXE?New,Kb=e-service_fr,Company={D392491E-D19F-494D-AA01-0D1A08B839C6},VarSet=C:fr,VarSet=L:fr,' + url;
  newwindow=window.open(url,'sc','top='+Y+',left='+X+',width='+w+',height='+h);
  if (!newwindow.opener) newwindow.opener = self;
  var kana_websensor = document.getElementById('kana_websensor');
  if (kana_websensor) {
  	kana_websensor.src = '/generic/man/static_img/1x1.gif?mfinfo.page='+getMfinfoPage()+'&mfinfo.country=fr&mfinfo.language=fr&mfinfo.application=kana&mfinfo.kana_event=Click%20Ask%20a%20question&random='+Math.random();
  }
}

/* Qgo js */
Animator = function (startValue, endValue, f, t, r) {
	this.step  = 5;		//The step by which timer counts from 0 to 100
	this.rate  = 3;		//The rate in ms at which steps are taken
	this.power = 2;		//The steepness of the animation curve
	this.type  = this.EASEINOUT;	//The type of easing
	this.duration = 0;		//The total duration
	this.min = startValue;
	this.max = endValue;
	if (this.min >90)
			{	this.isReversing = true;
			}else{	
				this.isReversing = false;
	}
	this.animateFunction = f;
	this.terminateFunction = t;
	//this.reversalFunction = r;
	//this.precalc = new Array(100);
	//for (var i=0; i <= 100; i++) this.precalc[i] = this.calculate(i);
}
Animator.prototype.NONE      = 0;
Animator.prototype.EASEIN    = 1;
Animator.prototype.EASEOUT   = 2;
Animator.prototype.EASEINOUT = 3;
//Animator.prototype.setDuration = function (duration) {
//	this.duration = duration;
//}
//Animator.prototype.setStep = function (step) {
//	this.step = step;
//}
//Animator.prototype.setRate = function (rate) {
//	this.rate = rate;
//}
//Animator.prototype.setPower = function (power) {
//	this.power = power;
//	for (var i=0; i <= 100; i++) this.precalc[i] = this.calculate(i);
//}
//Animator.prototype.setType = function (type) {
//	this.type = type;
//	for (var i=0; i <= 100; i++) this.precalc[i] = this.calculate(i);
//}
Animator.prototype.setAnimateFunction = function (f) {
	this.animateFunction = f;
}
Animator.prototype.start = function () {
	if (this.interval) return;
	this.time = this.min;
	//this.startTime = new Date();
	//this.isReversing = false;
	document.getElementById('qgo').style.zIndex = 100;
	this.interval = setInterval(this.method(this.animate), this.rate);
}
Animator.prototype.reverse = function () {
	this.isReversing = (this.isReversing) ? false : true;
}
//Animator.prototype.stop = Animator.prototype.pause = function () {
//	if (this.interval) clearInterval(this.interval);
//	this.interval = null;
//}
//Animator.prototype.resume = function () {
//	this.interval = setInterval(this.method(this.animate), this.rate);
//}
//Animator.prototype.isAnimating = function () {
//	return Boolean(this.interval);
//}
Animator.prototype.animate = function () {
	var finished = false;
//	if (this.duration) {
//		var now = new Date() - this.startTime;
//		if (now < this.duration) {
//			this.animateFunction(this.calculate(now/this.duration));
//		} else finished = true;
//	} else {
		if (this.time >= 0 && this.time <= 100) {
			this.animateFunction(this.time);
			this.time = (this.isReversing) ? this.time - this.step : this.time + this.step;
		} else finished = true;
//	}
	if (finished) {
		this.animateFunction(this.max);
		document.getElementById('qgo').style.zIndex = this.max;
		clearInterval(this.interval);
		this.interval = null;
		this.terminateFunction();
		//if (!this.isReversing && this.terminateFunction) this.terminateFunction();
		//if (this.isReversing && this.reversalFunction) this.reversalFunction();
	}
}
Animator.prototype.calculate = function (t) {
	if (!this.duration) t = t/100;
	var factor;
	switch (this.type) {
		case this.NONE      : factor = this.easeNone(t);break;
		case this.EASEIN    : factor = this.easeIn(t);break;
		case this.EASEOUT   : factor = this.easeOut(t);break;
		case this.EASEINOUT : factor = this.easeInOut(t);break;
	}
	return parseInt(this.min + factor*(this.max-this.min));
}
Animator.prototype.easeNone = function (t) {
	return t;
}
Animator.prototype.easeIn = function (t) {
	return Math.pow(t,this.power);
}
Animator.prototype.easeOut = function (t) {
	return 1-this.easeIn(1-t);
}
Animator.prototype.easeInOut = function (t) {
	if (t < 0.5) return this.easeIn(t*2)/2;
	return 0.5+this.easeOut((t-0.5)*2)/2;
}
Animator.prototype.method = function (method) {
	var context = this;
	return function () {
		method.apply(context, arguments);
	}
}
var strQgoPopup="0"; 
var firsttime=true;
var catqgoname = "";
var catnameqgo = "";
var genTabName = "";
function initSupportCenterApp4Col() {
	strQgoPopup = "1";
	initSupportCenter();
}
function initSupportCenter() {
	hook = document.getElementById('qgo');
	if (hook) {
		window.supportC = new SupportCenter(hook, 382, 54, 870, 400);
		//document.getElementById('supportframe').src = "";
		updateSC();
		addEventHandler(window, "resize", updateSC);
		if ( window.location.search.indexOf("?") != -1){
			var questqgo = getParameterTD("qgo-question"); 
			if (questqgo != ""){	
					//deeplink qgo-question
					document.getElementById('mySearch').value = questqgo;
					window.supportC.searchTerm = questqgo;
					QGOSetcontent('zoektab')
			}else{
					catnameqgo = getParameterTD("qgo-catname");
					catnameqgo = unescape(catnameqgo.valueOf());
					catnameqgo = catnameqgo.replace(/ /gi, "+");	
					catnumqgo = getParameterTD("qgo-catnumber");
					if (catnumqgo != ""){
						if (catnameqgo != ""){
							QGOSetcontent('categorie2');
						}else{
							QGOSetcontent('categorie');
						}					
					}else{
						if (catnameqgo != ""){	      			
							QGOSetcontent('categorie');
						}					
					}
			}
		}
	}
}
function updateSC () {
	if (!window.supportC) return;
	if (document.body.offsetWidth < 988) {
		window.supportC.resizeWindow(187, 54, 673, 400);
	} else {
		window.supportC.resizeWindow(382, 54, 870, 400);
	}
}
 
function QGOSearch_onKeyup(e)
{

		if (!e) var e = window.event;
		var key = e.charCode ? e.charCode : e.keyCode;
		if (key == 13){
				var targ;
				if (e.target) targ = e.target;
				else if (e.srcElement) targ = e.srcElement;
				if (targ.nodeType == 3) // defeat Safari bug
						targ = targ.parentNode;

    		window.supportC.searchTerm = targ.value;
    		QGOSetcontent('zoektab');
    }
		return false;
}

function QGOSearch_onFocus(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;

	targ.value = '';
}

function QGOsearchLink_onClick(e){
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	    	
	window.supportC.searchTerm = document.getElementById('mySearch').value;
	QGOSetcontent('zoektab');
}

function QGOSetcontent(tabName){
	if (window.supportC.opened) {
		if (window.supportC.searchTerm=='' || window.supportC.searchTerm=='Posez votre question ici (en quelques mots)') {
			if (document.getElementById('zoektab').className == 'actief'){
				window.supportC.searchTerm = '';
			}else{
				setTabActive('zoektab2');
			}
		}else{	
			setTabActive(tabName);
		}
		document.getElementById('qgo_websensor').src = '/generic/man/static_img/1x1.gif?mfinfo.page='+getMfinfoPage()+'&mfinfo.country=fr&mfinfo.language=fr&mfinfo.application=qgo&mfinfo.qgo_event=Click%20Search&mfinfo.qgo_searchstring='+escape(window.supportC.searchTerm);
		document.getElementById('mySearch').value = 'Posez votre question ici (en quelques mots)';
		document.getElementById('supportZoekLink').focus();
	}else{
		genTabName = tabName;
		window.supportC.opened = true;
		document.getElementById('supportframe').style.visibility = 'visible';
		document.getElementById('qgo').className = 'active';
		document.getElementById('qgocloseLink').style.display= 'block';
		document.getElementById('supportcenter').className = 'supportcenter-active supportcenter-open';
		document.getElementById('qgo_websensor').src = '/generic/man/static_img/1x1.gif?mfinfo.page='+getMfinfoPage()+'&mfinfo.country=fr&mfinfo.language=fr&mfinfo.application=qgo&mfinfo.qgo_event=Click%20Search&mfinfo.qgo_searchstring='+escape(window.supportC.searchTerm);
		window.supportC.opener.start();
	}	
}

function QGOanchor_onClick(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;

	document.getElementById('qgocloseLink').style.display= 'none';
	window.supportC.close();
	window.supportC.opened = false;
	document.getElementById('mySearch').value = 'Posez votre question ici (en quelques mots)';
}

function SupportCenter(hook, w, h, wo, ho) {

	this.hook = hook;
	this.searchTerm = '';
	this.qgo = document.getElementById('qgo');
	this.container = this.hook.appendChild(document.createElement('div'));
	this.container.id = 'supportcenter';

	// ----new start	
	//'<form method="get" action="#" target="supportframe" onsubmit="return false">\
	var qgoform = document.createElement("DIV");
	qgoform.id = "qgoform";

	//<fieldset>
	var qgofieldset = document.createElement("DIV");
	qgofieldset.className = "qgofieldset";

			//<a class="sc-close" href="#">&nbsp;</a>\
			var anchor = document.createElement("A");
			anchor.className = "sc-close";
			anchor.id = "qgocloseLink";
			anchor.href = "#";
			anchor.innerHTML = "&nbsp;";
			addEventHandler(anchor, "click", QGOanchor_onClick);


			//<div id="zoektab" class="actief" onclick="setTabActive(\'zoektab\');">\
			var zoektab = document.createElement("DIV");
			zoektab.className = "actief";
			zoektab.setAttribute("id","zoektab");
			
							//<input id="mySearch" type="text" class="text" value="Posez votre question ici (en quelques mots)" name="q" maxlength="128" />\
							var mySearch = document.createElement("INPUT");
							mySearch.setAttribute("type","text");
							mySearch.id ="mySearch";
							mySearch.className = "text";
							mySearch.value ="Posez votre question ici (en quelques mots)";
							mySearch.name = "q";
							mySearch.setAttribute("maxlength","128");
							addEventHandler(mySearch, "focus", QGOSearch_onFocus);
							addEventHandler(mySearch, "keyup", QGOSearch_onKeyup);
							
							//<a href="javascript:supportCenter.open(\'https://support.klm.com/\',\'zoektab\',\'\');void(0);" class="qgo-button" id="supportZoekLink">
							var supportZoekLink = document.createElement("A");
							supportZoekLink.className = "qgo-button";
							supportZoekLink.setAttribute("id", "supportZoekLink");
							//supportZoekLink.setAttribute("target","supportframe");
							supportZoekLink.setAttribute("href", "#");
							addEventHandler(supportZoekLink, "click", QGOsearchLink_onClick);
									//  <span>>Demandez</span>
									var questiontext = document.createElement("SPAN");
									questiontext.innerHTML = "Demandez";
									supportZoekLink.appendChild(questiontext);			
							// </a>

																			
							//<input type="hidden" name="popup" value="'+strQgoPopup+'" />\
							var qgoPopup = document.createElement("INPUT");
							qgoPopup.setAttribute("type","hidden");
							qgoPopup.setAttribute("name","popup");
							qgoPopup.setAttribute("value","'+strQgoPopup+'");
							//<input type="hidden" name="co" value="fr" />
							var qgoCo = document.createElement("INPUT");
							qgoCo.setAttribute("type","hidden");
							qgoCo.setAttribute("name","co");
							qgoCo.setAttribute("value","fr");
							//<input type="hidden" name="la" value="nl" />\
							var qgoLa = document.createElement("INPUT");
							qgoLa.setAttribute("type","hidden");
							qgoLa.setAttribute("name","la");
							qgoLa.setAttribute("value","nl");
							
							zoektab.appendChild(mySearch);
							zoektab.appendChild(supportZoekLink);
							zoektab.appendChild(qgoPopup);
							zoektab.appendChild(qgoCo);
							zoektab.appendChild(qgoLa);

			//</div>\	
			qgofieldset.appendChild(zoektab);					
			
			//<div id="tabcat">
			var qgotabcat = document.createElement("DIV");
			qgotabcat.setAttribute("id","tabcat");
					
					//<a href="https://support.klm.com/faq_cat.php?co=fr&la=nl&popup='+strQgoPopup+'" target="supportframe" onclick="setTabActive(\'categorie\');bQgoQuestionSubmitted=false;">
					//Overview FAQ categories
					var qgoCategorie = document.createElement("A");
					qgoCategorie.setAttribute("href", "#");		
					qgoCategorie.innerHTML = "Liste des questions posées par catégorie";
					
					//</a>
					qgotabcat.appendChild(qgoCategorie);
			//</div>
			qgofieldset.appendChild(qgotabcat);
			
				
			//<div id="tabfaq">
			var qgotabfaq = document.createElement("DIV");
			qgotabfaq.id = "tabfaq";
					
					//<a href="https://support.klm.com/faq.php?co=fr&la=nl&popup=+strQgoPopup+" target="supportframe" onclick="setTabActive(\'top10\');bQgoQuestionSubmitted=false;">
					//  Top 10 FAQ
					var qgoTop10 = document.createElement("A");
					qgoTop10.href ="#";			
					qgoTop10.innerHTML = "Les 10 premières questions posées";
					
					//</a>
					qgotabfaq.appendChild(qgoTop10);

			//</div>	
			qgofieldset.appendChild(qgotabfaq);
			
			//<div id="endtab"></div>\
			var qgotabend = document.createElement("DIV");
			qgotabend.setAttribute("id","endtab");
			qgofieldset.appendChild(qgotabend);
			qgofieldset.appendChild(anchor);
						
			//<img src="" id="qgo_websensor" alt="qgo_websensor" title="qgo_websensor" style="visibility:hidden;" />\
			var qgoWebSensor = document.createElement("IMG");
			qgoWebSensor.id = "qgo_websensor";
			qgoWebSensor.setAttribute("alt","qgo_websensor");
			qgoWebSensor.title = "qgo_websensor";
			qgoWebSensor.style.visibility ="hidden";
			qgoWebSensor.src = "/generic/man/static_img/1x1.gif";
			qgofieldset.appendChild(qgoWebSensor);									
		//</fieldset>\
		qgoform.appendChild(qgofieldset);			
		
		//</form>\
		this.container.appendChild(qgoform);
		
		//<iframe name="supportframe" id="supportframe" src="/travel/fr_fr/static/empty.html" frameborder="0"></iframe>';
		var qgoSupportframe = document.createElement("IFRAME");
		qgoSupportframe.id = "supportframe";
		qgoSupportframe.name = "supportframe";
		qgoSupportframe.src ="/travel/fr_fr/static/empty.html";
		qgoSupportframe.setAttribute("frameBorder","0");
		this.container.appendChild(qgoSupportframe);		
		
		addEventHandler(qgoTop10, "click" , function(e) { setTabActive('top10'); });		
		addEventHandler(qgoCategorie, "click" , function(e) { setTabActive('categorie'); });	
		
		
		this.iframe = document.getElementById("supportframe");
		//this.form = this.container.getElementsByTagName('form')[0];
		this.opened = false;
		this.closeLink = document.getElementById("qgocloseLink");

		//set the animator
		this.opener = new Animator(0, 100, this.scope(this.resize), this.scope(this.showStart));
		//this.opener.setDuration(700);
		this.closer = new Animator(100, 0, this.scope(this.resize), this.scope(this.showEnd));
		//this.closer.setDuration(700);
		
}

SupportCenter.prototype = {
	isIE6:/msie 6/i.test(navigator.userAgent),
	isSafari:/safari/i.test(navigator.userAgent),

	close:function() {
		if(this.opened) {
			document.getElementById('qgo_websensor').src = '/generic/man/static_img/1x1.gif?mfinfo.page='+getMfinfoPage()+'&mfinfo.country=fr&mfinfo.language=fr&mfinfo.application=qgo&mfinfo.qgo_event=Click%20Close';
			document.getElementById('qgocloseLink').style.display= 'none';
			document.getElementById('supportframe').src='/travel/fr_fr/static/empty.html';
			this.iframe.style.width =  '';
			this.iframe.style.height = '';
			firsttime = true;
			this.closer.start();
			this.opened = false;
		}
	},
	
	resizeWindow:function(rw, rh, rwo, rho) {		
		this.width = rw;
		this.height = rh;
		this.openWidth = rwo - rw;
		this.openHeight = rho - rh;
		this.qgo.style.width = '';
		this.container.style.width = '';
		this.iframe.style.width = '';
		this.iframe.style.height = '';
		this.close();
	},

	resize:function(i) {
		var resizewidth = Math.round(this.width + (i/100 * this.openWidth));
		var resizeheight = Math.round(this.height + (i/100 * this.openHeight));
		var resizecss = this.container.style;
		resizecss.width = resizewidth + 'px';
		resizecss.height = resizeheight + 'px';	
	},

	showStart:function() {
				var sc = document.getElementById('supportcenter');
				var maxWidth = parseInt(sc.style.width, 10) - 1;
				var maxHeight = parseInt(sc.style.height, 10) - 39;
				document.getElementById('supportframe').style.width = maxWidth + 'px';
				document.getElementById('supportframe').style.height = maxHeight + 'px';
				document.getElementById('supportframe').style.visibility = 'visible';
				document.getElementById('supportframe').style.visibility = 'visible';

				if (genTabName=='zoektab'){
					if (window.supportC.searchTerm=='' ||window.supportC.searchTerm=='Posez votre question ici (en quelques mots)'){
						if (firsttime){
								firsttime = false;
								setTabActive('zoektab2');
						}
					}else{
						setTabActive(genTabName);	
					}
				}else{	
					setTabActive(genTabName);
				}
				document.getElementById('mySearch').value = 'Posez votre question ici (en quelques mots)';
				document.getElementById('supportZoekLink').focus();
	},
	showEnd:function() {
			document.getElementById('supportframe').style.visibility = 'hidden';
			document.getElementById('supportcenter').className = '';
			document.getElementById('qgo').className = '';
			document.getElementById('supportcenter').zIndex = 0;
			this.container.className = '';	
			document.getElementById('supportframe').style.width = '';
			document.getElementById('supportframe').style.height = '';	
			document.getElementById('supportcenter').style.width = '';
			document.getElementById('supportcenter').style.height = '';	
	},	

	scope:function(method) {
		var scope = this;
		return function() {
			return method.apply(scope, arguments);
		}
	}
}

//set active tab for supportcenter
function setTabActive(activeTab){
		document.getElementById('zoektab').className = '';
		document.getElementById('tabcat').className = '';
		document.getElementById('tabfaq').className = '';
		if(activeTab=='zoektab') {
			document.getElementById('zoektab').className = 'actief';
			document.getElementById('supportframe').src='https://support.klm.com/retrieve.php?co=fr&la=fr&popup='+strQgoPopup+'&q='+ window.supportC.searchTerm;

		}
		else if(activeTab=='zoektab2') {
			document.getElementById('zoektab').className = 'actief';
			document.getElementById('supportframe').src='https://support.klm.com/start.php?q=empty&co=fr&la=fr';
		}
		else if(activeTab=='categorie') {
			document.getElementById('tabcat').className = 'actief';
			document.getElementById('supportframe').src = 'https://support.klm.com/faq_cat.php?co=fr&la=fr&popup='+strQgoPopup;
		}
		else if(activeTab=='categorie2') {
			document.getElementById('tabcat').className = 'actief';
			document.getElementById('supportframe').src = 'https://support.klm.com/faq_catnr.php?cat='+catnumqgo+'&name='+catnameqgo+'&popup='+strQgoPopup;
		}
		else if(activeTab=='top10') {
			document.getElementById('tabfaq').className = 'actief';
			document.getElementById('supportframe').src ='https://support.klm.com/faq.php?co=fr&la=fr&popup='+strQgoPopup;
		}
		else {
			document.getElementById('zoektab').className = 'actief';
		}
}

//functions setup for using supportcenter in a page
function focusvalue(dit) {
	if(dit.value == 'Posez votre question ici (en quelques mots)') {
		dit.value = '';
	}
}
function blurvalue(dit){
	if(dit.value == '') {
		dit.value = 'Posez votre question ici (en quelques mots)';}
}
function openSupportCenter(dit){
		window.supportC.searchTerm = '';
		QGOSetcontent(dit);
}

//functions setup for using supportcenter in a page
//send query to supportcenter
function sendToSupportcenter() {
	sourceInput = document.getElementById('sendtosupportcenter');
	targetInput = document.getElementById('mySearch');
	targetInput.value = sourceInput.value;
	window.supportC.searchTerm = targetInput.value;
	QGOSetcontent('zoektab');
	document.getElementById('sendtosupportcenter').value= 'Posez votre question ici (en quelques mots)';

}
// Content: js tradedoubler
function initTradedoubler(strOrgID, strEventID, strReportInfo)
{

	var strLeadNumber = getParameterTD("email");
	var refImage = new Image();
	//var srcImage = "http://tracker.tradedoubler.com/report?organization=" + strOrgID + "&event=" + strEventID + "&leadNumber=" + escape(strLeadNumber) + "&reportInfo=" + escape(strReportInfo);
	var srcImage = "http://www.klm.com/travel/fr_fr/report?organization=" + strOrgID + "&event=" + strEventID + "&leadNumber=" + escape(strLeadNumber) + "&reportInfo=" + escape(strReportInfo);
	refImage.src = srcImage;
}

function getParameterTD(strName) 
{
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	var blnFound = false;
	var i, retValue;
	
	retValue = "";
	i = 0;	
	while (i != parms.length && !blnFound)
	{
		var pos = parms[i].indexOf('=');
		if (pos > 0) 
		{
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			blnFound = (strName == key);
			if (blnFound)
				retValue = val;
		}
		i++;
	}
	return retValue;
}
// Content: js dashboard
/* 20070604 - MD: Added support for external apps and in memory dashboards */
/* 20070812 - BvD: Added mechanism for MMB reload when it's tab is clicked */

var currentDashboard = null; // ppkpatch

function Dashboard (home, selected, app) {
	this.loadtext = null;
	this.container = document.getElementById('dashboard');
	home ? this.home = true : this.home = false;
	app ? this.app = true : this.app = false;
	this.tablist = document.getElementById('tabs');
	this.tabs = this.tablist.getElementsByTagName('li');
	this.toolContainer = document.getElementById('tool');
	this.initTabs();
	this.selectedTab = null;
	this.images = null; // ppkpatch
	this.sourceFrame = new RPCFrame(window);
	if (!this.home) {
		this.bottomImage = document.getElementById('db_bottom');
		this.toolContainer.style.display = 'none';
	} else {
		var tabId = 0;
		if (selected) {
			if (checkLoggedin() && selected == "db_ici")
				selected = "db_ici_jffp";
			else if (!checkLoggedin() && selected == "db_ici_jffp")
				selected = "db_ici";
			else if (selected == "db_tt" && this.tabs[selected] == null)
				selected = "db_tt2";
			tabId = selected;
		} else {
			tabId = this.tabs[0].id;
		}
		// Check if dashboard is inline or it needs to be loaded
		if (tabId == "db_ebt" && (document.getElementById("destinationcontainer") != null || document.getElementById("klm-ebt") != null))
		{
			this.selectTab(tabId);
			fill_ebt();
			this.toolContainer.style.display = 'block';
		} else
			this.openTab(tabId);
	}
}
Dashboard.prototype.initTabs = function () {
	for (var i = 0; i < this.tabs.length; i++) {
		this.initTab(i);
	}
}
Dashboard.prototype.initTab = function (i) {
	var li = this.tabs[i];
	li.a = li.getElementsByTagName('a')[0];
	if (this.app) li.a.href = '/travel/fr_fr/emptycontentdashboardpage.htm?db=' + li.id;
	//if user is logged in (jffp cookie) then set some tabs to jffp version
	if (checkLoggedin()) {
		if (li.id == "db_ici") {
			li.id = "db_ici_jffp";
		} else if (li.id == "db_mmb") {
			li.id = "db_mmb_jffp";
		}
	}
	if (i == 0) li.className = 'first';
	li.dashboard = this;
	li.onclick = function () {
		if (this.dashboard.app) {
			document.location.href = '/travel/fr_fr/emptycontentdashboardpage.html?db=' + this.id;
		} else {
			this.a.blur();
			this.dashboard.openTab(this.id);
		}
	}
}
/* MD: - Added function for correctly interpreting the loaded state of applications */
function dashboardApplicationLoaded() {
	//if (this.loadtext) {clearTimeout(this.loadtext);this.loadtext = null}
}

/* MD: - Added checking to see if the tab was already loaded, in that case we can just switch the content tabs 
 			 - Added support for an app loaded in an iframe */			 
Dashboard.prototype.openTab = function (id) {
	/* BVD 20070913: - We only want to start loading anything if the current tab is 
	   - different from the requested tab 
	   - the MMB tab
	*/
	if (id == this.selectedTab){
		if (!this.home) {
			this.close();
			return;
		}
		else {
			if (id.indexOf("mmb") == 0){
				return;
			}
		}
	}
	
	/* BVD 20070913: - Fixed problem where multiple dashboards share elements with same ID by clearing
	the content of the dashboard to be unselected, effectively undoing the performance gains
	from the implementation of in-memory dashboards */
	this.getTabContentElement().innerHTML = "";
	oldResponseText="";	//Needed to force RPC frame to execute callback function!

	this.selectTab(id);

	// Online timetable is an AJAX application which requires certain JavaScript and css files to be included JIT
	if (id == "db_tt" || id == "db_tt2")
	{
		var host = document.location.protocol+'//'+document.domain+(document.location.port ? ':'+document.location.port : '');
		var publication = 'fr_fr';
		include_css (host+'/travel/'+publication+'/static/css/timetable/dashboardpage.css', 'screen');
		include_jscript(host+'/commercial/ott/ott-dwr/engine.js');
		include_jscript(host+'/commercial/ott/ott-dwr/util.js');
		include_jscript(host+'/commercial/ott/ott-dwr/interface/OttAjaxService.js');
		include_jscript(host+'/commercial/ott/ott-dwr/interface/CountryRequest.js');
		include_jscript(host+'/commercial/ott/ott-dwr/interface/CountryStationRequest.js');
		include_jscript(host+'/commercial/ott/ott-dwr/interface/StationRequest.js');
		include_jscript(host+'/travel/'+publication+'/static/js/timetable/consolidated/consolidated.js');
		include_jscript(host+'/travel/'+publication+'/static/js/timetable/dashboardpage.js');
	}

	if (this.getTabContentElement().childNodes.length == 0 || id.indexOf("mmb") > 0) {
		if (id.indexOf("_app") > 0) {
			this.getTabContentElement().innerHTML = "<iframe name='dashboardFrame' scrolling='no' width='554' height='230' id='dashboardFrame' frameborder='0' src='/travel/fr_fr/dashboard/" + id + ".htm' onload='dashboardApplicationLoaded()'></iframe>";
			document.getElementById('dashboardFrame').src = "/travel/fr_fr/dashboard/" + id + ".htm";
			this.toolContainer.style.display = 'block';
			if (!this.home) this.createCloser();
		} else {
			if (this.loadtext = null) {
				this.loadtext = setTimeout(createContextFunction(this, "showLoadText"), 500);
			}
			this.tabId = id;	
			this.sourceFrame.setLocation("/travel/fr_fr/dashboard/" + id + ".html", createContextFunction(this, "loadContentInitialize")); // ppkpatch -> Initialize
		}
	} 
	if (!this.home) {
		this.bottomImage.style.display = 'none';
		this.toolContainer.style.display = 'block';
	}
}
/* MD: Changed the insert node to be one level below the tool container */
Dashboard.prototype.showLoadText = function () {
	this.getTabContentElement().innerHTML = "loading...";
}
/* Start ppkpatch */

/* Principle: the new page is only loaded into the Dashboard when all images have finished loading.
	loadContentInitialize() prepares this check. checkNumberOfImages() checks if all images have
	been loaded (readyState == 'complete'). If they haven't, set a timeout to try again in 100
	milliseconds.
	Drawback: there may be a slight waiting period between the clicking of the tab and the 
	appearance of the new content.
*/

Dashboard.prototype.loadContentInitialize = function () {
	currentDashboard = this;
	this.images = this.sourceFrame.getHTMLById('content').getElementsByTagName('img');
	if (!this.images.length) this.loadContent();
	this.checkNumberOfImages();
}

Dashboard.prototype.checkNumberOfImages = function()
{
	var numberOfImages = this.images.length;
	if (!this.images[0].readyState) // Mozilla
	{
		this.loadContent();
		return;
	}
	var imageCounter = 0;
	for (var i=0;i<numberOfImages;i++)
	{
		if (this.images[i].readyState == 'complete')
			imageCounter++;
	}
	if (imageCounter != numberOfImages)
		setTimeout('currentDashboard.checkNumberOfImages()',100)
	else
		this.loadContent();
	
}

/* Addition to dashboard to be able to switch between dashboards without reloading the content 
	 All elements that contain the content of a tab are given the id of the tab with the suffix
	 '_content'
   Addition by: M.P.Diepstra - Flexgem */
Dashboard.prototype.getTabContentElement = function() {
	var sTabID;
	var tabContent;
	if (this.selectedTab == null) {
		sTabID = this.tabId;
	} else {
		sTabID = this.tabs[this.selectedTab].id;
	}
	tabContent = document.getElementById(sTabID + "_content");
	if (!tabContent) {
		var tabContent = document.createElement('div');
		tabContent.className = "tabContent"
		tabContent.id = sTabID + "_content";	
		this.toolContainer.appendChild(tabContent);
	}
	return tabContent;
}
/* End ppkpatch */

/* MD: Changed the insert node to be one level below the tool container */
Dashboard.prototype.loadContent = function () {
	if (this.loadtext) {clearTimeout(this.loadtext);this.loadtext = null}
	var oInsert = this.getTabContentElement();
	oInsert.innerHTML = this.sourceFrame.getHTMLById('content').innerHTML;
	this.toolContainer.style.display = 'block';
	if (!this.home) this.createCloser();
	fill_db(this.tabId);	
}

/* MD: Changed the insert node to be one level below the tool container */
Dashboard.prototype.createCloser = function () {
	var c = document.createElement('div');
	c.id = 'db_close';
	c.onclick = createContextFunction(this, "close");
	this.getTabContentElement().appendChild(c);
}
Dashboard.prototype.getTabIndex = function (selected) {
	for (var i=0; i < this.tabs.length; i++) {
		if (this.tabs[i].id == selected) return i;
	}
	return 0;
}
/* MD: Added the hiding and showing of the tabContent of a deselected/selected tab */
Dashboard.prototype.selectTab = function (i) {
	if (this.selectedTab != null) {
		this.tabs[this.selectedTab].className = this.tabs[this.selectedTab].className.replace('selected', '');
		this.getTabContentElement().className = this.getTabContentElement().className.replace('selected', '');
	}
	this.tabs[i].className += 'selected';
	this.selectedTab = i;
	this.getTabContentElement().className += 'selected';
}
/* MD: Added deselecting the tabcontent element */
Dashboard.prototype.close = function () {
	if (this.selectedTab != null) {
		this.tabs[this.selectedTab].className = this.tabs[this.selectedTab].className.replace('selected', '');
		this.getTabContentElement().className = this.getTabContentElement().className.replace('selected', '');
	}
	this.selectedTab = null;
	this.toolContainer.style.display = 'none';
	if (!this.home) this.bottomImage.style.display = 'block';
}

function switchBox(action, element) {	
	
	if(action == 'show'){
		document.getElementById(element).style.display = 'block';
	}
	if(action == 'hide'){
		document.getElementById(element).style.display = 'none';
	}
	
}

function getAirportName(sAirport)
{
	var ret;
	
	ret = sAirport;
	
	// check for space bracket in the airport name
	var posBracket = sAirport.indexOf(" (");
	
	// if found, remove the end part to return only the city name 
	if (posBracket > 0)
	{
		ret = sAirport.substring(0, posBracket);
	}
	return ret;
}


function addURLParam(sURL, sParam, sValue)
{
	var strSep = "";
	
	strSep = "?";
	if (sValue != "")
	{
		if (sURL.indexOf("?") >= 0)
			strSep = "&";

		return (sURL + strSep + sParam + "=" + sValue);
	}
	else
		return (sURL);	

}

function doSubmitTP(appPageURL1, appPageURL2)
{
	var nrRooms, nrAdults, nrChildren, nrSeniors, pkgType;
	var i, n;
	var sBaseURL;
	
	// check to which URL we will submit
	nrRooms = document.frmTp.nrRooms.value;
	nrAdults = document.frmTp.nrAdults.value;
	nrSeniors = document.frmTp.nrSeniors.value;
	nrChildren = document.frmTp.nrChildren.value;

	// get the selected package type
	for (i=0, n=document.frmTp.arrangement.length; i<n; i++) 
	{
    		if (document.frmTp.arrangement[i].checked)
    		{
        		pkgType = document.frmTp.arrangement[i].value;
	        	break;
    		}
	}

	var origin = document.frmTp.origin.value;

	// the packages wizard needs a city name, so use this name without possible (airport name) in it
	var dest = getAirportName(document.frmTp.destination_free.value);
	var depDate = document.frmTp.departureDay.value + "/" + document.frmTp.departureMonthYear.value.substr(4) + "/" + document.frmTp.departureMonthYear.value.substring(0,4);
	var retDate = document.frmTp.returnDay.value + "/" + document.frmTp.returnMonthYear.value.substr(4) + "/" + document.frmTp.returnMonthYear.value.substring(0,4);

	if (dest == "Other")
	{
		sBaseURL = appPageURL2;
		sBaseURL = addURLParam(sBaseURL, "PackageType", pkgType);
		sBaseURL = addURLParam(sBaseURL, "FrAirport", origin);
		sBaseURL = addURLParam(sBaseURL, "DestID", dest);
		sBaseURL = addURLParam(sBaseURL, "FromDate", depDate);
		sBaseURL = addURLParam(sBaseURL, "ToDate", retDate);
		sBaseURL = addURLParam(sBaseURL, "NumAdult", nrAdults);
		sBaseURL = addURLParam(sBaseURL, "NumSenior", nrSeniors);
		sBaseURL = addURLParam(sBaseURL, "NumChild", nrChildren);
		sBaseURL = addURLParam(sBaseURL, "NumRoom", nrRooms);
	}
	else if (nrRooms >= 2 && nrAdults == 2 && nrChildren == 0 && nrSeniors == 0)
	{
		sBaseURL = appPageURL1;
		sBaseURL = addURLParam(sBaseURL, "PackageType", pkgType);
		sBaseURL = addURLParam(sBaseURL, "FrAirport", origin);
		sBaseURL = addURLParam(sBaseURL, "DestID", dest);
		sBaseURL = addURLParam(sBaseURL, "FromDate", depDate);
		sBaseURL = addURLParam(sBaseURL, "ToDate", retDate);
		sBaseURL = addURLParam(sBaseURL, "NumAdult", 2);
		sBaseURL = addURLParam(sBaseURL, "NumAdult1", 1);		
		sBaseURL = addURLParam(sBaseURL, "NumAdult2", 1);				
		sBaseURL = addURLParam(sBaseURL, "NumSenior", 0);
		sBaseURL = addURLParam(sBaseURL, "NumChild", 0);
		sBaseURL = addURLParam(sBaseURL, "NumRoom", 2);
	}
	else if (nrRooms <= 1 && nrAdults <= 3 && nrChildren == 0 && nrSeniors <= 3)
	{
		sBaseURL = appPageURL1;
		sBaseURL = addURLParam(sBaseURL, "PackageType", pkgType);
		sBaseURL = addURLParam(sBaseURL, "FrAirport", origin);
		sBaseURL = addURLParam(sBaseURL, "DestID", dest);
		sBaseURL = addURLParam(sBaseURL, "FromDate", depDate);
		sBaseURL = addURLParam(sBaseURL, "ToDate", retDate);
		sBaseURL = addURLParam(sBaseURL, "NumAdult", nrAdults);
		sBaseURL = addURLParam(sBaseURL, "NumSenior", nrSeniors);
		sBaseURL = addURLParam(sBaseURL, "NumChild", nrChildren);
		sBaseURL = addURLParam(sBaseURL, "NumRoom", nrRooms);
	}
	else
	{
		sBaseURL = appPageURL2;
		sBaseURL = addURLParam(sBaseURL, "PackageType", pkgType);
		sBaseURL = addURLParam(sBaseURL, "FrAirport", origin);
		sBaseURL = addURLParam(sBaseURL, "DestID", dest);
		sBaseURL = addURLParam(sBaseURL, "FromDate", depDate);
		sBaseURL = addURLParam(sBaseURL, "ToDate", retDate);
		sBaseURL = addURLParam(sBaseURL, "NumAdult", nrAdults);
		sBaseURL = addURLParam(sBaseURL, "NumSenior", nrSeniors);
		sBaseURL = addURLParam(sBaseURL, "NumChild", nrChildren);
		sBaseURL = addURLParam(sBaseURL, "NumRoom", nrRooms);
	}
	sBaseURL = addURLParam(sBaseURL, "rfrr", "-37510");

	document.frmTp.action = sBaseURL;
	document.frmTp.submit();
}

function doSubmitReservation(sUrl)
{
	document.res_book.action = sUrl;
	document.res_book.submit();
}

//
// DO NOT REMOVE THIS METHOD STUB PREVENTS IE6 CRASH AND FF EXCEPTION!!!
//
function init_tab() {}
// Content: js dashboard data
//20080122 HW: FM22978 hotels & cars dashboard changed
//20090218 SC:  FM 27269 Change ICI dashboard 

var months = [			
	['Jan','January'],
	['Fév','February'],
	['Mar','March'],
	['Avr','April'],
	['May','May'],
	['Juin','June'],
	['Juil','July'],
	['Août','August'],
	['Sep','September'],
	['Oct','October'],
	['Nov','November'],
	['Déc','December']];

function fillDataSelector(id, fullMonthNames, addDays) {
	var now = new Date();
	var start = new Date(now.getTime() + addDays * 3600 * 24 * 1000);
	var year = now.getFullYear();
	var month = now.getMonth();
	var selector = document.getElementById(id);
	for (c = 0; c < 12; c++) {
		var value = String(year) + String(month<9 ? "0" : "") + String(month + 1);
		var name = months[month][fullMonthNames ? 1:0] + " " + year;
		selector[c] = new Option(name, value);
		if (++month >= 12) {
			month = 0;
			year++;
		}
	}
	selector.selectedIndex = start.getYear() > now.getYear() ? 1 : (start.getMonth() > now.getMonth() ? 1 : 0);
}

function fillDaySelector(idDay, addDays) {
	var daySelector = document.getElementById(idDay);
	var index = 0;
	for (var c = 1; c <= 31; c++)
	{
		var value = String(c<=9 ? "0" : "") + String(c);
		daySelector.options[index++] = new Option(c, value);
	}	
}

function setDay(idDay, addDays) {
	var start = new Date(new Date().getTime() + addDays * 3600 * 24 * 1000);
	document.getElementById(idDay).selectedIndex = start.getDate() - 1;
}

function checkDepDate(dep_date, dep_month, ret_date, ret_month) {
	var dds = document.getElementById(dep_date);
	var rds = document.getElementById(ret_date);
	var dms = document.getElementById(dep_month);
	var rms = document.getElementById(ret_month);
	if (dms.selectedIndex > rms.selectedIndex ||  (dms.selectedIndex == rms.selectedIndex && dds.selectedIndex > rds.selectedIndex))
	{
		rms.selectedIndex = dms.selectedIndex;
		rds.selectedIndex = dds.selectedIndex;
	}	
}

function fillFromXml(file, id, className, addEmpty) {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", file ,false);
	xmlhttp.send(null);
	var dataDocument = xmlhttp.responseXML;
	var entries = dataDocument.getElementsByTagName('li');
	var selector = document.getElementById(id);
                if(selector != null) {
	var index = 0;
	if (addEmpty) {
		var option = new Option("", "");
		selector.options[index++] = option;
	}
	for (var i = 0; i < entries.length; i++)
	{
		if (entries[i].parentNode.attributes.length > 0 && entries[i].parentNode.attributes[0].nodeValue != className)
			continue;
		
		var name = entries[i].firstChild.data;
		var value = entries[i].attributes.length > 0 ? entries[i].attributes[0].nodeValue : name;
		var isDefault = entries[i].getAttribute("default") != null;
		if (value == "KL")
			isDefault = true;
		var option = new Option(name, value);
		if (isDefault) {
			option.selected = true;
			selector.options[index] = option;
			selector.selectedIndex = index++;
		} else {
			selector.options[index++] = option;		
		}
                       }
	}
}

function getBookingDelay(country) {
	var isIe = /MSIE [56789]/.test(navigator.userAgent) && (navigator.platform == "Win32");	
	try{
		var intReturn;
		var xmlhttp = getXmlHttp();
		xmlhttp.open("GET", "failed to retrieve 'Application File URL - Collection' of application 'EBT'", false);
		xmlhttp.send(null);

		//As IE has different XPath parsing support then mozilla based browsers, branch off IE here
		if (isIe && !document.implementation.hasFeature("XPath", "3.0")) {
			intReturn = getIEXmlAttrib(xmlhttp.responseXML, "//pointofsale[@code='" + country.toUpperCase() + "']", "defaultdeparturedate");
		} else {
			intReturn = getOtherXmlAttrib(xmlhttp.responseXML, "//pointofsale[@code='" + country.toUpperCase() + "']", "defaultdeparturedate");
		}
	} catch(e) {
	}

	if (!intReturn) {
		intReturn = 7;
	}
	return intReturn;
}

function getIEXmlAttrib(xmldoc, strNode, strAttrib) {
	return parseInt(xmldoc.selectSingleNode(strNode).getAttribute(strAttrib), 10);
}

function getOtherXmlAttrib(xmldoc, strNode, strAttrib) {
	return xmldoc.evaluate(strNode + "/@" + strAttrib, xmldoc, null, XPathResult.NUMBER_TYPE, null).numberValue;
}

function fill_ebt() {
	if (document.getElementById("klm-ebt") != null)
	{
		// ebt7
		var ebtPage = new EBTPage('klm-ebt');
		// add this line to determine POS.
		ebtPage.pos = 'FR';
		var fs = new DBFlightSearch('klm-ebt', '/passage/ebtui/inputsearchcriteria.ajax?posCode=FR&languageCode=fr', ebtPage, '/passage/ebtui/cabinclass.ajax?posCode=FR&languageCode=fr');
	}
	else
	{
		// ebt6
		var intBookingDelay = getBookingDelay('fr');
		fillDataSelector('dep_month', 0, intBookingDelay);
		fillDataSelector('ret_month', 0, intBookingDelay + 7);
		fillDataSelector('calendarmonth', 1, 0);

		fillDaySelector('dep_day', intBookingDelay);
		setDay('dep_day', intBookingDelay);
		fillDaySelector('ret_day', intBookingDelay + 7);
		setDay('ret_day', intBookingDelay + 7);

		new TravelAgent();

		var bbmember = getParameterTD("bb");
		if (bbmember) {
			document.book2.corporateSupport.checked = true;
		}	
	}
}

function fill_ici() {
	fillFromXml("/travel/xfd/ici/departures/fr/departures.xml", "flightnumb", "carriers", false);
}

function fill_ici_jffp() {
	var dateSelection = document.getElementById("ffSearchDay");
	var today = new Date();
	var tomorrow = new Date(today.getTime() + 24 * 3600000);
	var date0 = today.getDate() + " " + months[today.getMonth()][1];
	var date1 = tomorrow.getDate() + " " + months[tomorrow.getMonth()][1];
	dateSelection.options[0] = new Option(date0, 0);
	dateSelection.options[1] = new Option(date1, 1);
}

function fill_hc() {
	fillDataSelector('dep_month_other', 0, 0);
	fillDataSelector('ret_month_other', 0, 1);
	fillDataSelector('calendarmonth_other', 1, 0);
	fillDaySelector('dep_day_other', 0);
	setDay('dep_day_other', 0);
	fillDaySelector('ret_day_other', 1);
	setDay('ret_day_other', 1);
}

function fill_tp() {
	fillDataSelector('dep_month_other', 0, 7);
	fillDataSelector('ret_month_other', 0, 14);
	fillDataSelector('calendarmonth_other', 1, 0);
	fillDaySelector('dep_day_other', 7);
	setDay('dep_day_other', 7);
	fillDaySelector('ret_day_other', 14);
	setDay('ret_day_other', 14);
	new TPAgent();
}

/* TPAgent */
TPAgent = function() {
	var aRE = /^a$/i
	var travelagent = this;
	var traveldata = new TravelData();
	var origins = new Origins(document.getElementById("from_other"));
	
	var fillAirport = function(airport) {
		var from = document.getElementById("from_other");
		var fromClass = origins.classes[from[from.selectedIndex].value];
		travelagent.destination.value = airport;
		var xmlelem = traveldata.getAirport(airport);
		travelagent.dest_airportcode.value = xmlelem.getAttribute("code");
		travelagent.dest_classcode.value = xmlelem.getAttribute("class");
		// set classes
		travelagent.setClasses(fromClass, travelagent.dest_classcode.value);
	}
}

function fill_db(db_id) {
	switch(db_id)
	{
		case 'db_ebt':  // ebt7 code!
		case 'db_ebr':
			fill_ebt();
			break;
		case 'db_tt':
		case 'db_tt2':
			var interval = null;
			function initPageObject() 
			{
				try
				{
					Page.Init();
					if (interval != null)
						clearInterval(interval);
				}
				catch (e)
				{			
					if (interval == null)
					{
						interval = setInterval(initPageObject, 100);
					}
				}
			}
			initPageObject();
			break;
		case 'db_ici':
			fill_ici();
			doPrefill();
			break;
		case 'db_ici_jffp':
			fill_ici_jffp();
			break;
		case 'db_tp':
			fill_tp();
			break;
		case 'db_hc':
			fill_hc();
			break;
		case 'db_anc':
			new AncillarySearch();
			break;
	}
}

function getXmlHttp() {
	var xmlhttp;
	if (window.ActiveXObject) {
		try {
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
		} catch (e) {
			try {
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
			} catch (E) {
				xmlhttp=false
			}
		}
	}
	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	// In case xmlrpc is not supported we will fallback to the old method.
	if(!xmlhttp) {
		alert("incompatible browser version");
	}
	return xmlhttp;
}

function Transformer(xmlDocument, xslPath) {
	if (window.ActiveXObject) {
		return IETransformer(xmlDocument, xslPath);
	} else {
		return FFTransformer(xmlDocument, xslPath);
	}
}

function FFTransformer(xmlDocument, xslPath) {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", xslPath ,false);
	xmlhttp.send(null);
	var xsltProc = new XSLTProcessor();
	xsltProc.importStylesheet(xmlhttp.responseXML);
	var resultDoc =	xsltProc.transformToDocument(xmlDocument);
	var xmlSerial = new	XMLSerializer();
	return xmlSerial.serializeToString(resultDoc);
}

function IETransformer(xmlDocument, xslPath) {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", xslPath ,false);
	xmlhttp.send(null);
	return xmlDocument.transformNode(xmlhttp.responseXML);
}

function doPrefill() {
	var queryStr = unescape(window.location.search);
	var args;
	var tabToSelect = null;
	if (queryStr != "") {
		queryStr = queryStr.substr(1, queryStr.length);
		var pairs = queryStr.split("&"); //Separate name value pairs
		for (var i = 0; i < pairs.length; i++) {
			args = pairs[i].split("=");

			//ICI param conversion
			if (args[0] == 'eticketAirlineCode') {args[0]="flightnumb";}
			if (args[0] == 'eticketFlightNumber') {args[0]="flightnumb2";}

			var element = document.getElementById(args[0]);
			if (element) {
				try {
					element.value = args[1];
				} catch (e) {}
			}
		}
	}
}
// Content: js autofill
/* Obsolete in EBT 3 */
// Content: js myKLM
// JavaScript Document
// Start myKLM
var frame = null;

function triggerLoader(tD, requestId) {
	
	this.sT = null;
	this.pT = null;
	this.requestId = requestId;
	
	this.init = function (tD) {
		if (tD.className.indexOf('MYKLM') == -1) return false;
		var cD = tD.getElementsByTagName('div');
		for (var i=0;i<cD.length;i++) {
			if (cD[i].className.indexOf("t_s") != -1) this.sT = cD[i];
			if (cD[i].className.indexOf("t_p") != -1) this.pT = cD[i];

		}
		return true;
	}
	
	this.isTargeted = function () {
		return (getCookie("fbNumber") != null);	
	}
	
	this.showS = function() {
		this.sT.className = this.sT.className.replace(/t_s/gi, "t_s_display");
	}
	
	this.loadPT = function () {
		this.pT.className = this.pT.className.replace(/t_p/gi, "t_p_display");
		frame = document.createElement("iframe");
		var newFrame = frame;
		newFrame.className = "myklmframe";
		var link = this.pT.getElementsByTagName("a")[0];
		link.href = link.href + "&fbNumber=" + getCookie("fbNumber");
		link.href = link.href + "&requestId=" + this.requestId;
		link.href = link.href.replace("http:", document.location.protocol);
		newFrame.scrolling = "no";
		newFrame.frameBorder=0;
		newFrame.src = link.href;
		this.pT.appendChild(newFrame);
		this.pT.removeChild(link);
	}
	
	if (this.init(tD)) {
		if (this.isTargeted()) {
			this.loadPT();
		} else {
			this.showS();	
		}
	}
}

function setPTs() {
	var requestId = Math.random();
	if (document.getElementById('last')) {
		try {
			clearInterval(tt);
		} catch (e) {
		}
		var entries = document.getElementsByTagName('div');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className.indexOf('MYKLM') != -1) {
				var loader = new triggerLoader(entries[i], requestId);
			}
		}

	} else {
		return false;
	}
}

// As soon as the javascript load's we want to initialize the triggers.
var tt = setInterval('setPTs()', 50);

// End myKLM
// Content: js EBT dashboard
// 20080122 HW: FM22978 hotels & cars dashboard changed
// 20080325 AB: FM-23397- Add posibility for adding websensortag
// 20090729 Heiko, removed pixel_trigger_moniforce

function addEvent(elm, evt, fn) {
	if (elm.addEventListener) {
		elm.addEventListener(evt, fn, false);
		return true;
	}
	else if (elm.attachEvent) {
		var r = elm.attachEvent('on'+evt, fn);
		return r;
	}
	else {
		elm['on'+evt] = fn;
	}
}

function debug(msg) {
	if (!document.all) setTimeout(function() { throw new Error("[debug] " + msg); }, 0);
}

function getXmlHttp() {
	var xmlhttp;
	if (window.XMLHttpRequest) {
	  xmlhttp = new XMLHttpRequest();
	  if (xmlhttp.overrideMimeType) {xmlhttp.overrideMimeType('text/xml')};
	} else if (window.ActiveXObject) {
	  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  alert('Perhaps your browser does not support xmlhttprequests?');
	}
	return xmlhttp;
}
	
/* TravelAgent */
TravelAgent = function() {

	var aRE = /^a$/i

	var travelagent = this;
	var traveldata = new TravelData();
	var origins = new Origins(document.getElementById("from"));
	
	var fillAirport = function(airport) {
		var from = document.getElementById("from");
		var fromClass = origins.classes[from[from.selectedIndex].value];
		travelagent.destination.value = airport;
		var xmlelem = traveldata.getAirport(airport);
		travelagent.dest_airportcode.value = xmlelem.getAttribute("code");
		travelagent.dest_classcode.value = xmlelem.getAttribute("class");
		// set classes
		travelagent.setClasses(fromClass, travelagent.dest_classcode.value);
	}
	
	var selectAirportFromAutoFill = function(evt) {
		evt = (evt) ? evt : ((window.event) ? event : null);
		if (evt) {
		   	var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		   	if (elem && aRE.test(elem.nodeName)) {
				var airport = elem.innerHTML;
				fillAirport(airport);
				// close suggestions
				// 20070320 WvdH: added parentNode
				travelagent.dest_suggest.parentNode.style.display = "none";
				travelagent.dest_suggest.style.display = "none";
//start fm22162 
 	                                               var corporatecheck = document.getElementById('corporateSupport');
	                                               if (!corporatecheck) {
                                                                   document.getElementById('bluebiz').focus();
                                                               } 
                                                               else{
                                                                   document.getElementById('corporateSupport').focus();
                                                               }
//end  fm22162 
			}
		}
	}
	
	var selectAirportFromCountry = function(evt) {
		evt = (evt) ? evt : ((window.event) ? event : null);
		if (evt) {
		   	var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		   	if (elem) {
				var airport = travelagent.dest_airport.options[travelagent.dest_airport.selectedIndex].innerHTML;
				fillAirport(airport);
			   	closeFindDestination();
		   	}
		}
	}
	
	var navigateInDestinationList = function (evt) {
		if (traveldata) {
			evt = (evt) ? evt : ((window.event) ? event : null);
			if (evt && (evt.keyCode == 40 || evt.keyCode == 38 || evt.keyCode == 13)) {
				var as = travelagent.dest_suggest.childNodes;
				for (var i=0;i < as.length; i++) {
					var a = as[i];
					if (a.className == 'selected') {
						if(evt.keyCode == 40 && a.nextSibling != null) {
							a.className = "";
							a.nextSibling.className = "selected";    
							travelagent.dest_suggest.scrollTop = a.nextSibling.offsetTop - 20;
						}
						else if(evt.keyCode == 38 && a.previousSibling != null) {
							a.className = "";
							a.previousSibling.className = "selected";    
							travelagent.dest_suggest.scrollTop = a.previousSibling.offsetTop - 20;
						} 
						else if(evt.keyCode == 13) {
							a.className = "";
							var airport = a.innerHTML;
							fillAirport(airport);
							// 20070320 Wvdh: added parentNode 
							travelagent.dest_suggest.parentNode.style.display = "none";
							travelagent.dest_suggest.style.display = "none";
						}
						evt.cancelBubble = true;
						return false;
					}
				}
				if (as.length > 0 && evt.keyCode == 40) {
					as[0].className = 'selected';
					travelagent.dest_suggest.scrollTop = 0;
					return false;
				}
			}
		}
	}	

	var fillDestinations = function(evt) {
		// open suggestions
		if (traveldata) {
			evt = (evt) ? evt : ((window.event) ? event : null);
			if (evt) {
				if (evt.keyCode == 40 || evt.keyCode == 38 || evt.keyCode == 13) {
					return navigateInDestinationList(evt);
				}
				// fill box
				travelagent.removeDestinations();
				var searchString = travelagent.destination.value;
				if (searchString == "") {
				// 20070320 WvdH: added parentNode
					travelagent.dest_suggest.parentNode.style.display = "none";
					travelagent.dest_suggest.style.display = "none";
					if (evt.type == "keyup")
						travelagent.setClasses("all", "all");
					return;
				}
				var elems = traveldata.selectAirportData(searchString);
				if (elems.length > 0) {
					for (var i=0;i < elems.length; i++) {
						var a = document.createElement("a");
						a.setAttribute("href", "#");
						a.setAttribute("onclick", "return false;");
// start fm22162 
                                                                                                a.setAttribute("tabindex", i+7, ";");
// end  fm22162 
						a.innerHTML = elems[i];
						travelagent.dest_suggest.appendChild(a);
					}
					travelagent.dest_suggest.scrollTop = 0;
					// 20070320 WvdH: added parentNode
					travelagent.dest_suggest.parentNode.style.display = "block";
					travelagent.dest_suggest.style.display = "block";
				}
				else {
				  // 20070320 WvdH: added parentNode
					travelagent.dest_suggest.parentNode.style.display = "none";
					travelagent.dest_suggest.style.display = "none";
					//travelagent.setClasses("all", "all");
					return;
				}
			}
		}
	}
	
	/* Destination Finder */
	var showFindDestination = function(evt) {
		// fill only the first time
		if (travelagent.dest_country.childNodes.length < 5) {
			var elems = traveldata.getCountryData();
			if (elems.length > 0) {
				for (var i=0;i < elems.length; i++) {
					var tag = document.createElement("option");
					tag.innerHTML = elems[i];
					travelagent.dest_country.appendChild(tag);
				}
			}
		}
		var containerd = document.getElementById('destinationcontainer');
		if (document.all) {
			var entries = document.getElementsByTagName('select');
			for (var i = 0; i < entries.length; i++) {
				if (entries[i].className == 'dest_hide') {
					entries[i].style.display = 'none';
				}
			}
		}
		containerd.style.display = 'block';
// start fm22162 
                                document.getElementById('dest_country').focus();
// endfm22162 
	}
	var closeFindDestination = function(evt) {
		var containerd = document.getElementById('destinationcontainer');
		if (document.all) {
			var entries = document.getElementsByTagName('select');
			for (var i = 0; i < entries.length; i++) {
				if (entries[i].className == 'dest_hide') {
					entries[i].style.display = 'block';
				}
			}
		}
		containerd.style.display = 'none';
// start fm22162 
 	                                               var corporatecheck = document.getElementById('corporateSupport');
	                                               if (!corporatecheck) {
                                                                   document.getElementById('bluebiz').focus();
                                                               } 
                                                               else{
                                                                   document.getElementById('corporateSupport').focus();
                                                               }
// end  fm22162 
	}
	var findAirports = function(evt) {
		evt = (evt) ? evt : ((window.event) ? event : null);
		if (evt) {
		   	var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		   	if (elem) {
				var country = elem.options[elem.selectedIndex].innerHTML;
				var elems = traveldata.getAirportData(country);
				if (elems.length > 0) {
					travelagent.dest_airport.options.length = 0;
					for (var i=0;i < elems.length; i++) {
						var tag = document.createElement("option");
						tag.innerHTML = elems[i];
						travelagent.dest_airport.appendChild(tag);
					}
					// prefill first airport in form
					var default_airport = elems[0];
					fillAirport(default_airport);
				}
			}
		}
	}

	this.destination = document.getElementById("dest_fill");
	addEvent(this.destination, "focus", fillDestinations);
	addEvent(this.destination, "keyup", fillDestinations);
	
	this.dest_airportcode = document.getElementById("dest_code_fill");
	this.dest_classcode = document.getElementById("dest_class_fill");
	
	this.dest_country = document.getElementById("dest_country");
	addEvent(this.dest_country, "change", findAirports);
	
	this.dest_airport = document.getElementById("dest_airport");
	addEvent(this.dest_airport, "change", selectAirportFromCountry);
	
	this.sel = document.getElementById("sel");
	addEvent(this.sel, "click", selectAirportFromCountry);
	
	
	this.dest_suggest = document.getElementById("autofill");
	addEvent(this.dest_suggest, "click", selectAirportFromAutoFill);
	
	this.finddestination = document.getElementById("finddestination");
	addEvent(this.finddestination, "click", showFindDestination);
	
	this.closedestination = document.getElementById("closed");
	addEvent(this.closedestination, "click", closeFindDestination);
	
}

TravelAgent.prototype.removeDestinations = function() {
	var dest_suggest = document.getElementById("autofill");
	var elems = dest_suggest.childNodes;
	if (elems.length > 0) {
		for (var i=elems.length-1; i >= 0 ; i--) {
			//elems[i].innerHTML = "";
			elems[i].parentNode.removeChild(elems[i]);
		}
	}
}

TravelAgent.prototype.setClasses = function(classFrom, classTo) {


	var flyclass = document.getElementById("class");
	var index = Math.min(flyclass.selectedIndex, 1);
	flyclass.options.length = 1;
	var optionBF1 = new Option("Europe Select", "B", null, null);
	var optionBF2 = new Option("World Business Class", "B", null, null);
	if ((classFrom.toLowerCase() == "eur" && classTo.toLowerCase() == "eur") || classFrom.toLowerCase() == "all") flyclass.options[flyclass.options.length] = optionBF1;
	if (classFrom.toLowerCase() == "ica" || classTo.toLowerCase() == "ica" || classFrom.toLowerCase() == "all") flyclass.options[flyclass.options.length] = optionBF2;
	if (classFrom.toLowerCase() == "all")
		flyclass.selectedIndex = 0;
	else
		flyclass.selectedIndex = index;
}

/* origins selectbox */
Origins = function(selectBox) {
	
	var origins = this;
	
	//2006-09-26, BvD
	//var xmlurl = "/travel/xfd/ebt/origins/fr_fr/origins.xml";
	var xmlurl = "failed to retrieve 'Application File URL - Collection' of application 'EBT'"

	var xmlhttp = null;
	var classes = new Array();
	
	this.selectBox = selectBox;
	this.classes = classes;
	
	var processRequest = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			var selected = 0;
			var airports = xmlhttp.responseXML.getElementsByTagName("origin");
			for (var i=0; i < airports.length; i++) {
				var code = airports[i].getAttribute("code");
				origins.selectBox[i] = new Option(airports[i].firstChild.nodeValue, code, false, false);
				if (airports[i].getAttribute("default"))
					selected = i;
				classes[code]=airports[i].getAttribute("class");

			}
			origins.selectBox.selectedIndex = selected;
		}
	}

	xmlhttp = getXmlHttp();
	if (xmlhttp) {
		xmlhttp.onreadystatechange = processRequest;
		xmlhttp.open('GET', xmlurl, true);
		xmlhttp.send(null);
	}
}

/* TravelData */
TravelData = function(url) {
	
	var traveldata = this;

	//2006-09-26, BvD
	//var xmlurl = "/travel/xfd/ebt/destinations/fr_fr/showdestinations.xml";
	var xmlurl = "failed to retrieve 'Application File URL - Collection' of application 'EBT'"

	var xmlhttp = null;
	
	this.airportdata = new Array();
	this.countrydata = new Array();
	this.xmldata = null;
	
	var processRequest = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			traveldata.xmldata = xmlhttp.responseXML;
			traveldata.populateData();
		}
	}

	xmlhttp = getXmlHttp();
	if (xmlhttp) {
		xmlhttp.onreadystatechange = processRequest;
		xmlhttp.open('GET', xmlurl, true);
		xmlhttp.send(null);
	}
}

TravelData.prototype.populateData = function() {
	var elems;
	// put airport names is array for searching
	elems = this.xmldata.getElementsByTagName("airport");
	if (elems && this.airportdata && !this.airportdata.length > 0) {
		for (var i=0; i<elems.length; i++) {
			this.airportdata[i] = elems[i].firstChild.nodeValue;
		}
		this.airportdata.sort();
	}
	// put country names is array for searching
	elems = this.xmldata.getElementsByTagName("country");
	if (elems && this.countrydata && !this.countrydata.length > 0) {
		for (var i=0; i<elems.length; i++) {
			this.countrydata[i] = elems[i].getAttribute("name");
		}
		this.countrydata.sort();
	}
}

TravelData.prototype.selectAirportData = function(searchString) {
	// get subset of the airport array
	var selectedData = new Array();
	if (this.airportdata && this.airportdata.length > 0) {
		for (var i=0; i<this.airportdata.length; i++) {
			if (this.airportdata[i].toLowerCase().indexOf(searchString.toLowerCase()) == 0)
				selectedData.push(this.airportdata[i]);
			if (this.airportdata[i].substring(0,searchString.length).toLowerCase() > searchString.toLowerCase())
				return selectedData;
		}
	}
	return selectedData;
}

TravelData.prototype.getCountryData = function() {
	// get country array
	return this.countrydata;
}

TravelData.prototype.getAirportData = function(country) {
	// get country array
	var selectedData = new Array();
	var elem = this.getCountry(country);
	if (elem.childNodes.length > 0) {
		for (var i=0; i<elem.childNodes.length; i++) {
			if (elem.childNodes[i].tagName && elem.childNodes[i].tagName.toLowerCase() == "airport") 
				selectedData.push(elem.childNodes[i].firstChild.nodeValue);
		}
	}
	return selectedData;
}

TravelData.prototype.getAirport = function(airport) {
	var elems = this.xmldata.getElementsByTagName("airport");
	// get the xml node that belongs 2 value
	if (elems && this.airportdata.length > 0) {
		for (var i=0; i<elems.length; i++) {
			if (elems[i].firstChild.nodeValue.toLowerCase() == airport.toLowerCase())
				return elems[i];
		}
	}
	return null;
}

TravelData.prototype.getCountry = function(country) {
	var elems = this.xmldata.getElementsByTagName("country");
	// get the xml node that belongs 2 country
	if (elems) {
		for (var i=0; i<elems.length; i++) {
			if (elems[i].getAttribute("name").toLowerCase() == country.toLowerCase())
				return elems[i];
		}
	}
	return null;
}
//getElementsByClassName
function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : 
    oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function fareSelect() {
	var priceBlock = getElementsByClassName(document.getElementById("fares"), "div", "priceblock");
	for (var i=0;i<priceBlock.length;i++) {
		if(priceBlock[i].className != 'priceblock hover') {
			priceBlock[i].onmouseover = function() {
				addClass(this,'hover');
				var btn = this.getElementsByTagName("div");
				
			}
			priceBlock[i].onmouseout = function() {
				removeClass(this,'hover');
			}
			// follow link in priceblock select-button
			priceBlock[i].onclick = function(e) {
				var source = (e) ? e.target : window.event.srcElement;
				// only follow href when click did not originate from info button or called-up dialog
				if(
					(source.className != "info" && source.className != "clickable" && source.className != "moreinfo")
					&& !isChild(source, document.getElementById("frmPopup"))
				) {
					document.location = getElementsByClassName(this, "div", "btn-select")[0].getElementsByTagName("a")[0].href;
					return false;
				}
			}
		}
	}
}
isChild = function (ancestor, candidate) {
	if (!ancestor || !ancestor.parentNode || !candidate) return false;
	while (candidate && candidate != ancestor.parentNode) {
		if (candidate == ancestor) return true;
		try {
			candidate = candidate.parentNode;
		} catch (c) {return false}
	}
}
function calendarSelect() {
	var calendars = document.getElementById("calendars");
	var as = calendars.getElementsByTagName("span");
	for (i=0;i<as.length;i++) {
		if (as[i].id !="recalc") {		
			as[i].onmouseover = function() {
				addClass(this,'hover');
			}
			as[i].onmouseout = function() {
				removeClass(this,'hover');
			}
		}
	}
}
addClass=function(obj,cName) { 
	removeClass(obj,cName); 
	return obj.className+=(obj.className.length>0?' ':'')+cName; 
}

removeClass=function(obj,cName) {
	return obj.className=obj.className.replace(new RegExp("^"+cName+"\\b\\s*|\\s*\\b"+cName+"\\b",'g'),''); 
}

// type radio toggle
function toggleTypeMethod(inputname) {
	var paymentReg = new RegExp("^" + inputname + "$");///^paymenttype$/i;
	var radioReg = /^radio$/i;
	var tbodyReg = /^tbody$/i;
	var radios = document.getElementsByTagName("input");
	var currentFoldout = null;

	function toggleFoldout() {
		if(currentFoldout)	
			removeClass((currentFoldout),"show");
		var foldout = this;
		while(foldout&&!tbodyReg.test(foldout.nodeName)) foldout = foldout.parentNode;
		if(foldout) {
			addClass((currentFoldout = foldout),"show");
			//alert("toggle on " + inputname + " " + foldout.nodeName + foldout.className);
		}
	}
	//Search for radio buttons that habe  a name that equals [inputname] to initialise payment type toggle.
	for(var radio,i=0; i<radios.length; i++) {
		radio = radios.item(i);
		if(paymentReg.test(radio.name) && radioReg.test(radio.type) && radio.id) {
			radio.onclick = toggleFoldout;
			if(radio.checked) radio.onclick();
		}
	}
}
// Payment radio toggle
function togglePaymentMethod() {
	var trclassRE = /\bpaymentContainer\b/
	var trs = document.getElementsByTagName("tr");
	//Search for all tr elements with classname 'paymentContainer' to initialise payment type toggle
	for (var i = 0; i < trs.length; i++) {
		if (trclassRE.test(trs[i].className)) {
			togglePaymentByType(trs[i]);
		}
	}
}
function togglePaymentByType(typeO) {
	var paymentReg = /\bpayment/i;
	var radioReg = /^radio$/i;
	var radios = typeO.getElementsByTagName("input");
	var currentFoldout = null;

	function toggleFoldout() {
		if(currentFoldout)	
			removeClass((currentFoldout),"show");
		var foldout = this.parentNode;
		while (foldout&&!paymentReg.test(foldout.className)) foldout = foldout.parentNode;
		if(foldout) {
			addClass((currentFoldout = foldout),"show");
		}
	}
	//Search all radio buttons with a name that starts with 'payment' to initialize payment toggle.
	for(var radio,i=0; i<radios.length; i++) {
		radio = radios.item(i);
		if(paymentReg.test(radio.name) && radioReg.test(radio.type)) {
			radio.onclick = toggleFoldout;
			if(radio.checked) radio.onclick();
		}
	}
}
// Payment radio value storage
function storePaymentMethod() {
	var classRE = /\bpayfinal\b/
	var inputs = document.getElementsByTagName("input");
	//Search for all input elements with classname 'payfinal' to initialise payment type storage
	for (var i = 0; i < inputs.length; i++) {
		if (classRE.test(inputs[i].className)) {
			paymentStore(inputs[i]);
		}
	}
}

function paymentStore(input) {
	var tbody = input.parentNode;
	var tbRE = /^tbody$/i;
	while (tbody.parentNode && !tbRE.test(tbody.nodeName)) tbody = tbody.parentNode;
	function storeValue(e) {
		var e = e||event;
		var target = e.target||e.srcElement;
		if (target&&target.type&&target.type=="radio") {
			input.value = target.value;
			//alert(input.value);
		}
	}
	if (tbody.parentNode) tbody.onclick = function (e) {
		storeValue(e);
	};
}

function openPopup() {
	var infos = getElementsByClassName(document.getElementById("fares"), "img", "info");
	for (i=0;i<infos.length;i++) {
		infos[i].onclick = function(e) {
			document.getElementById("faresPopup").style.display = "block";
			var inputs = getElementsByClassName(document.getElementById("choosedates"), "span", "bgradio");
			for(var i=0; i<inputs.length; i++){
				inputs[i].style.zIndex = "-1";
			}
			return false;
		}
	} return false;
}
function closePopup() {
	var closer = getElementsByClassName(document.getElementById("faresPopup"), "a", "closefarespopup");
	for (i=0;i<closer.length;i++) {
		closer[i].onclick = function(e) {
			document.getElementById("faresPopup").style.display = "none";
			var inputs = getElementsByClassName(document.getElementById("choosedates"), "span", "bgradio");
			for(var i=0; i<inputs.length; i++){
				inputs[i].style.zIndex = "1";
			}
			return false;
		}
	} return false;
}
function toggleBreakdown() {
	var breakdownlink = document.getElementById("breakdown_link");
	var breakdown = document.getElementById("breakdown");
	breakdownlink.onclick = function() {
		var currentValue = breakdown.style.display;
		var newValue = (currentValue == "block") ? "none" : "block";
		breakdown.style.display = newValue;
		return false;
	}
}
function toggleBreakdownup() {
	var breakdownlinkup = document.getElementById("breakdown_link_up");
	var breakdownup = document.getElementById("breakdown_up");
	breakdownlinkup.onclick = function() {
		var currentValue = breakdownup.style.display;
		var newValue = (currentValue == "block") ? "none" : "block";
		breakdownup.style.display = newValue;
		return false;
	}
}
function availableTime() {
	var trs = document.getElementById("choosedates").getElementsByTagName("tr");
	for (i=0;i<trs.length;i++) {
		trs[i].onmouseover = function() {
			if(this.className.indexOf(' double') > 0) {
				addClass(this,'sel');
				addClass(this.parentNode.rows[this.rowIndex+1],'sel');
			}
			if(this.className.indexOf(' continued') > 0) {
				addClass(this,'sel');
				addClass(this.parentNode.rows[this.rowIndex-1],'sel');
			}
			else {
				addClass(this,'sel');
			}
		}
		trs[i].onmouseout = function() {
			if(this.className.indexOf(' double') > 0) {
				removeClass(this,'sel');
				removeClass(this.parentNode.rows[this.rowIndex+1],'sel');
			}
			if(this.className.indexOf(' continued') > 0) {
				removeClass(this,'sel');
				removeClass(this.parentNode.rows[this.rowIndex-1],'sel');
			}
			else {
				removeClass(this,'sel');
			}
		}
	}
}

var allContainers = new Array;
function popupMenu(oLoc, title, body){
	var oFrm = document.getElementById("frmPopup");
	oFrm.getElementsByTagName("SPAN")[0].lastChild.nodeValue = title;
	oFrm.getElementsByTagName("DIV")[0].innerHTML = body;
	oLoc.parentNode.insertBefore(oFrm, oLoc);
	addClass(oFrm,"show");
	return false;
}

function frmAlertClose() {
	var frmAlert = document.getElementById("frmAlert");
	var frmAlertX = frmAlert.getElementsByTagName('a');
	for (i=0;i<frmAlertX.length;i++) {
		frmAlertX[i].onclick = function() {
			frmAlert.style.display = "none";
			return false;
		}
	}
}
function showBluebiz() {
	var bbcheck = document.getElementById('corporateSupport');
	if (!bbcheck.checked) {
		document.getElementById('bluebiznr').style.display = 'none';
	}
	else {
		document.getElementById('bluebiznr').style.display = 'block';
	}
	return false;
}
function emptyBluebiz() {
	var nr = document.getElementById('bluebiznr');
	if (nr == null)
		return false;
	if(nr.value == 'Votre numéro BlueBiz') nr.value = '';
	return false;
}
function fillinBluebiz() {
	var nr = document.getElementById('bluebiznr');
	if(nr.value == '') nr.value = 'Votre numéro BlueBiz';
	return false;
}
function syncDate(origin) {
	var depDay = document.getElementById('dep_day');
	var depMonth = document.getElementById('dep_month');
	var retDay = document.getElementById('ret_day');
	var retMonth = document.getElementById('ret_month');
	if((depMonth.options.selectedIndex == retMonth.options.selectedIndex && depDay.options.selectedIndex > retDay.options.selectedIndex) || depMonth.options.selectedIndex > retMonth.options.selectedIndex) {
		if(origin == depDay || origin == depMonth) {
			retDay.selectedIndex = depDay.selectedIndex;
			retMonth.selectedIndex = depMonth.selectedIndex;
		} else {
			depDay.options.selectedIndex = retDay.options.selectedIndex;
			depMonth.options.selectedIndex = retMonth.options.selectedIndex;			
		}
	}
}

function syncDate_other(origin) {
	var depDay = document.getElementById('dep_day_other');
	var depMonth = document.getElementById('dep_month_other');
	var retDay = document.getElementById('ret_day_other');
	var retMonth = document.getElementById('ret_month_other');	
	
	if( depMonth.options.selectedIndex > retMonth.options.selectedIndex){
		retMonth.options.selectedIndex = depMonth.options.selectedIndex;	
	}
	if( depMonth.options.selectedIndex == retMonth.options.selectedIndex){
		if (depDay.options.selectedIndex >= retDay.options.selectedIndex ){
			if (depDay.options.selectedIndex == 30){
				retDay.options.selectedIndex = 0;
				if ((depMonth.options.selectedIndex) == 11){
					retDay.options.selectedIndex = 30;
					retMonth.options.selectedIndex = 11 ;				
				}
				else{
					retMonth.options.selectedIndex = depMonth.options.selectedIndex + 1 ;
				}
			}
			else{
				retDay.options.selectedIndex = depDay.options.selectedIndex + 1;
				retMonth.options.selectedIndex = depMonth.options.selectedIndex;
			}
		}  
	}
}

function closePopupHandler(e) {
	var e = e||event;
	var target = e.target||e.srcElement;
	while (target.nodeType > 1) target = target.parentNode;
	
	if ((target.nodeName == "A" || target.nodeName == "a") && target.rel == "closePopup") {
		var popup = target	;
		var showRE = / ?\bshow\b/i
		while(!showRE.test(popup.className) && popup.parentNode) popup = popup.parentNode;
		removeClass(popup, "show");
		return cancelEvent(e);
	}
	else return true;
}

addEventHandler(document,"click", closePopupHandler);

function ChooseFlights(id) {
	this.calendar = document.getElementById(id);
	var self = this;
	addEventHandler(this.calendar, "click", function(e) {
		self.clickHandler(e);
	});
}

ChooseFlights.prototype = {
	aRE:/^a$/i,
	trRE:/^tr$/i,
	atRE:/^availabletime/,
	dblRE:/double/,
	dblCRE:/continued/,
	currentRE:/ ?\bcurrent\b/i,
	clickHandler:function(e) {
		var e = e||event;
		var target = e.target||e.srcElement;

		while (target.nodeType>1)target = target.parentNode; //Safari targets textnodes.

		if (this.aRE.test(target.nodeName)) {//It's a link, change fare's filter
			var aParent = target.parentNode;
			var as = aParent.getElementsByTagName("a");

			//Purge calendar of current filter
			for (var i=0; i < as.length; removeClass(this.calendar, as.item(i++).className));

			//Add filter to calendar
			addClass(this.calendar, target.className);

			//Cancel clickevent
			return cancelEvent(e);
		} else { //Somewhere else, look for a table-row
			while(!this.trRE.test(target.nodeName)&&target.parentNode) target = target.parentNode;
			if (this.atRE.test(target.className)) { //It's a time tabelrow
				//Check if it's second of doublerow, ifso get it's previousSibling.
				if (this.dblCRE.test(target.className)) target = target.parentNode.rows[target.rowIndex-1];

				//Get the second tablerow of a doublerow
				var target2 = null;
				if (this.dblRE.test(target.className)) target2 = target.parentNode.rows[target.rowIndex+1];

				//Get the radiobutton
				var radio = target.getElementsByTagName("input").item(0);

				//'de-select' current selected nodes.
				var tParent = target.parentNode;
				for (i=0; i<tParent.rows.length; i++) {
					var row = tParent.rows[i];
					if (this.currentRE.test(row.className)) row.className = row.className.replace(this.currentRE,"");
				}

				//Set selected state and select radio
				addClass(target," current");
				if (target2!=null) {
					//Remove lingering hover class
					removeClass(target2,"sel");
					//Add current class
					addClass(target2," current");
				}
				radio.checked = true;

				//Enable recalc button?
				var button = document.getElementById("recalcon");
				addClass(button, "enable");
				
				//Cancel original click
				//return cancelEvent(e);
			}
		}
		return true;
	}
}
BreakdownHandler  = {
	aRE:/^a$/i,
	bdRE:/\bbreakdown_link\b/,
	showRE:/ ?\bshow\b/,
	clickHandler:function(e){
		var e = e||event;
		var target=e.target||e.srcElement;
		while (target.nodeType > 1) target = target.parentNode; //Get element, Safari fires on text_nodes.
		
		if (this.aRE.test(target.nodeName)&&this.bdRE.test(target.className)) { //It's a breakdown_link.
			//Get relevant information and nodes
			var toggle = target.parentNode;
			var targetId = target.getAttribute("href");
			targetId = targetId.substring(targetId.indexOf("#") + 1);
			var targetBreakdown = document.getElementById(targetId);
			var altTextNode = toggle.getElementsByTagName("span").item(0);
			var text = target.firstChild;
			var altText = altTextNode.firstChild;
			
			//Toggle the status of relevant breakdown
			if (this.showRE.test(targetBreakdown.className)){
				targetBreakdown.className = targetBreakdown.className.replace(this.showRE,"");
				toggle.className = toggle.className.replace(this.showRE,"");
			} else {
				targetBreakdown.className+=" show";
				toggle.className+=" show";
			}
			
			//Switch the textnodes.
			target.appendChild(altText);
			altTextNode.appendChild(text);
			
			return cancelEvent(e);
		}
	}	
}

addEventHandler(document, "click", function(e) {
	BreakdownHandler.clickHandler(e);
});

function doSubmitEBT(sCmd, sUrl)
{
	emptyBluebiz();
	document.book2.commandToExecute.value = sCmd;
	document.book2.action = sUrl;
	if (document.book2.destination.value == "") {
		document.book2.destination.value = document.book2.destination_free.value;
	}
	document.book2.productTypeCabin.value = document.book2.productType.value.substring(0,1);
	document.book2.productTypeCondition.value = document.book2.productType.value.substring(1);
	document.book2.submit();
}

function doSubmitHC(sUrl,imageparams)
{
	document.bookhotel.For.value = "City," + document.bookhotel.destination.value;
	document.bookhotel.DateRange.value = document.bookhotel.FromD.value + "-" + document.bookhotel.FromYM.value.substr(4,2) +"-"+ document.bookhotel.FromYM.value.substr(0,4) + "," + document.bookhotel.ReturnD.value  + "-" +   document.bookhotel.ReturnYM.value.substr(4,2) + "-" + document.bookhotel.ReturnYM.value.substr(0,4) ;

	document.bookhotel.submit();		
}
// Content: js calendar
/* calendar functions */
var type = '';
var days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];

function showCalendar(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer');
	var header = document.getElementById('calendartop');
	header.innerHTML = txt; 
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month').options.selectedIndex;
	document.getElementById('calendarmonth').options.selectedIndex = index;
	updateMonth(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
                document.getElementById('calendarmonth').focus();
}

function showCalendar_other(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer_other');
	var header = document.getElementById('calendartop_other');
	header.innerHTML = txt;
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month_other').options.selectedIndex;
	document.getElementById('calendarmonth_other').options.selectedIndex = index;
	updateMonth_other(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
  document.getElementById('calendarmonth_other').focus();
}

function fill(type, day, month) {
	closeCalendar();
	document.getElementById(type + '_day').options.selectedIndex = day;
	document.getElementById(type + '_month').options.selectedIndex = month;
	syncDate(document.getElementById(type + '_month'));
	if (type=='dep'){document.getElementById('ret_day').focus();}
	if (type=='ret') {document.getElementById('on').focus();}
}

function fillother(type, day, month) {
	closeCalendar_other();
	document.getElementById(type + '_day_other').options.selectedIndex = day;
	document.getElementById(type + '_month_other').options.selectedIndex = month;
	syncDate_other(document.getElementById(type + '_month_other'));
	if (type=='dep'){document.getElementById('ret_day_other').focus();}
	if (type=='ret') {document.getElementById('default').focus();}	
}

function closeCalendar () {
	var container = document.getElementById('calendarcontainer');
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function closeCalendar_other () {
	var container = document.getElementById('calendarcontainer_other');
		
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function updateMonth(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth(month, firstDay, noOfDays, selection);
}

function updateMonth_other(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth_other(month, firstDay, noOfDays, selection);
}
function getNumberOfDays(m, y) {
	var days = 31;
	switch (parseInt(m, 10)) {
		case 4: case 6: case 9: case 11:
			days = 30;
			break;
		case 2:
		  if ((y % 4 == 0) ^ (y % 100 == 0) ^ (y % 400 == 0))
			days = 29;
		  else
			days = 28;
		  break;
	}
	return days;
}
function getFirstDay(m, y) {
	d = new Date(y, m-1, 1);
	d.setHours(12);
	return (d.getDay() - 1 >= 0 ? d.getDay() - 1 : d.getDay() + 6);
}
function fillMonth(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fill(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');">' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable').innerHTML = sHTML;
}

function fillMonth_other(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fillother(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');" tabindex=301>' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable_other').innerHTML = sHTML;
}

function RecalcCalendar(id,days) { //,matchdates) {
	this.calendar = document.getElementById(id);
	this.days = days||new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
	/*this.minMatch = false;
	this.maxMatch = false;
	if (matchdates!=null) {
		if (matchdates.minMatch!=null) {
			this.minMatch = true;
			this.matchCalendar = document.getElementById(matchdates.minMatch);
		} else if(matchdates.maxMatch!=null) {
			this.maxMatch = true;
			this.matchCalendar = document.getElementById(matchdates.maxMatch);
		}
	}*/
	var self = this;
	addEventHandler(this.calendar, "click", function(e) {
		return self.clickHandler(e);
	});
}

RecalcCalendar.prototype = {
	aRE:/a/i,
	relRE:/date/i,
	divRE:/div/i,
	dateRE:/\b[0-9]{1,2}\b/,
	dayRE:/^[^ ]*/,
	clickHandler:function(e) {
		var e = e||event;
		var target = e.target||e.srcElement;
		var eventResult = true;

		while (target.nodeType>1)target = target.parentNode; //Safari targets textnodes.

		if (this.aRE.test(target.nodeName) && this.relRE.test(target.getAttribute("rel"))) {//It's a date link
			//de-select current date
			var selSpans = getElementsByClassName(this.calendar, "span", "sel");
			removeClass(selSpans[0], "sel");

			//select current date
			var span = target.parentNode;
			addClass(span, "sel");

			//change date-string
			var div = target;
			while (div.parentNode && !this.divRE.test(div.nodeName)) div = div.parentNode;
			if (this.divRE.test(div.nodeName)) {
				var strong = div.getElementsByTagName("strong").item(0);
				var sDate = strong.firstChild.nodeValue;
				sDate = sDate.replace(this.dateRE, target.firstChild.nodeValue);

				//count how many-eth day this is
				var td = target.parentNode.parentNode;
				var day = this.days[td.cellIndex];
				sDate = sDate.replace(this.dayRE, day);
				strong.replaceChild(document.createTextNode(sDate),strong.firstChild);
			} else alert("Could not find a div");

			//set variable on button-action
			var button = document.getElementById("recalcon"), buttonlink = button.getElementsByTagName("a").item(0), buttonhref = buttonlink.getAttribute("href"), href="";
			var re = new RegExp("([\\?&]" + this.calendar.id + "=)[^&]*");
			if (re.test(buttonhref)) {
				href = buttonhref.replace(re, "$1" + target.firstChild.nodeValue);
			} else {
				href = buttonhref + (buttonhref.indexOf("?")>0?"&":"?") + this.calendar.id + "=" + target.firstChild.nodeValue;
			}
			buttonlink.setAttribute("href",href);

			//enable recalcButton
			addClass(button, "enable");
			//cancel original event
			eventResult = cancelEvent(e);
		}
		return eventResult;
	}
}
// Content: js bluebiz interaction
// Content: js bluebiz interaction
// BlueBiz additions : Marcel Diepstra
// 20071214 pl: CM 22857 due to change from http to https, not all cookies were erased here.
// 20080204 cb: CM 23400 Interaction BlueBiz and Framesizer: Remove framesizer adding from initBlueBizApp

function trim(str)
{
	 if ((str == null) || (str == '')) {
	 	return '';
	 } else {
	   return str.replace(/^\s*|\s*$/g,"");
  }
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}
function loadHref(sHref, bForward) {
	var sForwardURL = "";
	if (bForward) {
		// Forward the current url, to the next, but only if there isn't already a forward url in the request
		sForwardURL = location.search;
		if (sForwardURL.indexOf("?forwardurl=") == -1) {
			var iPathStart = location.pathname.indexOf('/travel');
			iPathStart = (iPathStart == -1) ? 0 : '/travel'.length;
			var sPathName = escape(location.pathname.substring(iPathStart));
		 	if (sForwardURL == "") {
				sForwardURL = "?forwardurl=" + sPathName;
			} else {
				sForwardURL = "?forwardurl=" + sPathName + "&" + sForwardURL.substring(1);
			}
		}
	}
	if (sHref == location.protocol + "//" & location.host + "/" + location.pathname) {
		location.reload(true);
	} else {
		location.href = sHref + sForwardURL;
	}
}


var lBlueBizWaitCounter = 0;
var sBlueBizMainPage = ""
var sBlueBizErrorPage = "";
var sBlueBizExpiredPage = "";
var sBlueBizLockedOut = "";
var sBlueBizLoggedIn = "";
function retrieveBlueBizLogin(oForm, sErrorPage, sMainPage, sExpiredPage, sLockedOutPage, sLoggedInPage) {
	// Kill existing login related cookies
	eraseCookie("klmcomcaas");
	eraseCookie("KLMCOM_SESSIONCOOKIE");
	eraseCookie("PD-H-SESSION-ID");  // clear http - non secure cookie
	eraseCookie("PD-S-SESSION-ID");  // pl clear https - secure cookie
	eraseCookie("MfTrack_js");
	
	
	// Set redirect pages
	if (sBlueBizErrorPage == "") sBlueBizErrorPage = location.protocol + "//" + location.host + sErrorPage;
	if (sBlueBizMainPage == "") sBlueBizMainPage = location.protocol + "//" + location.host + sMainPage
	if (sBlueBizExpiredPage == "") sBlueBizExpiredPage = location.protocol + "//" + location.host + sExpiredPage;
	if (sBlueBizLockedOut == "") sBlueBizLockedOut = location.protocol + "//" + location.host + sLockedOutPage;
	if (sBlueBizLoggedIn == "") sBlueBizLoggedIn = location.protocol + "//" + location.host + sLoggedInPage;
	
	//oRemember = document.getElementById("rememberbblogin")
	if (oForm != null) {
		oRemember = oForm.elements["rememberbblogin"];
		if ((oRemember != null) && (oRemember.checked == true)) {
			createCookie("rememberbblogin",oRemember.checked,3650);
			createCookie("bbloginname", oForm.elements["username"].value, 3650);
		} else {
			eraseCookie("rememberbblogin");
			eraseCookie("bbloginname");
		}
	}
	retrieveBlueBizLogin2();
}
function retrieveBlueBizLogin2() {
	var sHTML;
	var oFrameDoc = document.getElementById('hiddenframe').contentDocument;
	if (oFrameDoc == null) oFrameDoc = document.frames('hiddenframe').document;
	if (oFrameDoc.getElementsByTagName('body').length == 0) {
		sHTML = ' ';
	} else {
		sHTML = oFrameDoc.getElementsByTagName('body')[0].innerHTML;
	}
	if ((trim(sHTML) == '')){
		setTimeout('retrieveBlueBizLogin2()', 100);
	} else {
		// Found response from WebSeal, interpret and remove traces from frame
		sHTML = oFrameDoc.documentElement.innerHTML;
		respondToLoginResult(sHTML);
		lBlueBizWaitCounter = 0;
		oFrameDoc.write("");
		oFrameDoc.close(); 
	}
}
var gExpiredForm = "";
function respondToLoginResult(sResult) {
  if (sResult.indexOf("login_success") > -1) {
		// Succesfull login, load logged in page, if current page doesn't contain a redirect
		if (location.search.indexOf("forwardurl=") == -1) {
			loadHref(sBlueBizLoggedIn, false);
		} else {
			loadHref(location.href, false);
		}
  } else if (sResult.indexOf("HPDIA0200W") > -1) {
		// Invalid login, go to error page
		loadHref(sBlueBizErrorPage, true);
	} else if (sResult.indexOf("HPDIA0204W") > -1) {
		// Expired login, put the result in an iframe in the main screen and clear the current cookies which has been set
		// by the last login attempt.
		eraseCookie("klmcomcaas");
		eraseCookie("KLMCOM_SESSIONCOOKIE");
		eraseCookie("PD-H-SESSION-ID");  // clear http - non secure cookie
		eraseCookie("PD-S-SESSION-ID");  // pl clear https - secure cookie 
		eraseCookie("MfTrack_js");
		
		var oInsert = document.getElementById("content");
		gExpiredForm = sResult;
		oInsert.innerHTML = '<iframe id="extFrame" name="extFrame" src="/travel/nl_nl/static/empty.html" scrolling="no" frameborder="no" width="568" height="600" onload="parent.placeExpiredForm()"></iframe>';
		document.getElementById('bbloginbox').target='extFrame';
		document.getElementById('bbloginbox').submit();
		
		//loadHref(sBlueBizExpiredPage, true);
	} else if ((sResult.indexOf("pkmslogout") > -1) && (sResult.indexOf("pkmspasswd") > -1)) {
		// Duplicate login, reload current page
		loadHref(location.href, false)
	} else if (sResult.indexOf("logged out") > -1) {
		// User logged out, return to bluebiz main page and clear CAAS cookie
		eraseCookie("klmcomcaas");
		eraseCookie("KLMCOM_SESSIONCOOKIE");
		eraseCookie("PD-H-SESSION-ID");   // clear http - non secure cookie
		eraseCookie("PD-S-SESSION-ID");   // pl clear https - secure cookie 
		eraseCookie("MfTrack_js");
		loadHref(sBlueBizMainPage, false);
	} else if (sResult.indexOf("locked out") > -1) {
		// User locked out, due to too many failed logins
		loadHref(sBlueBizLockedOut, true);
	} else {
		// Unexpected error, maybe timeout in CAAS
		loadHref(sBlueBizErrorPage, true);
	}
}

function initBlueBizAppFrame() {
}

window.setTimeout('tryResizeCaller()', 100);
window.setTimeout('resizeThreeColumnOverview()', 100);

function tryResizeCaller() {
   try {
      resizeCaller();
   } catch(e) {
   		// Do nothing
   } finally {
      window.setTimeout('tryResizeCaller()', 100);
   }
}
function resizeThreeColumnOverview() {
	try {
   		var oNodes = document.getElementById('triggerhome').childNodes;
   		var oContentHeight = 0;
   		for (var i=0;i < oNodes.length; i++) {
   			if ((oNodes[i].tagName) && (oNodes[i].tagName.toLowerCase() == "div")) {
   				if (oContentHeight < oNodes[i].offsetHeight) {
   					oContentHeight = oNodes[i].offsetHeight;
	   			}
   			}
   		}
   		for (var i=0;i < oNodes.length; i++) {
   			if ((oNodes[i].tagName) && (oNodes[i].tagName.toLowerCase() == "div")) {
   				oNodes[i].style.height = oContentHeight + "px";
   			}
   		}
  } catch(e) {
  	window.setTimeout('resizeThreeColumnOverview()', 100);
	}	
}
// Content: js forms
// this function removes all blanks from an input field.
function removeblanks()
{
  var arrReturnElements = getElementsByClassName(document.getElementById('tdsForm'),'input','removeblanks');
  
	for(var i=0; i<arrReturnElements.length; i++)
	{
		var y = arrReturnElements [i].value;
		y = y.replace(/\s/g,"");                             // replace all blanks in a string
		arrReturnElements[i].value = y;
	}    
}

function AddFormNamesForWebtrends()
{

	formContent=document.getElementById("tdsForm");
	var elements=formContent.getElementsByTagName("select");
	for (var i=0; i<elements.length;i++) {
		_metron.measureVariable("si_n", elements[i].getAttribute("name")); 
		_metron.measureVariable("si_x", elements[i].value);
	}

	formContent=document.getElementById("tdsForm");
	var elements=formContent.getElementsByTagName("input");
	for (var i=0; i<elements.length;i++) {
		if (elements[i].getAttribute("type") == "radio") {
			if (elements[i].checked ) {
				_metron.measureVariable("si_n", elements[i].getAttribute("name")); 
				_metron.measureVariable("si_x", elements[i].getAttribute("value"));
			}
		}
		else {
			_metron.measureVariable("si_n", elements[i].getAttribute("name")); 
			_metron.measureVariable("si_x", elements[i].getAttribute("value"));
		}
	}
}

// Content: yahoo-dom-event-new
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var D={},B=arguments;for(var C=0,A=B.length;C<A;C=C+1){YAHOO.lang.augmentObject(D,B[C],true);}return D;},later:function(H,B,I,D,E){H=H||0;B=B||{};var C=I,G=D,F,A;if(YAHOO.lang.isString(I)){C=B[I];}if(!C){throw new TypeError("method undefined");}if(!YAHOO.lang.isArray(G)){G=[D];}F=function(){C.apply(B,G);};A=(E)?setInterval(F,H):setTimeout(F,H);return{interval:E,cancel:function(){if(this.interval){clearInterval(A);}else{clearTimeout(A);}}};},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.4.1",build:"742"});(function(){var B=YAHOO.util,L,J,H=0,K={},F={},N=window.document;var C=YAHOO.env.ua.opera,M=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var O=function(Q){if(!E.HYPHEN.test(Q)){return Q;}if(K[Q]){return K[Q];}var R=Q;while(E.HYPHEN.exec(R)){R=R.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}K[Q]=R;return R;};var P=function(R){var Q=F[R];if(!Q){Q=new RegExp("(?:^|\\s+)"+R+"(?:\\s+|$)");F[R]=Q;}return Q;};if(N.defaultView&&N.defaultView.getComputedStyle){L=function(Q,T){var S=null;if(T=="float"){T="cssFloat";}var R=N.defaultView.getComputedStyle(Q,"");if(R){S=R[O(T)];}return Q.style[T]||S;};}else{if(N.documentElement.currentStyle&&G){L=function(Q,S){switch(O(S)){case"opacity":var U=100;try{U=Q.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(T){try{U=Q.filters("alpha").opacity;}catch(T){}}return U/100;case"float":S="styleFloat";default:var R=Q.currentStyle?Q.currentStyle[S]:null;return(Q.style[S]||R);}};}else{L=function(Q,R){return Q.style[R];};}}if(G){J=function(Q,R,S){switch(R){case"opacity":if(YAHOO.lang.isString(Q.style.filter)){Q.style.filter="alpha(opacity="+S*100+")";if(!Q.currentStyle||!Q.currentStyle.hasLayout){Q.style.zoom=1;}}break;case"float":R="styleFloat";default:Q.style[R]=S;}};}else{J=function(Q,R,S){if(R=="float"){R="cssFloat";}Q.style[R]=S;};}var D=function(Q,R){return Q&&Q.nodeType==1&&(!R||R(Q));};YAHOO.util.Dom={get:function(S){if(S&&(S.tagName||S.item)){return S;}if(YAHOO.lang.isString(S)||!S){return N.getElementById(S);}if(S.length!==undefined){var T=[];for(var R=0,Q=S.length;R<Q;++R){T[T.length]=B.Dom.get(S[R]);}return T;}return S;},getStyle:function(Q,S){S=O(S);var R=function(T){return L(T,S);};return B.Dom.batch(Q,R,B.Dom,true);},setStyle:function(Q,S,T){S=O(S);var R=function(U){J(U,S,T);};B.Dom.batch(Q,R,B.Dom,true);},getXY:function(Q){var R=function(S){if((S.parentNode===null||S.offsetParent===null||this.getStyle(S,"display")=="none")&&S!=S.ownerDocument.body){return false;}return I(S);};return B.Dom.batch(Q,R,B.Dom,true);},getX:function(Q){var R=function(S){return B.Dom.getXY(S)[0];};return B.Dom.batch(Q,R,B.Dom,true);},getY:function(Q){var R=function(S){return B.Dom.getXY(S)[1];};return B.Dom.batch(Q,R,B.Dom,true);},setXY:function(Q,T,S){var R=function(W){var V=this.getStyle(W,"position");if(V=="static"){this.setStyle(W,"position","relative");V="relative";}var Y=this.getXY(W);if(Y===false){return false;}var X=[parseInt(this.getStyle(W,"left"),10),parseInt(this.getStyle(W,"top"),10)];if(isNaN(X[0])){X[0]=(V=="relative")?0:W.offsetLeft;}if(isNaN(X[1])){X[1]=(V=="relative")?0:W.offsetTop;}if(T[0]!==null){W.style.left=T[0]-Y[0]+X[0]+"px";}if(T[1]!==null){W.style.top=T[1]-Y[1]+X[1]+"px";}if(!S){var U=this.getXY(W);if((T[0]!==null&&U[0]!=T[0])||(T[1]!==null&&U[1]!=T[1])){this.setXY(W,T,true);}}};B.Dom.batch(Q,R,B.Dom,true);},setX:function(R,Q){B.Dom.setXY(R,[Q,null]);},setY:function(Q,R){B.Dom.setXY(Q,[null,R]);},getRegion:function(Q){var R=function(S){if((S.parentNode===null||S.offsetParent===null||this.getStyle(S,"display")=="none")&&S!=N.body){return false;}var T=B.Region.getRegion(S);return T;};return B.Dom.batch(Q,R,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(U,Y,V,W){Y=Y||"*";V=(V)?B.Dom.get(V):null||N;if(!V){return[];}var R=[],Q=V.getElementsByTagName(Y),X=P(U);for(var S=0,T=Q.length;S<T;++S){if(X.test(Q[S].className)){R[R.length]=Q[S];if(W){W.call(Q[S],Q[S]);}}}return R;},hasClass:function(S,R){var Q=P(R);var T=function(U){return Q.test(U.className);};return B.Dom.batch(S,T,B.Dom,true);},addClass:function(R,Q){var S=function(T){if(this.hasClass(T,Q)){return false;}T.className=YAHOO.lang.trim([T.className,Q].join(" "));return true;};return B.Dom.batch(R,S,B.Dom,true);},removeClass:function(S,R){var Q=P(R);var T=function(U){if(!this.hasClass(U,R)){return false;}var V=U.className;U.className=V.replace(Q," ");if(this.hasClass(U,R)){this.removeClass(U,R);}U.className=YAHOO.lang.trim(U.className);return true;};return B.Dom.batch(S,T,B.Dom,true);},replaceClass:function(T,R,Q){if(!Q||R===Q){return false;}var S=P(R);var U=function(V){if(!this.hasClass(V,R)){this.addClass(V,Q);return true;}V.className=V.className.replace(S," "+Q+" ");if(this.hasClass(V,R)){this.replaceClass(V,R,Q);}V.className=YAHOO.lang.trim(V.className);return true;};return B.Dom.batch(T,U,B.Dom,true);},generateId:function(Q,S){S=S||"yui-gen";var R=function(T){if(T&&T.id){return T.id;}var U=S+H++;if(T){T.id=U;}return U;};return B.Dom.batch(Q,R,B.Dom,true)||R.apply(B.Dom,arguments);},isAncestor:function(Q,R){Q=B.Dom.get(Q);R=B.Dom.get(R);if(!Q||!R){return false;}if(Q.contains&&R.nodeType&&!M){return Q.contains(R);}else{if(Q.compareDocumentPosition&&R.nodeType){return !!(Q.compareDocumentPosition(R)&16);}else{if(R.nodeType){return !!this.getAncestorBy(R,function(S){return S==Q;});}}}return false;},inDocument:function(Q){return this.isAncestor(N.documentElement,Q);},getElementsBy:function(X,R,S,U){R=R||"*";S=(S)?B.Dom.get(S):null||N;if(!S){return[];}var T=[],W=S.getElementsByTagName(R);for(var V=0,Q=W.length;V<Q;++V){if(X(W[V])){T[T.length]=W[V];if(U){U(W[V]);}}}return T;},batch:function(U,X,W,S){U=(U&&(U.tagName||U.item))?U:B.Dom.get(U);if(!U||!X){return false;}var T=(S)?W:window;if(U.tagName||U.length===undefined){return X.call(T,U,W);}var V=[];for(var R=0,Q=U.length;R<Q;++R){V[V.length]=X.call(T,U[R],W);}return V;},getDocumentHeight:function(){var R=(N.compatMode!="CSS1Compat")?N.body.scrollHeight:N.documentElement.scrollHeight;var Q=Math.max(R,B.Dom.getViewportHeight());return Q;},getDocumentWidth:function(){var R=(N.compatMode!="CSS1Compat")?N.body.scrollWidth:N.documentElement.scrollWidth;var Q=Math.max(R,B.Dom.getViewportWidth());return Q;},getViewportHeight:function(){var Q=self.innerHeight;var R=N.compatMode;if((R||G)&&!C){Q=(R=="CSS1Compat")?N.documentElement.clientHeight:N.body.clientHeight;
}return Q;},getViewportWidth:function(){var Q=self.innerWidth;var R=N.compatMode;if(R||G){Q=(R=="CSS1Compat")?N.documentElement.clientWidth:N.body.clientWidth;}return Q;},getAncestorBy:function(Q,R){while(Q=Q.parentNode){if(D(Q,R)){return Q;}}return null;},getAncestorByClassName:function(R,Q){R=B.Dom.get(R);if(!R){return null;}var S=function(T){return B.Dom.hasClass(T,Q);};return B.Dom.getAncestorBy(R,S);},getAncestorByTagName:function(R,Q){R=B.Dom.get(R);if(!R){return null;}var S=function(T){return T.tagName&&T.tagName.toUpperCase()==Q.toUpperCase();};return B.Dom.getAncestorBy(R,S);},getPreviousSiblingBy:function(Q,R){while(Q){Q=Q.previousSibling;if(D(Q,R)){return Q;}}return null;},getPreviousSibling:function(Q){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getPreviousSiblingBy(Q);},getNextSiblingBy:function(Q,R){while(Q){Q=Q.nextSibling;if(D(Q,R)){return Q;}}return null;},getNextSibling:function(Q){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getNextSiblingBy(Q);},getFirstChildBy:function(Q,S){var R=(D(Q.firstChild,S))?Q.firstChild:null;return R||B.Dom.getNextSiblingBy(Q.firstChild,S);},getFirstChild:function(Q,R){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getFirstChildBy(Q);},getLastChildBy:function(Q,S){if(!Q){return null;}var R=(D(Q.lastChild,S))?Q.lastChild:null;return R||B.Dom.getPreviousSiblingBy(Q.lastChild,S);},getLastChild:function(Q){Q=B.Dom.get(Q);return B.Dom.getLastChildBy(Q);},getChildrenBy:function(R,T){var S=B.Dom.getFirstChildBy(R,T);var Q=S?[S]:[];B.Dom.getNextSiblingBy(S,function(U){if(!T||T(U)){Q[Q.length]=U;}return false;});return Q;},getChildren:function(Q){Q=B.Dom.get(Q);if(!Q){}return B.Dom.getChildrenBy(Q);},getDocumentScrollLeft:function(Q){Q=Q||N;return Math.max(Q.documentElement.scrollLeft,Q.body.scrollLeft);},getDocumentScrollTop:function(Q){Q=Q||N;return Math.max(Q.documentElement.scrollTop,Q.body.scrollTop);},insertBefore:function(R,Q){R=B.Dom.get(R);Q=B.Dom.get(Q);if(!R||!Q||!Q.parentNode){return null;}return Q.parentNode.insertBefore(R,Q);},insertAfter:function(R,Q){R=B.Dom.get(R);Q=B.Dom.get(Q);if(!R||!Q||!Q.parentNode){return null;}if(Q.nextSibling){return Q.parentNode.insertBefore(R,Q.nextSibling);}else{return Q.parentNode.appendChild(R);}},getClientRegion:function(){var S=B.Dom.getDocumentScrollTop(),R=B.Dom.getDocumentScrollLeft(),T=B.Dom.getViewportWidth()+R,Q=B.Dom.getViewportHeight()+S;return new B.Region(S,T,Q,R);}};var I=function(){if(N.documentElement.getBoundingClientRect){return function(R){var S=R.getBoundingClientRect();var Q=R.ownerDocument;return[S.left+B.Dom.getDocumentScrollLeft(Q),S.top+B.Dom.getDocumentScrollTop(Q)];};}else{return function(S){var T=[S.offsetLeft,S.offsetTop];var R=S.offsetParent;var Q=(M&&B.Dom.getStyle(S,"position")=="absolute"&&S.offsetParent==S.ownerDocument.body);if(R!=S){while(R){T[0]+=R.offsetLeft;T[1]+=R.offsetTop;if(!Q&&M&&B.Dom.getStyle(R,"position")=="absolute"){Q=true;}R=R.offsetParent;}}if(Q){T[0]-=S.ownerDocument.body.offsetLeft;T[1]-=S.ownerDocument.body.offsetTop;}R=S.parentNode;while(R.tagName&&!E.ROOT_TAG.test(R.tagName)){if(B.Dom.getStyle(R,"display").search(/^inline|table-row.*$/i)){T[0]-=R.scrollLeft;T[1]-=R.scrollTop;}R=R.parentNode;}return T;};}}();})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.4.1",build:"742"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){var D=this.subscribers.length;if(!D&&this.silent){return true;}var H=[],F=true,C,I=false;for(C=0;C<arguments.length;++C){H.push(arguments[C]);}if(!this.silent){}for(C=0;C<D;++C){var L=this.subscribers[C];if(!L){I=true;}else{if(!this.silent){}var K=L.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var A=null;if(H.length>0){A=H[0];}try{F=L.fn.call(K,A,L.obj);}catch(E){this.lastError=E;}}else{try{F=L.fn.call(K,this.type,H,L.obj);}catch(G){this.lastError=G;}}if(false===F){if(!this.silent){}return false;}}}if(I){var J=[],B=this.subscribers;for(C=0,D=B.length;C<D;C=C+1){J.push(B[C]);}this.subscribers=J;}return true;},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B);}this.subscribers=[];return B;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers[A]=null;},toString:function(){return"CustomEvent: '"+this.type+"', scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L<K.length;L=L+1){F.push({id:K[L],fn:M,obj:Q,override:O,checkReady:N});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(M,K,N,L){this.onAvailable(M,K,N,L,true);},onDOMReady:function(K,M,L){if(this.DOMReady){setTimeout(function(){var N=window;if(L){if(L===true){N=M;}else{N=L;}}K.call(N,"DOMReady",[],M);},0);}else{this.DOMReadyEvent.subscribe(K,M,L);}},addListener:function(M,K,V,Q,L){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var R=0,T=M.length;R<T;++R){W=this.on(M[R],K,V,Q,L)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var P=this.getEl(M);if(P){M=P;}else{this.onAvailable(M,function(){YAHOO.util.Event.on(M,K,V,Q,L);});return true;}}}if(!M){return false;}if("unload"==K&&Q!==this){J[J.length]=[M,K,V,Q,L];return true;}var Y=M;if(L){if(L===true){Y=Q;}else{Y=L;}}var N=function(Z){return V.call(Y,YAHOO.util.Event.getEvent(Z,M),Q);};var X=[M,K,V,N,Y,Q,L];var S=I.length;I[S]=X;if(this.useLegacyEvent(M,K)){var O=this.getLegacyIndex(M,K);if(O==-1||M!=G[O][0]){O=G.length;B[M.id+K]=O;G[O]=[M,K,M["on"+K]];E[O]=[];M["on"+K]=function(Z){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z),O);};}E[O].push(X);}else{try{this._simpleAdd(M,K,N,false);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}}return true;},fireLegacyEvent:function(O,M){var Q=true,K,S,R,T,P;S=E[M];for(var L=0,N=S.length;L<N;++L){R=S[L];if(R&&R[this.WFN]){T=R[this.ADJ_SCOPE];P=R[this.WFN].call(T,O);Q=(Q&&P);}}K=G[M];if(K&&K[2]){K[2](O);}return Q;},getLegacyIndex:function(L,M){var K=this.generateId(L)+M;if(typeof B[K]=="undefined"){return -1;}else{return B[K];}},useLegacyEvent:function(L,M){if(this.webkit&&("click"==M||"dblclick"==M)){var K=parseInt(this.webkit,10);if(!isNaN(K)&&K<418){return true;}}return false;},removeListener:function(L,K,T){var O,R,V;if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var U=true;for(O=0,R=L.length;O<R;++O){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=0,R=J.length;O<R;O++){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J[O]=null;return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O<R;++O){V=M[O];if(V&&V[this.EL]==L&&V[this.TYPE]==K&&V[this.FN]==T){M[O]=null;break;}}}}else{try{this._simpleRemove(L,K,P[this.WFN],false);}catch(S){this.lastError=S;return false;}}delete I[Q][this.WFN];delete I[Q][this.FN];I[Q]=null;return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(K){if(K&&3==K.nodeType){return K.parentNode;}else{return K;}},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];
},getRelatedTarget:function(L){var K=L.relatedTarget;if(!K){if(L.type=="mouseout"){K=L.toElement;}else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break;}N=N.caller;}}return L;},getCharCode:function(L){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in D)){K=D[K];}return K;},_getCacheIndex:function(O,P,N){for(var M=0,L=I.length;M<L;++M){var K=I[M];if(K&&K[this.FN]==N&&K[this.EL]==O&&K[this.TYPE]==P){return M;}}return -1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+A;++A;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(L){if(!H){H=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}if(this.isIE){if(!this.DOMReady){this.startInterval();return false;}}this.locked=true;var P=!H;if(!P){P=(C>0);}var O=[];var Q=function(S,T){var R=S;if(T.override){if(T.override===true){R=T.obj;}else{R=T.override;}}T.fn.call(R,T.obj);};var L,K,N,M;for(L=0,K=F.length;L<K;++L){N=F[L];if(N&&!N.checkReady){M=this.getEl(N.id);if(M){Q(M,N);F[L]=null;}else{O.push(N);}}}for(L=0,K=F.length;L<K;++L){N=F[L];if(N&&N.checkReady){M=this.getEl(N.id);if(M){if(H||M.nextSibling){Q(M,N);F[L]=null;}}else{O.push(N);}}}C=(O.length===0)?0:C-1;if(P){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=0,K=Q.length;N<K;++N){var L=Q[N];this.removeListener(M,L.type,L.fn,L.index);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[I,J];}else{if(K==="unload"){L=[J];}else{L=[I];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T&&T.length>0){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(R){var Q=YAHOO.util.Event,O,N,L,K,M;for(O=0,K=J.length;O<K;++O){L=J[O];if(L){var P=window;if(L[Q.ADJ_SCOPE]){if(L[Q.ADJ_SCOPE]===true){P=L[Q.UNLOAD_OBJ];}else{P=L[Q.ADJ_SCOPE];}}L[Q.FN].call(P,Q.getEvent(R,L[Q.EL]),L[Q.UNLOAD_OBJ]);J[O]=null;L=null;P=null;}}J=null;if(YAHOO.env.ua.ie&&I&&I.length>0){N=I.length;while(N){M=N-1;L=I[M];if(L){Q.removeListener(L[Q.EL],L[Q.TYPE],L[Q.FN],M);}N--;}L=null;}G=null;Q._simpleRemove(window,"unload",Q._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var A=YAHOO.util.Event;A.on=A.addListener;if(A.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);A._dri=setInterval(function(){var C=document.createElement("p");try{C.doScroll("left");clearInterval(A._dri);A._dri=null;A._ready();C=null;}catch(B){C=null;}},A.POLL_INTERVAL);}else{if(A.webkit){A._dri=setInterval(function(){var B=document.readyState;if("loaded"==B||"complete"==B){clearInterval(A._dri);A._dri=null;A._ready();}},A.POLL_INTERVAL);}else{A._simpleAdd(document,"DOMContentLoaded",A._ready);}}A._simpleAdd(window,"load",A._load);A._simpleAdd(window,"unload",A._unload);A._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};
var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.4.1",build:"742"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.4.1", build: "742"});
// Content: animation-min-new
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
*/
YAHOO.util.Anim=function(B,A,C,D){if(!B){}this.init(B,A,C,D);};YAHOO.util.Anim.prototype={toString:function(){var A=this.getEl();var B=A.id||A.tagName||A;return("Anim "+B);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(A,C,B){return this.method(this.currentFrame,C,B-C,this.totalFrames);},setAttribute:function(A,C,B){if(this.patterns.noNegatives.test(A)){C=(C>0)?C:0;}YAHOO.util.Dom.setStyle(this.getEl(),A,C+B);},getAttribute:function(A){var C=this.getEl();var E=YAHOO.util.Dom.getStyle(C,A);if(E!=="auto"&&!this.patterns.offsetUnit.test(E)){return parseFloat(E);}var B=this.patterns.offsetAttribute.exec(A)||[];var F=!!(B[3]);var D=!!(B[2]);if(D||(YAHOO.util.Dom.getStyle(C,"position")=="absolute"&&F)){E=C["offset"+B[0].charAt(0).toUpperCase()+B[0].substr(1)];}else{E=0;}return E;},getDefaultUnit:function(A){if(this.patterns.defaultUnit.test(A)){return"px";}return"";},setRuntimeAttribute:function(B){var G;var C;var D=this.attributes;this.runtimeAttributes[B]={};var F=function(H){return(typeof H!=="undefined");};if(!F(D[B]["to"])&&!F(D[B]["by"])){return false;}G=(F(D[B]["from"]))?D[B]["from"]:this.getAttribute(B);if(F(D[B]["to"])){C=D[B]["to"];}else{if(F(D[B]["by"])){if(G.constructor==Array){C=[];for(var E=0,A=G.length;E<A;++E){C[E]=G[E]+D[B]["by"][E]*1;}}else{C=G+D[B]["by"]*1;}}}this.runtimeAttributes[B].start=G;this.runtimeAttributes[B].end=C;this.runtimeAttributes[B].unit=(F(D[B].unit))?D[B]["unit"]:this.getDefaultUnit(B);return true;},init:function(C,H,G,A){var B=false;var D=null;var F=0;C=YAHOO.util.Dom.get(C);this.attributes=H||{};this.duration=!YAHOO.lang.isUndefined(G)?G:1;this.method=A||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(K){C=YAHOO.util.Dom.get(K);};this.getEl=function(){return C;};this.isAnimated=function(){return B;};this.getStartTime=function(){return D;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(K){if(!this.isAnimated()){return false;}if(K){this.currentFrame=this.totalFrames;this._onTween.fire();}YAHOO.util.AnimMgr.stop(this);};var J=function(){this.onStart.fire();this.runtimeAttributes={};for(var K in this.attributes){this.setRuntimeAttribute(K);}B=true;F=0;D=new Date();};var I=function(){var M={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};M.toString=function(){return("duration: "+M.duration+", currentFrame: "+M.currentFrame);};this.onTween.fire(M);var L=this.runtimeAttributes;for(var K in L){this.setAttribute(K,this.doMethod(K,L[K].start,L[K].end),L[K].unit);}F+=1;};var E=function(){var K=(new Date()-D)/1000;var L={duration:K,frames:F,fps:F/K};L.toString=function(){return("duration: "+L.duration+", frames: "+L.frames+", fps: "+L.fps);};B=false;F=0;this.onComplete.fire(L);};this._onStart=new YAHOO.util.CustomEvent("_start",this,true);this.onStart=new YAHOO.util.CustomEvent("start",this);this.onTween=new YAHOO.util.CustomEvent("tween",this);this._onTween=new YAHOO.util.CustomEvent("_tween",this,true);this.onComplete=new YAHOO.util.CustomEvent("complete",this);this._onComplete=new YAHOO.util.CustomEvent("_complete",this,true);this._onStart.subscribe(J);this._onTween.subscribe(I);this._onComplete.subscribe(E);}};YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){F=F||E(G);if(!G.isAnimated()||F==-1){return false;}G._onComplete.fire();B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){YAHOO.util.ColorAnim=function(E,D,F,G){YAHOO.util.ColorAnim.superclass.constructor.call(this,E,D,F,G);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var B=YAHOO.util;var C=B.ColorAnim.superclass;var A=B.ColorAnim.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("ColorAnim "+E);};A.patterns.color=/color$/i;A.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;A.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;A.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;A.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;A.parseColor=function(D){if(D.length==3){return D;}var E=this.patterns.hex.exec(D);if(E&&E.length==4){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)];}E=this.patterns.rgb.exec(D);if(E&&E.length==4){return[parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10)];
}E=this.patterns.hex3.exec(D);if(E&&E.length==4){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)];}return null;};A.getAttribute=function(D){var F=this.getEl();if(this.patterns.color.test(D)){var G=YAHOO.util.Dom.getStyle(F,D);if(this.patterns.transparent.test(G)){var E=F.parentNode;G=B.Dom.getStyle(E,D);while(E&&this.patterns.transparent.test(G)){E=E.parentNode;G=B.Dom.getStyle(E,D);if(E.tagName.toUpperCase()=="HTML"){G="#fff";}}}}else{G=C.getAttribute.call(this,D);}return G;};A.doMethod=function(E,I,F){var H;if(this.patterns.color.test(E)){H=[];for(var G=0,D=I.length;G<D;++G){H[G]=C.doMethod.call(this,E,I[G],F[G]);}H="rgb("+Math.floor(H[0])+","+Math.floor(H[1])+","+Math.floor(H[2])+")";}else{H=C.doMethod.call(this,E,I,F);}return H;};A.setRuntimeAttribute=function(E){C.setRuntimeAttribute.call(this,E);if(this.patterns.color.test(E)){var G=this.attributes;var I=this.parseColor(this.runtimeAttributes[E].start);var F=this.parseColor(this.runtimeAttributes[E].end);if(typeof G[E]["to"]==="undefined"&&typeof G[E]["by"]!=="undefined"){F=this.parseColor(G[E].by);for(var H=0,D=I.length;H<D;++H){F[H]=I[H]+F[H];}}this.runtimeAttributes[E].start=I;this.runtimeAttributes[E].end=F;}};})();YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){YAHOO.util.Motion=function(G,F,H,I){if(G){YAHOO.util.Motion.superclass.constructor.call(this,G,F,H,I);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var D=YAHOO.util;var E=D.Motion.superclass;var B=D.Motion.prototype;B.toString=function(){var F=this.getEl();var G=F.id||F.tagName;return("Motion "+G);};B.patterns.points=/^points$/i;B.setAttribute=function(F,H,G){if(this.patterns.points.test(F)){G=G||"px";E.setAttribute.call(this,"left",H[0],G);E.setAttribute.call(this,"top",H[1],G);}else{E.setAttribute.call(this,F,H,G);}};B.getAttribute=function(F){if(this.patterns.points.test(F)){var G=[E.getAttribute.call(this,"left"),E.getAttribute.call(this,"top")];}else{G=E.getAttribute.call(this,F);}return G;};B.doMethod=function(F,J,G){var I=null;if(this.patterns.points.test(F)){var H=this.method(this.currentFrame,0,100,this.totalFrames)/100;I=D.Bezier.getPosition(this.runtimeAttributes[F],H);}else{I=E.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(O){if(this.patterns.points.test(O)){var G=this.getEl();var I=this.attributes;var F;var K=I["points"]["control"]||[];var H;var L,N;if(K.length>0&&!(K[0] instanceof Array)){K=[K];}else{var J=[];for(L=0,N=K.length;L<N;++L){J[L]=K[L];}K=J;}if(D.Dom.getStyle(G,"position")=="static"){D.Dom.setStyle(G,"position","relative");}if(C(I["points"]["from"])){D.Dom.setXY(G,I["points"]["from"]);}else{D.Dom.setXY(G,D.Dom.getXY(G));}F=this.getAttribute("points");if(C(I["points"]["to"])){H=A.call(this,I["points"]["to"],F);var M=D.Dom.getXY(this.getEl());for(L=0,N=K.length;L<N;++L){K[L]=A.call(this,K[L],F);}}else{if(C(I["points"]["by"])){H=[F[0]+I["points"]["by"][0],F[1]+I["points"]["by"][1]];for(L=0,N=K.length;L<N;++L){K[L]=[F[0]+K[L][0],F[1]+K[L][1]];}}}this.runtimeAttributes[O]=[F];if(K.length>0){this.runtimeAttributes[O]=this.runtimeAttributes[O].concat(K);}this.runtimeAttributes[O][this.runtimeAttributes[O].length]=H;}else{E.setRuntimeAttribute.call(this,O);}};var A=function(F,H){var G=D.Dom.getXY(this.getEl());F=[F[0]-G[0]+H[0],F[1]-G[1]+H[1]];return F;};var C=function(F){return(typeof F!=="undefined");};})();(function(){YAHOO.util.Scroll=function(E,D,F,G){if(E){YAHOO.util.Scroll.superclass.constructor.call(this,E,D,F,G);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var B=YAHOO.util;var C=B.Scroll.superclass;var A=B.Scroll.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("Scroll "+E);};A.doMethod=function(D,G,E){var F=null;if(D=="scroll"){F=[this.method(this.currentFrame,G[0],E[0]-G[0],this.totalFrames),this.method(this.currentFrame,G[1],E[1]-G[1],this.totalFrames)];
}else{F=C.doMethod.call(this,D,G,E);}return F;};A.getAttribute=function(D){var F=null;var E=this.getEl();if(D=="scroll"){F=[E.scrollLeft,E.scrollTop];}else{F=C.getAttribute.call(this,D);}return F;};A.setAttribute=function(D,G,F){var E=this.getEl();if(D=="scroll"){E.scrollLeft=G[0];E.scrollTop=G[1];}else{C.setAttribute.call(this,D,G,F);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.4.1",build:"742"});
// Content: autocomplete-min-new
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
*/
YAHOO.widget.AutoComplete=function(G,B,J,D){if(G&&B&&J){if(J instanceof YAHOO.widget.DataSource){this.dataSource=J;}else{return ;}if(YAHOO.util.Dom.inDocument(G)){if(YAHOO.lang.isString(G)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+G;this._oTextbox=document.getElementById(G);}else{this._sName=(G.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+G.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=G;}YAHOO.util.Dom.addClass(this._oTextbox,"yui-ac-input");}else{return ;}if(YAHOO.util.Dom.inDocument(B)){if(YAHOO.lang.isString(B)){this._oContainer=document.getElementById(B);}else{this._oContainer=B;}if(this._oContainer.style.display=="none"){}var E=this._oContainer.parentNode;var A=E.tagName.toLowerCase();if(A=="div"){YAHOO.util.Dom.addClass(E,"yui-ac");}else{}}else{return ;}if(D&&(D.constructor==Object)){for(var I in D){if(I){this[I]=D[I];}}}this._initContainer();this._initProps();this._initList();this._initContainerHelpers();var H=this;var F=this._oTextbox;var C=this._oContainer._oContent;YAHOO.util.Event.addListener(F,"keyup",H._onTextboxKeyUp,H);YAHOO.util.Event.addListener(F,"keydown",H._onTextboxKeyDown,H);YAHOO.util.Event.addListener(F,"focus",H._onTextboxFocus,H);YAHOO.util.Event.addListener(F,"blur",H._onTextboxBlur,H);YAHOO.util.Event.addListener(C,"mouseover",H._onContainerMouseover,H);YAHOO.util.Event.addListener(C,"mouseout",H._onContainerMouseout,H);YAHOO.util.Event.addListener(C,"scroll",H._onContainerScroll,H);YAHOO.util.Event.addListener(C,"resize",H._onContainerResize,H);YAHOO.util.Event.addListener(F,"keypress",H._onTextboxKeyPress,H);YAHOO.util.Event.addListener(window,"unload",H._onWindowUnload,H);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);F.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListItems=function(){return this._aListItems;};YAHOO.widget.AutoComplete.prototype.getListItemData=function(A){if(A._oResultData){return A._oResultData;}else{return false;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(A){if(A){if(this._oContainer._oContent._oHeader){this._oContainer._oContent._oHeader.innerHTML=A;this._oContainer._oContent._oHeader.style.display="block";}}else{this._oContainer._oContent._oHeader.innerHTML="";this._oContainer._oContent._oHeader.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setFooter=function(A){if(A){if(this._oContainer._oContent._oFooter){this._oContainer._oContent._oFooter.innerHTML=A;this._oContainer._oContent._oFooter.style.display="block";}}else{this._oContainer._oContent._oFooter.innerHTML="";this._oContainer._oContent._oFooter.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setBody=function(A){if(A){if(this._oContainer._oContent._oBody){this._oContainer._oContent._oBody.innerHTML=A;this._oContainer._oContent._oBody.style.display="block";this._oContainer._oContent.style.display="block";}}else{this._oContainer._oContent._oBody.innerHTML="";this._oContainer._oContent.style.display="none";}this._maxResultsDisplayed=0;};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,C){var A=B[0];if(A){return A;}else{return"";}};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(A,B,D,C){return true;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(A){this._sendQuery(A);};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return A;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._oTextbox;var D=this._oContainer;this.textboxFocusEvent.unsubscribe();this.textboxKeyEvent.unsubscribe();this.dataRequestEvent.unsubscribe();this.dataReturnEvent.unsubscribe();this.dataErrorEvent.unsubscribe();this.containerExpandEvent.unsubscribe();this.typeAheadEvent.unsubscribe();
this.itemMouseOverEvent.unsubscribe();this.itemMouseOutEvent.unsubscribe();this.itemArrowToEvent.unsubscribe();this.itemArrowFromEvent.unsubscribe();this.itemSelectEvent.unsubscribe();this.unmatchedItemSelectEvent.unsubscribe();this.selectionEnforceEvent.unsubscribe();this.containerCollapseEvent.unsubscribe();this.textboxBlurEvent.unsubscribe();YAHOO.util.Event.purgeElement(A,true);YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._oTextbox=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._oContainer=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._aListItems=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var D=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(D)||(D<1)){this.maxResultsDisplayed=10;}var E=this.queryDelay;if(!YAHOO.lang.isNumber(E)||(E<0)){this.queryDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var C=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(C)||(C<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._oContainer._oContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._oContainer._oShadow){var B=document.createElement("div");B.className="yui-ac-shadow";this._oContainer._oShadow=this._oContainer.appendChild(B);}if(this.useIFrame&&!this._oContainer._oIFrame){var A=document.createElement("iframe");A.src=this._iFrameSrc;A.frameBorder=0;A.scrolling="no";A.style.position="absolute";A.style.width="100%";A.style.height="100%";A.tabIndex=-1;this._oContainer._oIFrame=this._oContainer.appendChild(A);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){YAHOO.util.Dom.addClass(this._oContainer,"yui-ac-container");if(!this._oContainer._oContent){var D=document.createElement("div");D.className="yui-ac-content";D.style.display="none";this._oContainer._oContent=this._oContainer.appendChild(D);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._oContainer._oContent._oHeader=this._oContainer._oContent.appendChild(B);var C=document.createElement("div");C.className="yui-ac-bd";this._oContainer._oContent._oBody=this._oContainer._oContent.appendChild(C);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._oContainer._oContent._oFooter=this._oContainer._oContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._oContainer._oContent._oBody.hasChildNodes()){var B=this.getListItems();if(B){for(var A=B.length-1;A>=0;A--){B[A]=null;}}this._oContainer._oContent._oBody.innerHTML="";}var E=document.createElement("ul");E=this._oContainer._oContent._oBody.appendChild(E);for(var C=0;C<this.maxResultsDisplayed;C++){var D=document.createElement("li");D=E.appendChild(D);this._aListItems[C]=D;this._initListItem(D,C);}this._maxResultsDisplayed=this.maxResultsDisplayed;};YAHOO.widget.AutoComplete.prototype._initListItem=function(C,B){var A=this;C.style.display="none";C._nItemIndex=B;C.mouseover=C.mouseout=C.onclick=null;YAHOO.util.Event.addListener(C,"mouseover",A._onItemMouseover,A);YAHOO.util.Event.addListener(C,"mouseout",A._onItemMouseout,A);YAHOO.util.Event.addListener(C,"click",A._onItemMouseclick,A);};YAHOO.widget.AutoComplete.prototype._onIMEDetected=function(A){A._enableIntervalDetection();};YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var A=this._oTextbox.value;var B=this._sLastTextboxValue;if(A!=B){this._sLastTextboxValue=A;this._sendQuery(A);}};YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection=function(A){if(A._queryInterval){clearInterval(A._queryInterval);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(A){if((A==9)||(A==13)||(A==16)||(A==17)||(A>=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)){return true;
}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(G){if(this.minQueryLength==-1){this._toggleContainer(false);return ;}var C=(this.delimChar)?this.delimChar:null;if(C){var E=-1;for(var B=C.length-1;B>=0;B--){var F=G.lastIndexOf(C[B]);if(F>E){E=F;}}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(G[E-1]==C[A]){E--;break;}}}if(E>-1){var D=E+1;while(G.charAt(D)==" "){D+=1;}this._sSavedQuery=G.substring(0,D);G=G.substr(D);}else{if(G.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}}if((G&&(G.length<this.minQueryLength))||(!G&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return ;}G=encodeURIComponent(G);this._nDelayID=-1;G=this.doBeforeSendQuery(G);this.dataRequestEvent.fire(this,G);this.dataSource.getResults(this._populateList,G,this);};YAHOO.widget.AutoComplete.prototype._populateList=function(K,L,I){if(L===null){I.dataErrorEvent.fire(I,K);}if(!I._bFocused||!L){return ;}var A=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var O=I._oContainer._oContent.style;O.width=(!A)?null:"";O.height=(!A)?null:"";var H=decodeURIComponent(K);I._sCurQuery=H;I._bItemSelected=false;if(I._maxResultsDisplayed!=I.maxResultsDisplayed){I._initList();}var C=Math.min(L.length,I.maxResultsDisplayed);I._nDisplayedItems=C;if(C>0){I._initContainerHelpers();var D=I._aListItems;for(var G=C-1;G>=0;G--){var N=D[G];var B=L[G];N.innerHTML=I.formatResult(B,H);N.style.display="list-item";N._sResultKey=B[0];N._oResultData=B;}for(var F=D.length-1;F>=C;F--){var M=D[F];M.innerHTML=null;M.style.display="none";M._sResultKey=null;M._oResultData=null;}var J=I.doBeforeExpandContainer(I._oTextbox,I._oContainer,K,L);I._toggleContainer(J);if(I.autoHighlight){var E=D[0];I._toggleHighlight(E,"to");I.itemArrowToEvent.fire(I,E);I._typeAhead(E,K);}else{I._oCurItem=null;}}else{I._toggleContainer(false);}I.dataReturnEvent.fire(I,K,L);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var C=this._oTextbox.value;var B=(this.delimChar)?this.delimChar[0]:null;var A=(B)?C.lastIndexOf(B,C.length-2):-1;if(A>-1){this._oTextbox.value=C.substring(0,A);}else{this._oTextbox.value="";}this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var D=null;for(var A=this._nDisplayedItems-1;A>=0;A--){var C=this._aListItems[A];var B=C._sResultKey.toLowerCase();if(B==this._sCurQuery.toLowerCase()){D=C;break;}}return(D);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(E,G){if(!this.typeAhead||(this._nKeyCode==8)){return ;}var B=this._oTextbox;var F=this._oTextbox.value;if(!B.setSelectionRange&&!B.createTextRange){return ;}var C=F.length;this._updateValue(E);var D=B.value.length;this._selectText(B,C,D);var A=B.value.substr(C,D);this.typeAheadEvent.fire(this,G,A);};YAHOO.widget.AutoComplete.prototype._selectText=function(A,B,C){if(A.setSelectionRange){A.setSelectionRange(B,C);}else{if(A.createTextRange){var D=A.createTextRange();D.moveStart("character",B);D.moveEnd("character",C-A.value.length);D.select();}else{A.select();}}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(B){var D=false;var C=this._oContainer._oContent.offsetWidth+"px";var A=this._oContainer._oContent.offsetHeight+"px";if(this.useIFrame&&this._oContainer._oIFrame){D=true;if(B){this._oContainer._oIFrame.style.width=C;this._oContainer._oIFrame.style.height=A;}else{this._oContainer._oIFrame.style.width=0;this._oContainer._oIFrame.style.height=0;}}if(this.useShadow&&this._oContainer._oShadow){D=true;if(B){this._oContainer._oShadow.style.width=C;this._oContainer._oShadow.style.height=A;}else{this._oContainer._oShadow.style.width=0;this._oContainer._oShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(J){var L=this._oContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return ;}if(!J){this._oContainer._oContent.scrollTop=0;var C=this._aListItems;if(C&&(C.length>0)){for(var G=C.length-1;G>=0;G--){C[G].style.display="none";}}if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;}if(!J&&!this._bContainerOpen){L._oContent.style.display="none";return ;}var B=this._oAnim;if(B&&B.getEl()&&(this.animHoriz||this.animVert)){if(!J){this._toggleContainerHelpers(J);}if(B.isAnimated()){B.stop();}var H=L._oContent.cloneNode(true);L.appendChild(H);H.style.top="-9000px";H.style.display="block";var F=H.offsetWidth;var D=H.offsetHeight;var A=(this.animHoriz)?0:F;var E=(this.animVert)?0:D;B.attributes=(J)?{width:{to:F},height:{to:D}}:{width:{to:A},height:{to:E}};if(J&&!this._bContainerOpen){L._oContent.style.width=A+"px";L._oContent.style.height=E+"px";}else{L._oContent.style.width=F+"px";L._oContent.style.height=D+"px";}L.removeChild(H);H=null;var I=this;var K=function(){B.onComplete.unsubscribeAll();if(J){I.containerExpandEvent.fire(I);}else{L._oContent.style.display="none";I.containerCollapseEvent.fire(I);}I._toggleContainerHelpers(J);};L._oContent.style.display="block";B.onComplete.subscribe(K);B.animate();this._bContainerOpen=J;}else{if(J){L._oContent.style.display="block";this.containerExpandEvent.fire(this);}else{L._oContent.style.display="none";this.containerCollapseEvent.fire(this);}this._toggleContainerHelpers(J);this._bContainerOpen=J;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){var B=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,B);}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._oCurItem=A;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(A,C){if(A==this._oCurItem){return ;}var B=this.prehighlightClassName;if((C=="mouseover")&&B){YAHOO.util.Dom.addClass(A,B);}else{YAHOO.util.Dom.removeClass(A,B);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(F){var C=this._oTextbox;var E=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=this._sSavedQuery;var D=F._sResultKey;C.focus();
C.value="";if(E){if(B){C.value=B;}C.value+=D+E;if(E!=" "){C.value+=" ";}}else{C.value=D;}if(C.type=="textarea"){C.scrollTop=C.scrollHeight;}var A=C.value.length;this._selectText(C,A,A);this._oCurItem=F;};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._cancelIntervalDetection(this);this.itemSelectEvent.fire(this,A,A._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._oCurItem){this._selectItem(this._oCurItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var D=this._oCurItem;var F=-1;if(D){F=D._nItemIndex;}var C=(G==40)?(F+1):(F-1);if(C<-2||C>=this._nDisplayedItems){return ;}if(D){this._toggleHighlight(D,"from");this.itemArrowFromEvent.fire(this,D);}if(C==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._oTextbox.value=this._sSavedQuery;}else{this._oTextbox.value=this._sSavedQuery+this._sCurQuery;}}else{this._oTextbox.value=this._sCurQuery;}this._oCurItem=null;return ;}if(C==-2){this._toggleContainer(false);return ;}var B=this._aListItems[C];var E=this._oContainer._oContent;var A=((YAHOO.util.Dom.getStyle(E,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(E,"overflowY")=="auto"));if(A&&(C>-1)&&(C<this._nDisplayedItems)){if(G==40){if((B.offsetTop+B.offsetHeight)>(E.scrollTop+E.offsetHeight)){E.scrollTop=(B.offsetTop+B.offsetHeight)-E.offsetHeight;}else{if((B.offsetTop+B.offsetHeight)<E.scrollTop){E.scrollTop=B.offsetTop;}}}else{if(B.offsetTop<E.scrollTop){this._oContainer._oContent.scrollTop=B.offsetTop;}else{if(B.offsetTop>(E.scrollTop+E.offsetHeight)){this._oContainer._oContent.scrollTop=(B.offsetTop+B.offsetHeight)-E.offsetHeight;}}}}this._toggleHighlight(B,"to");this.itemArrowToEvent.fire(this,B);if(this.typeAhead){this._updateValue(B);}}};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseover");}else{B._toggleHighlight(this,"to");}B.itemMouseOverEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(A,B){if(B.prehighlightClassName){B._togglePrehighlight(this,"mouseout");}else{B._toggleHighlight(this,"from");}B.itemMouseOutEvent.fire(B,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(A,B){B._toggleHighlight(this,"to");B._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,B){B._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,B){B._bOverContainer=false;if(B._oCurItem){B._toggleHighlight(B._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._oTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,C){var D=A.keyCode;switch(D){case 9:if(C._oCurItem){if(C.delimChar&&(C._nKeyCode!=D)){if(C._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}C._selectItem(C._oCurItem);}else{C._toggleContainer(false);}break;case 13:var B=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);if(!B){if(C._oCurItem){if(C._nKeyCode!=D){if(C._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}C._selectItem(C._oCurItem);}else{C._toggleContainer(false);}}break;case 27:C._toggleContainer(false);return ;case 39:C._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(A);C._moveSelection(D);break;case 40:YAHOO.util.Event.stopEvent(A);C._moveSelection(D);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,C){var D=A.keyCode;var B=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);if(B){switch(D){case 9:if(C._oCurItem){if(C.delimChar&&(C._nKeyCode!=D)){YAHOO.util.Event.stopEvent(A);}}break;case 13:if(C._oCurItem){if(C._nKeyCode!=D){if(C._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}C._selectItem(C._oCurItem);}else{C._toggleContainer(false);}break;case 38:case 40:YAHOO.util.Event.stopEvent(A);break;default:break;}}else{if(D==229){C._queryInterval=setInterval(function(){C._onIMEDetected(C);},500);}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(B,D){D._initProps();var E=B.keyCode;D._nKeyCode=E;var C=this.value;if(D._isIgnoreKey(E)||(C.toLowerCase()==D._sCurQuery)){return ;}else{D._bItemSelected=false;YAHOO.util.Dom.removeClass(D._oCurItem,D.highlightClassName);D._oCurItem=null;D.textboxKeyEvent.fire(D,E);}if(D.queryDelay>0){var A=setTimeout(function(){D._sendQuery(C);},(D.queryDelay*1000));if(D._nDelayID!=-1){clearTimeout(D._nDelayID);}D._nDelayID=A;}else{D._sendQuery(C);}};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){B._oTextbox.setAttribute("autocomplete","off");B._bFocused=true;if(!B._bItemSelected){B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,B){if(!B._bOverContainer||(B._nKeyCode==9)){if(!B._bItemSelected){var C=B._textMatchesOption();if(!B._bContainerOpen||(B._bContainerOpen&&(C===null))){if(B.forceSelection){B._clearSelection();}else{B.unmatchedItemSelectEvent.fire(B);}}else{if(B.forceSelection){B._selectItem(C);}}}if(B._bContainerOpen){B._toggleContainer(false);}B._cancelIntervalDetection(B);B._bFocused=false;B.textboxBlurEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._oTextbox&&B.allowBrowserAutocomplete){B._oTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.DataSource=function(){};YAHOO.widget.DataSource.ERROR_DATANULL="Response data was null";YAHOO.widget.DataSource.ERROR_DATAPARSE="Response data could not be parsed";YAHOO.widget.DataSource.prototype.maxCacheEntries=15;YAHOO.widget.DataSource.prototype.queryMatchContains=false;YAHOO.widget.DataSource.prototype.queryMatchSubset=false;YAHOO.widget.DataSource.prototype.queryMatchCase=false;YAHOO.widget.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.widget.DataSource.prototype.getResults=function(A,D,B){var C=this._doQueryCache(A,D,B);
if(C.length===0){this.queryEvent.fire(this,B,D);this.doQuery(A,D,B);}};YAHOO.widget.DataSource.prototype.doQuery=function(A,C,B){};YAHOO.widget.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];}if(this._aCacheHelper){this._aCacheHelper=[];}this.cacheFlushEvent.fire(this);};YAHOO.widget.DataSource.prototype.queryEvent=null;YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;YAHOO.widget.DataSource.prototype.getResultsEvent=null;YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;YAHOO.widget.DataSource.prototype.dataErrorEvent=null;YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;YAHOO.widget.DataSource._nIndex=0;YAHOO.widget.DataSource.prototype._sName=null;YAHOO.widget.DataSource.prototype._aCache=null;YAHOO.widget.DataSource.prototype._init=function(){var A=this.maxCacheEntries;if(!YAHOO.lang.isNumber(A)||(A<0)){A=0;}if(A>0&&!this._aCache){this._aCache=[];}this._sName="instance"+YAHOO.widget.DataSource._nIndex;YAHOO.widget.DataSource._nIndex++;this.queryEvent=new YAHOO.util.CustomEvent("query",this);this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);};YAHOO.widget.DataSource.prototype._addCacheElem=function(B){var A=this._aCache;if(!A||!B||!B.query||!B.results){return ;}if(A.length>=this.maxCacheEntries){A.shift();}A.push(B);};YAHOO.widget.DataSource.prototype._doQueryCache=function(A,I,N){var H=[];var G=false;var J=this._aCache;var F=(J)?J.length:0;var K=this.queryMatchContains;var D;if((this.maxCacheEntries>0)&&J&&(F>0)){this.cacheQueryEvent.fire(this,N,I);if(!this.queryMatchCase){D=I;I=I.toLowerCase();}for(var P=F-1;P>=0;P--){var E=J[P];var B=E.results;var C=(!this.queryMatchCase)?encodeURIComponent(E.query).toLowerCase():encodeURIComponent(E.query);if(C==I){G=true;H=B;if(P!=F-1){J.splice(P,1);this._addCacheElem(E);}break;}else{if(this.queryMatchSubset){for(var O=I.length-1;O>=0;O--){var R=I.substr(0,O);if(C==R){G=true;for(var M=B.length-1;M>=0;M--){var Q=B[M];var L=(this.queryMatchCase)?encodeURIComponent(Q[0]).indexOf(I):encodeURIComponent(Q[0]).toLowerCase().indexOf(I);if((!K&&(L===0))||(K&&(L>-1))){H.unshift(Q);}}E={};E.query=I;E.results=H;this._addCacheElem(E);break;}}if(G){break;}}}}if(G){this.getCachedResultsEvent.fire(this,N,D,H);A(D,H,N);}}return H;};YAHOO.widget.DS_XHR=function(C,A,D){if(D&&(D.constructor==Object)){for(var B in D){this[B]=D[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(C)){return ;}this.schema=A;this.scriptURI=C;this._init();};YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_XHR.TYPE_JSON=0;YAHOO.widget.DS_XHR.TYPE_XML=1;YAHOO.widget.DS_XHR.TYPE_FLAT=2;YAHOO.widget.DS_XHR.ERROR_DATAXHR="XHR response failed";YAHOO.widget.DS_XHR.prototype.connMgr=YAHOO.util.Connect;YAHOO.widget.DS_XHR.prototype.connTimeout=0;YAHOO.widget.DS_XHR.prototype.scriptURI=null;YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n<!-";YAHOO.widget.DS_XHR.prototype.doQuery=function(E,G,B){var J=(this.responseType==YAHOO.widget.DS_XHR.TYPE_XML);var D=this.scriptURI+"?"+this.scriptQueryParam+"="+G;if(this.scriptQueryAppend.length>0){D+="&"+this.scriptQueryAppend;}var C=null;var F=this;var I=function(K){if(!F._oConn||(K.tId!=F._oConn.tId)){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}for(var N in K){}if(!J){K=K.responseText;}else{K=K.responseXML;}if(K===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var M=F.parseResponse(G,K,B);var L={};L.query=decodeURIComponent(G);L.results=M;if(M===null){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DataSource.ERROR_DATAPARSE);M=[];}else{F.getResultsEvent.fire(F,B,G,M);F._addCacheElem(L);}E(G,M,B);};var A=function(K){F.dataErrorEvent.fire(F,B,G,YAHOO.widget.DS_XHR.ERROR_DATAXHR);return ;};var H={success:I,failure:A};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){H.timeout=this.connTimeout;}if(this._oConn){this.connMgr.abort(this._oConn);}F._oConn=this.connMgr.asyncRequest("GET",D,H,null);};YAHOO.widget.DS_XHR.prototype.parseResponse=function(sQuery,oResponse,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var nEnd=((this.responseStripAfter!=="")&&(oResponse.indexOf))?oResponse.indexOf(this.responseStripAfter):-1;if(nEnd!=-1){oResponse=oResponse.substring(0,nEnd);}switch(this.responseType){case YAHOO.widget.DS_XHR.TYPE_JSON:var jsonList,jsonObjParsed;var isNotMac=(navigator.userAgent.toLowerCase().indexOf("khtml")==-1);if(oResponse.parseJSON&&isNotMac){jsonObjParsed=oResponse.parseJSON();if(!jsonObjParsed){bError=true;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(YAHOO.lang.JSON&&isNotMac){jsonObjParsed=YAHOO.lang.JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{if(window.JSON&&isNotMac){jsonObjParsed=JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}catch(e){bError=true;break;}}}else{try{while(oResponse.substring(0,1)==" "){oResponse=oResponse.substring(1,oResponse.length);}if(oResponse.indexOf("{")<0){bError=true;break;}if(oResponse.indexOf("{}")===0){break;}var jsonObjRaw=eval("("+oResponse+")");if(!jsonObjRaw){bError=true;break;}jsonList=eval("(jsonObjRaw."+aSchema[0]+")");}catch(e){bError=true;break;}}}}if(!jsonList){bError=true;break;}if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];
if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}break;case YAHOO.widget.DS_XHR.TYPE_XML:var xmlList=oResponse.getElementsByTagName(aSchema[0]);if(!xmlList){bError=true;break;}for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k);var aFieldSet=[];for(var m=aSchema.length-1;m>=1;m--){var sValue=null;var xmlAttr=result.attributes.getNamedItem(aSchema[m]);if(xmlAttr){sValue=xmlAttr.value;}else{var xmlNode=result.getElementsByTagName(aSchema[m]);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){sValue=xmlNode.item(0).firstChild.nodeValue;}else{sValue="";}}aFieldSet.unshift(sValue);}aResults.unshift(aFieldSet);}break;case YAHOO.widget.DS_XHR.TYPE_FLAT:if(oResponse.length>0){var newLength=oResponse.length-aSchema[0].length;if(oResponse.substr(newLength)==aSchema[0]){oResponse=oResponse.substr(0,newLength);}var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){aResults[n]=aRecords[n].split(aSchema[1]);}}break;default:break;}sQuery=null;oResponse=null;oParent=null;if(bError){return null;}else{return aResults;}};YAHOO.widget.DS_XHR.prototype._oConn=null;YAHOO.widget.DS_ScriptNode=function(D,A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)||!YAHOO.lang.isString(D)){return ;}this.schema=A;this.scriptURI=D;this._init();};YAHOO.widget.DS_ScriptNode.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_ScriptNode.prototype.getUtility=YAHOO.util.Get;YAHOO.widget.DS_ScriptNode.prototype.scriptURI=null;YAHOO.widget.DS_ScriptNode.prototype.scriptQueryParam="query";YAHOO.widget.DS_ScriptNode.prototype.asyncMode="allowAll";YAHOO.widget.DS_ScriptNode.prototype.scriptCallbackParam="callback";YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;YAHOO.widget.DS_ScriptNode._nPending=0;YAHOO.widget.DS_ScriptNode.prototype.doQuery=function(A,F,C){var B=this;if(YAHOO.widget.DS_ScriptNode._nPending===0){YAHOO.widget.DS_ScriptNode.callbacks=[];YAHOO.widget.DS_ScriptNode._nId=0;}var E=YAHOO.widget.DS_ScriptNode._nId;YAHOO.widget.DS_ScriptNode._nId++;YAHOO.widget.DS_ScriptNode.callbacks[E]=function(G){if((B.asyncMode!=="ignoreStaleResponses")||(E===YAHOO.widget.DS_ScriptNode.callbacks.length-1)){B.handleResponse(G,A,F,C);}else{}delete YAHOO.widget.DS_ScriptNode.callbacks[E];};YAHOO.widget.DS_ScriptNode._nPending++;var D=this.scriptURI+"&"+this.scriptQueryParam+"="+F+"&"+this.scriptCallbackParam+"=YAHOO.widget.DS_ScriptNode.callbacks["+E+"]";this.getUtility.script(D,{autopurge:true,onsuccess:YAHOO.widget.DS_ScriptNode._bumpPendingDown,onfail:YAHOO.widget.DS_ScriptNode._bumpPendingDown});};YAHOO.widget.DS_ScriptNode.prototype.handleResponse=function(oResponse,oCallbackFn,sQuery,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var jsonList,jsonObjParsed;try{jsonList=eval("(oResponse."+aSchema[0]+")");}catch(e){bError=true;}if(!jsonList){bError=true;jsonList=[];}else{if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}}for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}aResultItem.unshift(dataFieldValue);}if(aResultItem.length==1){aResultItem.push(jsonResult);}aResults.unshift(aResultItem);}if(bError){aResults=null;}if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATAPARSE);aResults=[];}else{var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);}oCallbackFn(sQuery,aResults,oParent);};YAHOO.widget.DS_ScriptNode._bumpPendingDown=function(){YAHOO.widget.DS_ScriptNode._nPending--;};YAHOO.widget.DS_JSFunction=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isFunction(A)){return ;}else{this.dataFunction=A;this._init();}};YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;YAHOO.widget.DS_JSFunction.prototype.doQuery=function(C,F,D){var B=this.dataFunction;var E=[];E=B(F);if(E===null){this.dataErrorEvent.fire(this,D,F,YAHOO.widget.DataSource.ERROR_DATANULL);return ;}var A={};A.query=decodeURIComponent(F);A.results=E;this._addCacheElem(A);this.getResultsEvent.fire(this,D,F,E);C(F,E,D);return ;};YAHOO.widget.DS_JSArray=function(A,C){if(C&&(C.constructor==Object)){for(var B in C){this[B]=C[B];}}if(!YAHOO.lang.isArray(A)){return ;}else{this.data=A;this._init();}};YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSArray.prototype.data=null;YAHOO.widget.DS_JSArray.prototype.doQuery=function(E,I,A){var F;var C=this.data;var J=[];var D=false;var B=this.queryMatchContains;if(I){if(!this.queryMatchCase){I=I.toLowerCase();}for(F=C.length-1;F>=0;F--){var H=[];if(YAHOO.lang.isString(C[F])){H[0]=C[F];}else{if(YAHOO.lang.isArray(C[F])){H=C[F];}}if(YAHOO.lang.isString(H[0])){var G=(this.queryMatchCase)?encodeURIComponent(H[0]).indexOf(I):encodeURIComponent(H[0]).toLowerCase().indexOf(I);if((!B&&(G===0))||(B&&(G>-1))){J.unshift(H);}}}}else{for(F=C.length-1;F>=0;F--){if(YAHOO.lang.isString(C[F])){J.unshift([C[F]]);}else{if(YAHOO.lang.isArray(C[F])){J.unshift(C[F]);}}}}this.getResultsEvent.fire(this,A,I,J);E(I,J,A);};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.4.1",build:"742"});
// Content: calendar-min-new
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
*/
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F,E;for(F in this.config){E=this.config[F];if(E&&E.event){D[F]=E.value;}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){this.refireEvent(D);}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,add:function(A,D,C){var F=new Date(A.getTime());switch(D){case this.MONTH:var E=A.getMonth()+C;var B=0;if(E<0){while(E<0){E+=12;B-=1;}}else{if(E>11){while(E>11){E-=12;B+=1;}}}F.setMonth(E);F.setFullYear(A.getFullYear()+B);break;case this.DAY:F.setDate(A.getDate()+C);break;case this.YEAR:F.setFullYear(A.getFullYear()+C);break;case this.WEEK:F.setDate(A.getDate()+(C*7));break;}return F;},subtract:function(A,C,B){return this.add(A,C,(B*-1));},before:function(C,B){var A=B.getTime();if(C.getTime()<A){return true;}else{return false;}},after:function(C,B){var A=B.getTime();if(C.getTime()>A){return true;}else{return false;}},between:function(B,A,C){if(this.after(B,A)&&this.before(B,C)){return true;}else{return false;}},getJan1:function(A){return this.getDate(A,0,1);},getDayOffset:function(B,D){var C=this.getJan1(D);var A=Math.ceil((B.getTime()-C.getTime())/this.ONE_DAY_MS);return A;},getWeekNumber:function(C,F){C=this.clearTime(C);var E=new Date(C.getTime()+(4*this.ONE_DAY_MS)-((C.getDay())*this.ONE_DAY_MS));var B=this.getDate(E.getFullYear(),0,1);var A=((E.getTime()-B.getTime())/this.ONE_DAY_MS)-1;var D=Math.ceil((A)/7);return D;},isYearOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getFullYear()!=A.getFullYear()){C=true;}return C;},isMonthOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getMonth()!=A.getMonth()){C=true;}return C;},findMonthStart:function(A){var B=this.getDate(A.getFullYear(),A.getMonth(),1);return B;},findMonthEnd:function(B){var D=this.findMonthStart(B);var C=this.add(D,this.MONTH,1);var A=this.subtract(C,this.DAY,1);return A;},clearTime:function(A){A.setHours(12,0,0,0);
return A;},getDate:function(D,A,C){var B=null;if(YAHOO.lang.isUndefined(C)){C=1;}if(D>=100){B=new Date(D,A,C);}else{B=new Date();B.setFullYear(D);B.setMonth(A);B.setDate(C);B.setHours(0,0,0,0);}return B;}};YAHOO.widget.Calendar=function(C,A,B){this.init.apply(this,arguments);};YAHOO.widget.Calendar.IMG_ROOT=null;YAHOO.widget.Calendar.DATE="D";YAHOO.widget.Calendar.MONTH_DAY="MD";YAHOO.widget.Calendar.WEEKDAY="WD";YAHOO.widget.Calendar.RANGE="R";YAHOO.widget.Calendar.MONTH="M";YAHOO.widget.Calendar.DISPLAY_DAYS=42;YAHOO.widget.Calendar.STOP_RENDER="S";YAHOO.widget.Calendar.SHORT="short";YAHOO.widget.Calendar.LONG="long";YAHOO.widget.Calendar.MEDIUM="medium";YAHOO.widget.Calendar.ONE_CHAR="1char";YAHOO.widget.Calendar._DEFAULT_CONFIG={PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null}};YAHOO.widget.Calendar._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};YAHOO.widget.Calendar._STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};YAHOO.widget.Calendar.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(B){var A={id:null,container:null,config:null};if(B&&B.length&&B.length>0){switch(B.length){case 1:A.id=null;A.container=B[0];A.config=null;break;case 2:if(YAHOO.lang.isObject(B[1])&&!B[1].tagName&&!(B[1] instanceof String)){A.id=null;A.container=B[0];A.config=B[1];}else{A.id=B[0];A.container=B[1];A.config=null;}break;default:A.id=B[0];A.container=B[1];A.config=B[2];break;}}else{}return A;},init:function(D,B,C){var A=this._parseArgs(arguments);D=A.id;B=A.container;C=A.config;this.oDomContainer=YAHOO.util.Dom.get(B);if(!this.oDomContainer.id){this.oDomContainer.id=YAHOO.util.Dom.generateId();}if(!D){D=this.oDomContainer.id+"_t";}this.id=D;this.containerId=this.oDomContainer.id;this.initEvents();this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(C){this.cfg.applyConfig(C,true);}this.cfg.fireQueue();},configIframe:function(C,B,D){var A=B[0];if(!this.parent){if(YAHOO.util.Dom.inDocument(this.oDomContainer)){if(A){var E=YAHOO.util.Dom.getStyle(this.oDomContainer,"position");if(E=="absolute"||E=="relative"){if(!YAHOO.util.Dom.inDocument(this.iframe)){this.iframe=document.createElement("iframe");
this.iframe.src="javascript:false;";YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){YAHOO.util.Dom.addClass(this.iframe,"fixedsize");}this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;}}}}},configTitle:function(B,A,C){var E=A[0];if(E){this.createTitleBar(E);}else{var D=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);if(!D){this.removeTitleBar();}else{this.createTitleBar("&#160;");}}},configClose:function(B,A,C){var E=A[0],D=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);if(E){if(!D){this.createTitleBar("&#160;");}this.createCloseButton();}else{this.removeCloseButton();if(!D){this.removeTitleBar();}}},initEvents:function(){var A=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(A.BEFORE_SELECT);this.selectEvent=new YAHOO.util.CustomEvent(A.SELECT);this.beforeDeselectEvent=new YAHOO.util.CustomEvent(A.BEFORE_DESELECT);this.deselectEvent=new YAHOO.util.CustomEvent(A.DESELECT);this.changePageEvent=new YAHOO.util.CustomEvent(A.CHANGE_PAGE);this.beforeRenderEvent=new YAHOO.util.CustomEvent(A.BEFORE_RENDER);this.renderEvent=new YAHOO.util.CustomEvent(A.RENDER);this.resetEvent=new YAHOO.util.CustomEvent(A.RESET);this.clearEvent=new YAHOO.util.CustomEvent(A.CLEAR);this.beforeShowEvent=new YAHOO.util.CustomEvent(A.BEFORE_SHOW);this.showEvent=new YAHOO.util.CustomEvent(A.SHOW);this.beforeHideEvent=new YAHOO.util.CustomEvent(A.BEFORE_HIDE);this.hideEvent=new YAHOO.util.CustomEvent(A.HIDE);this.beforeShowNavEvent=new YAHOO.util.CustomEvent(A.BEFORE_SHOW_NAV);this.showNavEvent=new YAHOO.util.CustomEvent(A.SHOW_NAV);this.beforeHideNavEvent=new YAHOO.util.CustomEvent(A.BEFORE_HIDE_NAV);this.hideNavEvent=new YAHOO.util.CustomEvent(A.HIDE_NAV);this.beforeRenderNavEvent=new YAHOO.util.CustomEvent(A.BEFORE_RENDER_NAV);this.renderNavEvent=new YAHOO.util.CustomEvent(A.RENDER_NAV);this.beforeSelectEvent.subscribe(this.onBeforeSelect,this,true);this.selectEvent.subscribe(this.onSelect,this,true);this.beforeDeselectEvent.subscribe(this.onBeforeDeselect,this,true);this.deselectEvent.subscribe(this.onDeselect,this,true);this.changePageEvent.subscribe(this.onChangePage,this,true);this.renderEvent.subscribe(this.onRender,this,true);this.resetEvent.subscribe(this.onReset,this,true);this.clearEvent.subscribe(this.onClear,this,true);},doSelectCell:function(G,A){var L,F,I,C;var H=YAHOO.util.Event.getTarget(G);var B=H.tagName.toLowerCase();var E=false;while(B!="td"&&!YAHOO.util.Dom.hasClass(H,A.Style.CSS_CELL_SELECTABLE)){if(!E&&B=="a"&&YAHOO.util.Dom.hasClass(H,A.Style.CSS_CELL_SELECTOR)){E=true;}H=H.parentNode;B=H.tagName.toLowerCase();if(B=="html"){return ;}}if(E){YAHOO.util.Event.preventDefault(G);}L=H;if(YAHOO.util.Dom.hasClass(L,A.Style.CSS_CELL_SELECTABLE)){F=L.id.split("cell")[1];I=A.cellDates[F];C=YAHOO.widget.DateMath.getDate(I[0],I[1]-1,I[2]);var K;if(A.Options.MULTI_SELECT){K=L.getElementsByTagName("a")[0];if(K){K.blur();}var D=A.cellDates[F];var J=A._indexOfSelectedFieldArray(D);if(J>-1){A.deselectCell(F);}else{A.selectCell(F);}}else{K=L.getElementsByTagName("a")[0];if(K){K.blur();}A.selectCell(F);}}},doCellMouseOver:function(C,B){var A;if(C){A=YAHOO.util.Event.getTarget(C);}else{A=this;}while(A.tagName&&A.tagName.toLowerCase()!="td"){A=A.parentNode;if(!A.tagName||A.tagName.toLowerCase()=="html"){return ;}}if(YAHOO.util.Dom.hasClass(A,B.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.addClass(A,B.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(C,B){var A;if(C){A=YAHOO.util.Event.getTarget(C);}else{A=this;}while(A.tagName&&A.tagName.toLowerCase()!="td"){A=A.parentNode;if(!A.tagName||A.tagName.toLowerCase()=="html"){return ;}}if(YAHOO.util.Dom.hasClass(A,B.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.removeClass(A,B.Style.CSS_CELL_HOVER);}},setupConfig:function(){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.addProperty(A.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(A.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(A.TITLE.key,{value:A.TITLE.value,handler:this.configTitle});this.cfg.addProperty(A.CLOSE.key,{value:A.CLOSE.value,handler:this.configClose});this.cfg.addProperty(A.IFRAME.key,{value:A.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.MINDATE.key,{value:A.MINDATE.value,handler:this.configMinDate});this.cfg.addProperty(A.MAXDATE.key,{value:A.MAXDATE.value,handler:this.configMaxDate});this.cfg.addProperty(A.MULTI_SELECT.key,{value:A.MULTI_SELECT.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.START_WEEKDAY.key,{value:A.START_WEEKDAY.value,handler:this.configOptions,validator:this.cfg.checkNumber});this.cfg.addProperty(A.SHOW_WEEKDAYS.key,{value:A.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_HEADER.key,{value:A.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_FOOTER.key,{value:A.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.HIDE_BLANK_WEEKS.key,{value:A.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.NAV_ARROW_LEFT.key,{value:A.NAV_ARROW_LEFT.value,handler:this.configOptions});this.cfg.addProperty(A.NAV_ARROW_RIGHT.key,{value:A.NAV_ARROW_RIGHT.value,handler:this.configOptions});this.cfg.addProperty(A.MONTHS_SHORT.key,{value:A.MONTHS_SHORT.value,handler:this.configLocale});this.cfg.addProperty(A.MONTHS_LONG.key,{value:A.MONTHS_LONG.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_1CHAR.key,{value:A.WEEKDAYS_1CHAR.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_SHORT.key,{value:A.WEEKDAYS_SHORT.value,handler:this.configLocale});
this.cfg.addProperty(A.WEEKDAYS_MEDIUM.key,{value:A.WEEKDAYS_MEDIUM.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_LONG.key,{value:A.WEEKDAYS_LONG.value,handler:this.configLocale});var B=function(){this.cfg.refireEvent(A.LOCALE_MONTHS.key);this.cfg.refireEvent(A.LOCALE_WEEKDAYS.key);};this.cfg.subscribeToConfigEvent(A.START_WEEKDAY.key,B,this,true);this.cfg.subscribeToConfigEvent(A.MONTHS_SHORT.key,B,this,true);this.cfg.subscribeToConfigEvent(A.MONTHS_LONG.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_1CHAR.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_SHORT.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_MEDIUM.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_LONG.key,B,this,true);this.cfg.addProperty(A.LOCALE_MONTHS.key,{value:A.LOCALE_MONTHS.value,handler:this.configLocaleValues});this.cfg.addProperty(A.LOCALE_WEEKDAYS.key,{value:A.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});this.cfg.addProperty(A.DATE_DELIMITER.key,{value:A.DATE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.DATE_FIELD_DELIMITER.key,{value:A.DATE_FIELD_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.DATE_RANGE_DELIMITER.key,{value:A.DATE_RANGE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.MY_MONTH_POSITION.key,{value:A.MY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_YEAR_POSITION.key,{value:A.MY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_MONTH_POSITION.key,{value:A.MD_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_DAY_POSITION.key,{value:A.MD_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_MONTH_POSITION.key,{value:A.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_DAY_POSITION.key,{value:A.MDY_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_YEAR_POSITION.key,{value:A.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_POSITION.key,{value:A.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_YEAR_POSITION.key,{value:A.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_SUFFIX.key,{value:A.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});this.cfg.addProperty(A.MY_LABEL_YEAR_SUFFIX.key,{value:A.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});this.cfg.addProperty(A.NAV.key,{value:A.NAV.value,handler:this.configNavigator});},configPageDate:function(B,A,C){this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key,this._parsePageDate(A[0]),true);},configMinDate:function(B,A,C){var D=A[0];if(YAHOO.lang.isString(D)){D=this._parseDate(D);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key,YAHOO.widget.DateMath.getDate(D[0],(D[1]-1),D[2]));}},configMaxDate:function(B,A,C){var D=A[0];if(YAHOO.lang.isString(D)){D=this._parseDate(D);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key,YAHOO.widget.DateMath.getDate(D[0],(D[1]-1),D[2]));}},configSelected:function(C,A,E){var B=A[0];var D=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;if(B){if(YAHOO.lang.isString(B)){this.cfg.setProperty(D,this._parseDates(B),true);}}if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(D);}},configOptions:function(B,A,C){this.Options[B.toUpperCase()]=A[0];},configLocale:function(C,B,D){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.Locale[C.toUpperCase()]=B[0];this.cfg.refireEvent(A.LOCALE_MONTHS.key);this.cfg.refireEvent(A.LOCALE_WEEKDAYS.key);},configLocaleValues:function(D,C,E){var B=YAHOO.widget.Calendar._DEFAULT_CONFIG;D=D.toLowerCase();var G=C[0];switch(D){case B.LOCALE_MONTHS.key:switch(G){case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(B.MONTHS_SHORT.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(B.MONTHS_LONG.key).concat();break;}break;case B.LOCALE_WEEKDAYS.key:switch(G){case YAHOO.widget.Calendar.ONE_CHAR:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_1CHAR.key).concat();break;case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_SHORT.key).concat();break;case YAHOO.widget.Calendar.MEDIUM:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_MEDIUM.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_LONG.key).concat();break;}var F=this.cfg.getProperty(B.START_WEEKDAY.key);if(F>0){for(var A=0;A<F;++A){this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());}}break;}},configNavigator:function(C,A,D){var E=A[0];if(YAHOO.widget.CalendarNavigator&&(E===true||YAHOO.lang.isObject(E))){if(!this.oNavigator){this.oNavigator=new YAHOO.widget.CalendarNavigator(this);function B(){if(!this.pages){this.oNavigator.erase();}}this.beforeRenderEvent.subscribe(B,this,true);}}else{if(this.oNavigator){this.oNavigator.destroy();this.oNavigator=null;}}},initStyles:function(){var A=YAHOO.widget.Calendar._STYLES;this.Style={CSS_ROW_HEADER:A.CSS_ROW_HEADER,CSS_ROW_FOOTER:A.CSS_ROW_FOOTER,CSS_CELL:A.CSS_CELL,CSS_CELL_SELECTOR:A.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:A.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:A.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:A.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:A.CSS_CELL_TODAY,CSS_CELL_OOM:A.CSS_CELL_OOM,CSS_CELL_OOB:A.CSS_CELL_OOB,CSS_HEADER:A.CSS_HEADER,CSS_HEADER_TEXT:A.CSS_HEADER_TEXT,CSS_BODY:A.CSS_BODY,CSS_WEEKDAY_CELL:A.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:A.CSS_WEEKDAY_ROW,CSS_FOOTER:A.CSS_FOOTER,CSS_CALENDAR:A.CSS_CALENDAR,CSS_SINGLE:A.CSS_SINGLE,CSS_CONTAINER:A.CSS_CONTAINER,CSS_NAV_LEFT:A.CSS_NAV_LEFT,CSS_NAV_RIGHT:A.CSS_NAV_RIGHT,CSS_NAV:A.CSS_NAV,CSS_CLOSE:A.CSS_CLOSE,CSS_CELL_TOP:A.CSS_CELL_TOP,CSS_CELL_LEFT:A.CSS_CELL_LEFT,CSS_CELL_RIGHT:A.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:A.CSS_CELL_BOTTOM,CSS_CELL_HOVER:A.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:A.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:A.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:A.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:A.CSS_CELL_HIGHLIGHT4};
},buildMonthLabel:function(){var A=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);var C=this.Locale.LOCALE_MONTHS[A.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX;var B=A.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return B+C;}else{return C+B;}},buildDayLabel:function(A){return A.getDate();},createTitleBar:function(A){var B=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");B.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;B.innerHTML=A;this.oDomContainer.insertBefore(B,this.oDomContainer.firstChild);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");return B;},removeTitleBar:function(){var A=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(A){YAHOO.util.Event.purgeElement(A);this.oDomContainer.removeChild(A);}YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");},createCloseButton:function(){var D=YAHOO.util.Dom,A=YAHOO.util.Event,C=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,F="us/my/bn/x_d.gif";var E=D.getElementsByClassName("link-close","a",this.oDomContainer)[0];if(!E){E=document.createElement("a");A.addListener(E,"click",function(H,G){G.hide();A.preventDefault(H);},this);}E.href="#";E.className="link-close";if(YAHOO.widget.Calendar.IMG_ROOT!==null){var B=D.getElementsByClassName(C,"img",E)[0]||document.createElement("img");B.src=YAHOO.widget.Calendar.IMG_ROOT+F;B.className=C;E.appendChild(B);}else{E.innerHTML="<span class=\""+C+" "+this.Style.CSS_CLOSE+"\"></span>";}this.oDomContainer.appendChild(E);return E;},removeCloseButton:function(){var A=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(A){YAHOO.util.Event.purgeElement(A);this.oDomContainer.removeChild(A);}},renderHeader:function(E){var H=7;var F="us/tr/callt.gif";var G="us/tr/calrt.gif";var M=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(this.cfg.getProperty(M.SHOW_WEEK_HEADER.key)){H+=1;}if(this.cfg.getProperty(M.SHOW_WEEK_FOOTER.key)){H+=1;}E[E.length]="<thead>";E[E.length]="<tr>";E[E.length]="<th colspan=\""+H+"\" class=\""+this.Style.CSS_HEADER_TEXT+"\">";E[E.length]="<div class=\""+this.Style.CSS_HEADER+"\">";var K,L=false;if(this.parent){if(this.index===0){K=true;}if(this.index==(this.parent.cfg.getProperty("pages")-1)){L=true;}}else{K=true;L=true;}if(K){var A=this.cfg.getProperty(M.NAV_ARROW_LEFT.key);if(A===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){A=YAHOO.widget.Calendar.IMG_ROOT+F;}var C=(A===null)?"":" style=\"background-image:url("+A+")\"";E[E.length]="<a class=\""+this.Style.CSS_NAV_LEFT+"\""+C+" >&#160;</a>";}var J=this.buildMonthLabel();var B=this.parent||this;if(B.cfg.getProperty("navigator")){J="<a class=\""+this.Style.CSS_NAV+"\" href=\"#\">"+J+"</a>";}E[E.length]=J;if(L){var D=this.cfg.getProperty(M.NAV_ARROW_RIGHT.key);if(D===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){D=YAHOO.widget.Calendar.IMG_ROOT+G;}var I=(D===null)?"":" style=\"background-image:url("+D+")\"";E[E.length]="<a class=\""+this.Style.CSS_NAV_RIGHT+"\""+I+" >&#160;</a>";}E[E.length]="</div>\n</th>\n</tr>";if(this.cfg.getProperty(M.SHOW_WEEKDAYS.key)){E=this.buildWeekdays(E);}E[E.length]="</thead>";return E;},buildWeekdays:function(C){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;C[C.length]="<tr class=\""+this.Style.CSS_WEEKDAY_ROW+"\">";if(this.cfg.getProperty(A.SHOW_WEEK_HEADER.key)){C[C.length]="<th>&#160;</th>";}for(var B=0;B<this.Locale.LOCALE_WEEKDAYS.length;++B){C[C.length]="<th class=\"calweekdaycell\">"+this.Locale.LOCALE_WEEKDAYS[B]+"</th>";}if(this.cfg.getProperty(A.SHOW_WEEK_FOOTER.key)){C[C.length]="<th>&#160;</th>";}C[C.length]="</tr>";return C;},renderBody:function(c,a){var m=YAHOO.widget.Calendar._DEFAULT_CONFIG;var AB=this.cfg.getProperty(m.START_WEEKDAY.key);this.preMonthDays=c.getDay();if(AB>0){this.preMonthDays-=AB;}if(this.preMonthDays<0){this.preMonthDays+=7;}this.monthDays=YAHOO.widget.DateMath.findMonthEnd(c).getDate();this.postMonthDays=YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;c=YAHOO.widget.DateMath.subtract(c,YAHOO.widget.DateMath.DAY,this.preMonthDays);var Q,H;var G="w";var W="_cell";var U="wd";var k="d";var I;var h;var O=this.today.getFullYear();var j=this.today.getMonth();var D=this.today.getDate();var q=this.cfg.getProperty(m.PAGEDATE.key);var C=this.cfg.getProperty(m.HIDE_BLANK_WEEKS.key);var Z=this.cfg.getProperty(m.SHOW_WEEK_FOOTER.key);var T=this.cfg.getProperty(m.SHOW_WEEK_HEADER.key);var M=this.cfg.getProperty(m.MINDATE.key);var S=this.cfg.getProperty(m.MAXDATE.key);if(M){M=YAHOO.widget.DateMath.clearTime(M);}if(S){S=YAHOO.widget.DateMath.clearTime(S);}a[a.length]="<tbody class=\"m"+(q.getMonth()+1)+" "+this.Style.CSS_BODY+"\">";var z=0;var J=document.createElement("div");var b=document.createElement("td");J.appendChild(b);var o=this.parent||this;for(var u=0;u<6;u++){Q=YAHOO.widget.DateMath.getWeekNumber(c,q.getFullYear(),AB);H=G+Q;if(u!==0&&C===true&&c.getMonth()!=q.getMonth()){break;}else{a[a.length]="<tr class=\""+H+"\">";if(T){a=this.renderRowHeader(Q,a);}for(var AA=0;AA<7;AA++){I=[];this.clearElement(b);b.className=this.Style.CSS_CELL;b.id=this.id+W+z;if(c.getDate()==D&&c.getMonth()==j&&c.getFullYear()==O){I[I.length]=o.renderCellStyleToday;}var R=[c.getFullYear(),c.getMonth()+1,c.getDate()];this.cellDates[this.cellDates.length]=R;if(c.getMonth()!=q.getMonth()){I[I.length]=o.renderCellNotThisMonth;}else{YAHOO.util.Dom.addClass(b,U+c.getDay());YAHOO.util.Dom.addClass(b,k+c.getDate());for(var t=0;t<this.renderStack.length;++t){h=null;var l=this.renderStack[t];var AC=l[0];var B;var V;var F;switch(AC){case YAHOO.widget.Calendar.DATE:B=l[1][1];V=l[1][2];F=l[1][0];if(c.getMonth()+1==B&&c.getDate()==V&&c.getFullYear()==F){h=l[2];this.renderStack.splice(t,1);}break;case YAHOO.widget.Calendar.MONTH_DAY:B=l[1][0];V=l[1][1];if(c.getMonth()+1==B&&c.getDate()==V){h=l[2];this.renderStack.splice(t,1);
}break;case YAHOO.widget.Calendar.RANGE:var Y=l[1][0];var X=l[1][1];var e=Y[1];var L=Y[2];var P=Y[0];var y=YAHOO.widget.DateMath.getDate(P,e-1,L);var E=X[1];var g=X[2];var A=X[0];var w=YAHOO.widget.DateMath.getDate(A,E-1,g);if(c.getTime()>=y.getTime()&&c.getTime()<=w.getTime()){h=l[2];if(c.getTime()==w.getTime()){this.renderStack.splice(t,1);}}break;case YAHOO.widget.Calendar.WEEKDAY:var K=l[1][0];if(c.getDay()+1==K){h=l[2];}break;case YAHOO.widget.Calendar.MONTH:B=l[1][0];if(c.getMonth()+1==B){h=l[2];}break;}if(h){I[I.length]=h;}}}if(this._indexOfSelectedFieldArray(R)>-1){I[I.length]=o.renderCellStyleSelected;}if((M&&(c.getTime()<M.getTime()))||(S&&(c.getTime()>S.getTime()))){I[I.length]=o.renderOutOfBoundsDate;}else{I[I.length]=o.styleCellDefault;I[I.length]=o.renderCellDefault;}for(var n=0;n<I.length;++n){if(I[n].call(o,c,b)==YAHOO.widget.Calendar.STOP_RENDER){break;}}c.setTime(c.getTime()+YAHOO.widget.DateMath.ONE_DAY_MS);if(z>=0&&z<=6){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_TOP);}if((z%7)===0){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_LEFT);}if(((z+1)%7)===0){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_RIGHT);}var f=this.postMonthDays;if(C&&f>=7){var N=Math.floor(f/7);for(var v=0;v<N;++v){f-=7;}}if(z>=((this.preMonthDays+f+this.monthDays)-7)){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_BOTTOM);}a[a.length]=J.innerHTML;z++;}if(Z){a=this.renderRowFooter(Q,a);}a[a.length]="</tr>";}}a[a.length]="</tbody>";return a;},renderFooter:function(A){return A;},render:function(){this.beforeRenderEvent.fire();var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;var C=YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(A.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;YAHOO.util.Event.purgeElement(this.oDomContainer,true);var B=[];B[B.length]="<table cellSpacing=\"0\" class=\""+this.Style.CSS_CALENDAR+" y"+C.getFullYear()+"\" id=\""+this.id+"\">";B=this.renderHeader(B);B=this.renderBody(C,B);B=this.renderFooter(B);B[B.length]="</table>";this.oDomContainer.innerHTML=B.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(A.TITLE.key);this.cfg.refireEvent(A.CLOSE.key);this.cfg.refireEvent(A.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var K=this.oDomContainer;var B=this.parent||this;var G="a";var D="mousedown";var H=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,G,K);var C=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,G,K);if(H&&H.length>0){this.linkLeft=H[0];YAHOO.util.Event.addListener(this.linkLeft,D,B.previousMonth,B,true);}if(C&&C.length>0){this.linkRight=C[0];YAHOO.util.Event.addListener(this.linkRight,D,B.nextMonth,B,true);}if(B.cfg.getProperty("navigator")!==null){this.applyNavListeners();}if(this.domEventMap){var E,A;for(var M in this.domEventMap){if(YAHOO.lang.hasOwnProperty(this.domEventMap,M)){var I=this.domEventMap[M];if(!(I instanceof Array)){I=[I];}for(var F=0;F<I.length;F++){var L=I[F];A=YAHOO.util.Dom.getElementsByClassName(M,L.tag,this.oDomContainer);for(var J=0;J<A.length;J++){E=A[J];YAHOO.util.Event.addListener(E,L.event,L.handler,L.scope,L.correct);}}}}}YAHOO.util.Event.addListener(this.oDomContainer,"click",this.doSelectCell,this);YAHOO.util.Event.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);YAHOO.util.Event.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);},applyNavListeners:function(){var D=YAHOO.util.Event;var C=this.parent||this;var F=this;var B=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV,"a",this.oDomContainer);if(B.length>0){function A(J,I){var H=D.getTarget(J);if(this===H||YAHOO.util.Dom.isAncestor(this,H)){D.preventDefault(J);}var E=C.oNavigator;if(E){var G=F.cfg.getProperty("pagedate");E.setYear(G.getFullYear());E.setMonth(G.getMonth());E.show();}}D.addListener(B,"click",A);}},getDateByCellId:function(B){var A=this.getDateFieldsByCellId(B);return YAHOO.widget.DateMath.getDate(A[0],A[1]-1,A[2]);},getDateFieldsByCellId:function(A){A=A.toLowerCase().split("_cell")[1];A=parseInt(A,10);return this.cellDates[A];},getCellIndex:function(C){var B=-1;if(C){var A=C.getMonth(),H=C.getFullYear(),G=C.getDate(),E=this.cellDates;for(var D=0;D<E.length;++D){var F=E[D];if(F[0]===H&&F[1]===A+1&&F[2]===G){B=D;break;}}}return B;},renderOutOfBoundsDate:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_OOB);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;},renderRowHeader:function(B,A){A[A.length]="<th class=\"calrowhead\">"+B+"</th>";return A;},renderRowFooter:function(B,A){A[A.length]="<th class=\"calrowfoot\">"+B+"</th>";return A;},renderCellDefault:function(B,A){A.innerHTML="<a href=\"#\" class=\""+this.Style.CSS_CELL_SELECTOR+"\">"+this.buildDayLabel(B)+"</a>";},styleCellDefault:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_OOM);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;},renderBodyCellRestricted:function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL);YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_RESTRICTED);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;},addMonths:function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.add(this.cfg.getProperty(A),YAHOO.widget.DateMath.MONTH,B));this.resetRenderers();
this.changePageEvent.fire();},subtractMonths:function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(A),YAHOO.widget.DateMath.MONTH,B));this.resetRenderers();this.changePageEvent.fire();},addYears:function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.add(this.cfg.getProperty(A),YAHOO.widget.DateMath.YEAR,B));this.resetRenderers();this.changePageEvent.fire();},subtractYears:function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(A),YAHOO.widget.DateMath.YEAR,B));this.resetRenderers();this.changePageEvent.fire();},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.subtractMonths(1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.subtractYears(1);},reset:function(){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.resetProperty(A.SELECTED.key);this.cfg.resetProperty(A.PAGEDATE.key);this.resetEvent.fire();},clear:function(){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.setProperty(A.SELECTED.key,[]);this.cfg.setProperty(A.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(C){var F=this._toFieldArray(C);var B=[];var E=[];var G=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var A=0;A<F.length;++A){var D=F[A];if(!this.isDateOOB(this._toDate(D))){if(B.length===0){this.beforeSelectEvent.fire();E=this.cfg.getProperty(G);}B.push(D);if(this._indexOfSelectedFieldArray(D)==-1){E[E.length]=D;}}}if(B.length>0){if(this.parent){this.parent.cfg.setProperty(G,E);}else{this.cfg.setProperty(G,E);}this.selectEvent.fire(B);}return this.getSelectedDates();},selectCell:function(D){var B=this.cells[D];var H=this.cellDates[D];var G=this._toDate(H);var C=YAHOO.util.Dom.hasClass(B,this.Style.CSS_CELL_SELECTABLE);if(C){this.beforeSelectEvent.fire();var F=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var E=this.cfg.getProperty(F);var A=H.concat();if(this._indexOfSelectedFieldArray(A)==-1){E[E.length]=A;}if(this.parent){this.parent.cfg.setProperty(F,E);}else{this.cfg.setProperty(F,E);}this.renderCellStyleSelected(G,B);this.selectEvent.fire([A]);this.doCellMouseOut.call(B,null,this);}return this.getSelectedDates();},deselect:function(E){var A=this._toFieldArray(E);var D=[];var G=[];var H=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var B=0;B<A.length;++B){var F=A[B];if(!this.isDateOOB(this._toDate(F))){if(D.length===0){this.beforeDeselectEvent.fire();G=this.cfg.getProperty(H);}D.push(F);var C=this._indexOfSelectedFieldArray(F);if(C!=-1){G.splice(C,1);}}}if(D.length>0){if(this.parent){this.parent.cfg.setProperty(H,G);}else{this.cfg.setProperty(H,G);}this.deselectEvent.fire(D);}return this.getSelectedDates();},deselectCell:function(E){var H=this.cells[E];var B=this.cellDates[E];var F=this._indexOfSelectedFieldArray(B);var G=YAHOO.util.Dom.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(G){this.beforeDeselectEvent.fire();var I=YAHOO.widget.Calendar._DEFAULT_CONFIG;var D=this.cfg.getProperty(I.SELECTED.key);var C=this._toDate(B);var A=B.concat();if(F>-1){if(this.cfg.getProperty(I.PAGEDATE.key).getMonth()==C.getMonth()&&this.cfg.getProperty(I.PAGEDATE.key).getFullYear()==C.getFullYear()){YAHOO.util.Dom.removeClass(H,this.Style.CSS_CELL_SELECTED);}D.splice(F,1);}if(this.parent){this.parent.cfg.setProperty(I.SELECTED.key,D);}else{this.cfg.setProperty(I.SELECTED.key,D);}this.deselectEvent.fire(A);}return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var D=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var A=this.cfg.getProperty(D);var B=A.length;var C=A.concat();if(this.parent){this.parent.cfg.setProperty(D,[]);}else{this.cfg.setProperty(D,[]);}if(B>0){this.deselectEvent.fire(C);}return this.getSelectedDates();},_toFieldArray:function(B){var A=[];if(B instanceof Date){A=[[B.getFullYear(),B.getMonth()+1,B.getDate()]];}else{if(YAHOO.lang.isString(B)){A=this._parseDates(B);}else{if(YAHOO.lang.isArray(B)){for(var C=0;C<B.length;++C){var D=B[C];A[A.length]=[D.getFullYear(),D.getMonth()+1,D.getDate()];}}}}return A;},toDate:function(A){return this._toDate(A);},_toDate:function(A){if(A instanceof Date){return A;}else{return YAHOO.widget.DateMath.getDate(A[0],A[1]-1,A[2]);}},_fieldArraysAreEqual:function(C,B){var A=false;if(C[0]==B[0]&&C[1]==B[1]&&C[2]==B[2]){A=true;}return A;},_indexOfSelectedFieldArray:function(E){var D=-1;var A=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var C=0;C<A.length;++C){var B=A[C];if(E[0]==B[0]&&E[1]==B[1]&&E[2]==B[2]){D=C;break;}}return D;},isDateOOM:function(A){return(A.getMonth()!=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());},isDateOOB:function(D){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;var E=this.cfg.getProperty(A.MINDATE.key);var F=this.cfg.getProperty(A.MAXDATE.key);var C=YAHOO.widget.DateMath;if(E){E=C.clearTime(E);}if(F){F=C.clearTime(F);}var B=new Date(D.getTime());B=C.clearTime(B);return((E&&B.getTime()<E.getTime())||(F&&B.getTime()>F.getTime()));},_parsePageDate:function(B){var E;var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(B){if(B instanceof Date){E=YAHOO.widget.DateMath.findMonthStart(B);}else{var F,D,C;C=B.split(this.cfg.getProperty(A.DATE_FIELD_DELIMITER.key));F=parseInt(C[this.cfg.getProperty(A.MY_MONTH_POSITION.key)-1],10)-1;D=parseInt(C[this.cfg.getProperty(A.MY_YEAR_POSITION.key)-1],10);E=YAHOO.widget.DateMath.getDate(D,F,1);}}else{E=YAHOO.widget.DateMath.getDate(this.today.getFullYear(),this.today.getMonth(),1);}return E;},onBeforeSelect:function(){if(this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();
}}},onSelect:function(A){},onBeforeDeselect:function(){},onDeselect:function(A){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(C){var D=C.split(this.Locale.DATE_FIELD_DELIMITER);var A;if(D.length==2){A=[D[this.Locale.MD_MONTH_POSITION-1],D[this.Locale.MD_DAY_POSITION-1]];A.type=YAHOO.widget.Calendar.MONTH_DAY;}else{A=[D[this.Locale.MDY_YEAR_POSITION-1],D[this.Locale.MDY_MONTH_POSITION-1],D[this.Locale.MDY_DAY_POSITION-1]];A.type=YAHOO.widget.Calendar.DATE;}for(var B=0;B<A.length;B++){A[B]=parseInt(A[B],10);}return A;},_parseDates:function(B){var I=[];var H=B.split(this.Locale.DATE_DELIMITER);for(var G=0;G<H.length;++G){var F=H[G];if(F.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var A=F.split(this.Locale.DATE_RANGE_DELIMITER);var E=this._parseDate(A[0]);var J=this._parseDate(A[1]);var D=this._parseRange(E,J);I=I.concat(D);}else{var C=this._parseDate(F);I.push(C);}}return I;},_parseRange:function(A,E){var B=YAHOO.widget.DateMath.add(YAHOO.widget.DateMath.getDate(A[0],A[1]-1,A[2]),YAHOO.widget.DateMath.DAY,1);var D=YAHOO.widget.DateMath.getDate(E[0],E[1]-1,E[2]);var C=[];C.push(A);while(B.getTime()<=D.getTime()){C.push([B.getFullYear(),B.getMonth()+1,B.getDate()]);B=YAHOO.widget.DateMath.add(B,YAHOO.widget.DateMath.DAY,1);}return C;},resetRenderers:function(){this.renderStack=this._renderStack.concat();},removeRenderers:function(){this._renderStack=[];this.renderStack=[];},clearElement:function(A){A.innerHTML="&#160;";A.className="";},addRenderer:function(A,B){var D=this._parseDates(A);for(var C=0;C<D.length;++C){var E=D[C];if(E.length==2){if(E[0] instanceof Array){this._addRenderer(YAHOO.widget.Calendar.RANGE,E,B);}else{this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,E,B);}}else{if(E.length==3){this._addRenderer(YAHOO.widget.Calendar.DATE,E,B);}}}},_addRenderer:function(B,C,A){var D=[B,C,A];this.renderStack.unshift(D);this._renderStack=this.renderStack.concat();},addMonthRenderer:function(B,A){this._addRenderer(YAHOO.widget.Calendar.MONTH,[B],A);},addWeekdayRenderer:function(B,A){this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[B],A);},clearAllBodyCellStyles:function(A){for(var B=0;B<this.cells.length;++B){YAHOO.util.Dom.removeClass(this.cells[B],A);}},setMonth:function(C){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var B=this.cfg.getProperty(A);B.setMonth(parseInt(C,10));this.cfg.setProperty(A,B);},setYear:function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var C=this.cfg.getProperty(A);C.setFullYear(parseInt(B,10));this.cfg.setProperty(A,C);},getSelectedDates:function(){var C=[];var B=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var E=0;E<B.length;++E){var D=B[E];var A=YAHOO.widget.DateMath.getDate(D[0],D[1]-1,D[2]);C.push(A);}C.sort(function(G,F){return G-F;});return C;},hide:function(){if(this.beforeHideEvent.fire()){this.oDomContainer.style.display="none";this.hideEvent.fire();}},show:function(){if(this.beforeShowEvent.fire()){this.oDomContainer.style.display="block";this.showEvent.fire();}},browser:(function(){var A=navigator.userAgent.toLowerCase();if(A.indexOf("opera")!=-1){return"opera";}else{if(A.indexOf("msie 7")!=-1){return"ie7";}else{if(A.indexOf("msie")!=-1){return"ie";}else{if(A.indexOf("safari")!=-1){return"safari";}else{if(A.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}})(),toString:function(){return"Calendar "+this.id;}};YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;YAHOO.widget.CalendarGroup=function(C,A,B){if(arguments.length>0){this.init.apply(this,arguments);}};YAHOO.widget.CalendarGroup.prototype={init:function(D,B,C){var A=this._parseArgs(arguments);D=A.id;B=A.container;C=A.config;this.oDomContainer=YAHOO.util.Dom.get(B);if(!this.oDomContainer.id){this.oDomContainer.id=YAHOO.util.Dom.generateId();}if(!D){D=this.oDomContainer.id+"_t";}this.id=D;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_CONTAINER);YAHOO.util.Dom.addClass(this.oDomContainer,YAHOO.widget.CalendarGroup.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(C){this.cfg.applyConfig(C,true);}this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var A=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;this.cfg.addProperty(A.PAGES.key,{value:A.PAGES.value,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty(A.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(A.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(A.TITLE.key,{value:A.TITLE.value,handler:this.configTitle});this.cfg.addProperty(A.CLOSE.key,{value:A.CLOSE.value,handler:this.configClose});this.cfg.addProperty(A.IFRAME.key,{value:A.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.MINDATE.key,{value:A.MINDATE.value,handler:this.delegateConfig});this.cfg.addProperty(A.MAXDATE.key,{value:A.MAXDATE.value,handler:this.delegateConfig});this.cfg.addProperty(A.MULTI_SELECT.key,{value:A.MULTI_SELECT.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.START_WEEKDAY.key,{value:A.START_WEEKDAY.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.SHOW_WEEKDAYS.key,{value:A.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_HEADER.key,{value:A.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_FOOTER.key,{value:A.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});
this.cfg.addProperty(A.HIDE_BLANK_WEEKS.key,{value:A.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.NAV_ARROW_LEFT.key,{value:A.NAV_ARROW_LEFT.value,handler:this.delegateConfig});this.cfg.addProperty(A.NAV_ARROW_RIGHT.key,{value:A.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});this.cfg.addProperty(A.MONTHS_SHORT.key,{value:A.MONTHS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(A.MONTHS_LONG.key,{value:A.MONTHS_LONG.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_1CHAR.key,{value:A.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_SHORT.key,{value:A.WEEKDAYS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_MEDIUM.key,{value:A.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_LONG.key,{value:A.WEEKDAYS_LONG.value,handler:this.delegateConfig});this.cfg.addProperty(A.LOCALE_MONTHS.key,{value:A.LOCALE_MONTHS.value,handler:this.delegateConfig});this.cfg.addProperty(A.LOCALE_WEEKDAYS.key,{value:A.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_DELIMITER.key,{value:A.DATE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_FIELD_DELIMITER.key,{value:A.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_RANGE_DELIMITER.key,{value:A.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.MY_MONTH_POSITION.key,{value:A.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_YEAR_POSITION.key,{value:A.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_MONTH_POSITION.key,{value:A.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_DAY_POSITION.key,{value:A.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_MONTH_POSITION.key,{value:A.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_DAY_POSITION.key,{value:A.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_YEAR_POSITION.key,{value:A.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_POSITION.key,{value:A.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_YEAR_POSITION.key,{value:A.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_SUFFIX.key,{value:A.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});this.cfg.addProperty(A.MY_LABEL_YEAR_SUFFIX.key,{value:A.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});this.cfg.addProperty(A.NAV.key,{value:A.NAV.value,handler:this.configNavigator});},initEvents:function(){var C=this;var E="Event";var B=function(G,J,F){for(var I=0;I<C.pages.length;++I){var H=C.pages[I];H[this.type+E].subscribe(G,J,F);}};var A=function(F,I){for(var H=0;H<C.pages.length;++H){var G=C.pages[H];G[this.type+E].unsubscribe(F,I);}};var D=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(D.BEFORE_SELECT);this.beforeSelectEvent.subscribe=B;this.beforeSelectEvent.unsubscribe=A;this.selectEvent=new YAHOO.util.CustomEvent(D.SELECT);this.selectEvent.subscribe=B;this.selectEvent.unsubscribe=A;this.beforeDeselectEvent=new YAHOO.util.CustomEvent(D.BEFORE_DESELECT);this.beforeDeselectEvent.subscribe=B;this.beforeDeselectEvent.unsubscribe=A;this.deselectEvent=new YAHOO.util.CustomEvent(D.DESELECT);this.deselectEvent.subscribe=B;this.deselectEvent.unsubscribe=A;this.changePageEvent=new YAHOO.util.CustomEvent(D.CHANGE_PAGE);this.changePageEvent.subscribe=B;this.changePageEvent.unsubscribe=A;this.beforeRenderEvent=new YAHOO.util.CustomEvent(D.BEFORE_RENDER);this.beforeRenderEvent.subscribe=B;this.beforeRenderEvent.unsubscribe=A;this.renderEvent=new YAHOO.util.CustomEvent(D.RENDER);this.renderEvent.subscribe=B;this.renderEvent.unsubscribe=A;this.resetEvent=new YAHOO.util.CustomEvent(D.RESET);this.resetEvent.subscribe=B;this.resetEvent.unsubscribe=A;this.clearEvent=new YAHOO.util.CustomEvent(D.CLEAR);this.clearEvent.subscribe=B;this.clearEvent.unsubscribe=A;this.beforeShowEvent=new YAHOO.util.CustomEvent(D.BEFORE_SHOW);this.showEvent=new YAHOO.util.CustomEvent(D.SHOW);this.beforeHideEvent=new YAHOO.util.CustomEvent(D.BEFORE_HIDE);this.hideEvent=new YAHOO.util.CustomEvent(D.HIDE);this.beforeShowNavEvent=new YAHOO.util.CustomEvent(D.BEFORE_SHOW_NAV);this.showNavEvent=new YAHOO.util.CustomEvent(D.SHOW_NAV);this.beforeHideNavEvent=new YAHOO.util.CustomEvent(D.BEFORE_HIDE_NAV);this.hideNavEvent=new YAHOO.util.CustomEvent(D.HIDE_NAV);this.beforeRenderNavEvent=new YAHOO.util.CustomEvent(D.BEFORE_RENDER_NAV);this.renderNavEvent=new YAHOO.util.CustomEvent(D.RENDER_NAV);},configPages:function(K,J,G){var E=J[0];var C=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;var O="_";var L="groupcal";var N="first-of-type";var D="last-of-type";for(var B=0;B<E;++B){var M=this.id+O+B;var I=this.containerId+O+B;var H=this.cfg.getConfig();H.close=false;H.title=false;H.navigator=null;var A=this.constructChild(M,I,H);var F=A.cfg.getProperty(C);this._setMonthOnDate(F,F.getMonth()+B);A.cfg.setProperty(C,F);YAHOO.util.Dom.removeClass(A.oDomContainer,this.Style.CSS_SINGLE);YAHOO.util.Dom.addClass(A.oDomContainer,L);if(B===0){YAHOO.util.Dom.addClass(A.oDomContainer,N);}if(B==(E-1)){YAHOO.util.Dom.addClass(A.oDomContainer,D);}A.parent=this;A.index=B;this.pages[this.pages.length]=A;}},configPageDate:function(H,G,E){var C=G[0];var F;var D=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var B=0;B<this.pages.length;++B){var A=this.pages[B];if(B===0){F=A._parsePageDate(C);
A.cfg.setProperty(D,F);}else{var I=new Date(F);this._setMonthOnDate(I,I.getMonth()+B);A.cfg.setProperty(D,I);}}},configSelected:function(C,A,E){var D=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;this.delegateConfig(C,A,E);var B=(this.pages.length>0)?this.pages[0].cfg.getProperty(D):[];this.cfg.setProperty(D,B,true);},delegateConfig:function(B,A,E){var F=A[0];var D;for(var C=0;C<this.pages.length;C++){D=this.pages[C];D.cfg.setProperty(B,F);}},setChildFunction:function(D,B){var A=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var C=0;C<A;++C){this.pages[C][D]=B;}},callChildFunction:function(F,B){var A=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var E=0;E<A;++E){var D=this.pages[E];if(D[F]){var C=D[F];C.call(D,B);}}},constructChild:function(D,B,C){var A=document.getElementById(B);if(!A){A=document.createElement("div");A.id=B;this.oDomContainer.appendChild(A);}return new YAHOO.widget.Calendar(D,B,C);},setMonth:function(E){E=parseInt(E,10);var F;var B=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var D=0;D<this.pages.length;++D){var C=this.pages[D];var A=C.cfg.getProperty(B);if(D===0){F=A.getFullYear();}else{A.setFullYear(F);}this._setMonthOnDate(A,E+D);C.cfg.setProperty(B,A);}},setYear:function(C){var B=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;C=parseInt(C,10);for(var E=0;E<this.pages.length;++E){var D=this.pages[E];var A=D.cfg.getProperty(B);if((A.getMonth()+1)==1&&E>0){C+=1;}D.setYear(C);}},render:function(){this.renderHeader();for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.render();}this.renderFooter();},select:function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.select(A);}return this.getSelectedDates();},selectCell:function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.selectCell(A);}return this.getSelectedDates();},deselect:function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.deselect(A);}return this.getSelectedDates();},deselectAll:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.deselectAll();}return this.getSelectedDates();},deselectCell:function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.deselectCell(A);}return this.getSelectedDates();},reset:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.reset();}},clear:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.clear();}},nextMonth:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.nextMonth();}},previousMonth:function(){for(var B=this.pages.length-1;B>=0;--B){var A=this.pages[B];A.previousMonth();}},nextYear:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.nextYear();}},previousYear:function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.previousYear();}},getSelectedDates:function(){var C=[];var B=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);for(var E=0;E<B.length;++E){var D=B[E];var A=YAHOO.widget.DateMath.getDate(D[0],D[1]-1,D[2]);C.push(A);}C.sort(function(G,F){return G-F;});return C;},addRenderer:function(A,B){for(var D=0;D<this.pages.length;++D){var C=this.pages[D];C.addRenderer(A,B);}},addMonthRenderer:function(D,A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.addMonthRenderer(D,A);}},addWeekdayRenderer:function(B,A){for(var D=0;D<this.pages.length;++D){var C=this.pages[D];C.addWeekdayRenderer(B,A);}},removeRenderers:function(){this.callChildFunction("removeRenderers");},renderHeader:function(){},renderFooter:function(){},addMonths:function(A){this.callChildFunction("addMonths",A);},subtractMonths:function(A){this.callChildFunction("subtractMonths",A);},addYears:function(A){this.callChildFunction("addYears",A);},subtractYears:function(A){this.callChildFunction("subtractYears",A);},getCalendarPage:function(D){var F=null;if(D){var G=D.getFullYear(),C=D.getMonth();var B=this.pages;for(var E=0;E<B.length;++E){var A=B[E].cfg.getProperty("pagedate");if(A.getFullYear()===G&&A.getMonth()===C){F=B[E];break;}}}return F;},_setMonthOnDate:function(C,D){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(D<0||D>11)){var B=YAHOO.widget.DateMath;var A=B.add(C,B.MONTH,D-C.getMonth());C.setTime(A.getTime());}else{C.setMonth(D);}},_fixWidth:function(){var A=0;for(var C=0;C<this.pages.length;++C){var B=this.pages[C];A+=B.oDomContainer.offsetWidth;}if(A>0){this.oDomContainer.style.width=A+"px";}},toString:function(){return"CalendarGroup "+this.id;}};YAHOO.widget.CalendarGroup.CSS_CONTAINER="yui-calcontainer";YAHOO.widget.CalendarGroup.CSS_MULTI_UP="multi";YAHOO.widget.CalendarGroup.CSS_2UPTITLE="title";YAHOO.widget.CalendarGroup.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup,YAHOO.widget.Calendar,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","configNavigator","createTitleBar","createCloseButton","removeTitleBar","removeCloseButton","hide","show","toDate","_parseArgs","browser");YAHOO.widget.CalendarGroup._DEFAULT_CONFIG=YAHOO.widget.Calendar._DEFAULT_CONFIG;YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES={key:"pages",value:2};YAHOO.widget.CalGrp=YAHOO.widget.CalendarGroup;YAHOO.widget.Calendar2up=function(C,A,B){this.init(C,A,B);};YAHOO.extend(YAHOO.widget.Calendar2up,YAHOO.widget.CalendarGroup);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;YAHOO.widget.CalendarNavigator=function(A){this.init(A);};(function(){var A=YAHOO.widget.CalendarNavigator;A.CLASSES={NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};
A._DEFAULT_CFG={strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};A.ID_SUFFIX="_nav";A.MONTH_SUFFIX="_month";A.YEAR_SUFFIX="_year";A.ERROR_SUFFIX="_error";A.CANCEL_SUFFIX="_cancel";A.SUBMIT_SUFFIX="_submit";A.YR_MAX_DIGITS=4;A.YR_MINOR_INC=1;A.YR_MAJOR_INC=10;A.UPDATE_DELAY=50;A.YR_PATTERN=/^\d+$/;A.TRIM=/^\s*(.*?)\s*$/;})();YAHOO.widget.CalendarNavigator.prototype={id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(A){var C=A.oDomContainer;this.cal=A;this.id=C.id+YAHOO.widget.CalendarNavigator.ID_SUFFIX;this._doc=C.ownerDocument;var B=YAHOO.env.ua.ie;this.__isIEQuirks=(B&&((B<=6)||(B===7&&this._doc.compatMode=="BackCompat")));},show:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeShowNavEvent.fire()){if(!this.__rendered){this.render();}this.clearErrors();this._updateMonthUI();this._updateYearUI();this._show(this.navEl,true);this.setInitialFocus();this.showMask();YAHOO.util.Dom.addClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.showNavEvent.fire();}},hide:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeHideNavEvent.fire()){this._show(this.navEl,false);this.hideMask();YAHOO.util.Dom.removeClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.hideNavEvent.fire();}},showMask:function(){this._show(this.maskEl,true);if(this.__isIEQuirks){this._syncMask();}},hideMask:function(){this._show(this.maskEl,false);},getMonth:function(){return this._month;},getYear:function(){return this._year;},setMonth:function(A){if(A>=0&&A<12){this._month=A;}this._updateMonthUI();},setYear:function(B){var A=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(B)&&A.test(B+"")){this._year=B;}this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}this.cal.renderNavEvent.fire();},createNav:function(){var B=YAHOO.widget.CalendarNavigator;var C=this._doc;var D=C.createElement("div");D.className=B.CLASSES.NAV;var A=this.renderNavContents([]);D.innerHTML=A.join("");this.cal.oDomContainer.appendChild(D);this.navEl=D;this.yearEl=C.getElementById(this.id+B.YEAR_SUFFIX);this.monthEl=C.getElementById(this.id+B.MONTH_SUFFIX);this.errorEl=C.getElementById(this.id+B.ERROR_SUFFIX);this.submitEl=C.getElementById(this.id+B.SUBMIT_SUFFIX);this.cancelEl=C.getElementById(this.id+B.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}this._setFirstLastElements();},createMask:function(){var B=YAHOO.widget.CalendarNavigator.CLASSES;var A=this._doc.createElement("div");A.className=B.MASK;this.cal.oDomContainer.appendChild(A);this.maskEl=A;},_syncMask:function(){var B=this.cal.oDomContainer;if(B&&this.maskEl){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(this.maskEl,"width",A.right-A.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",A.bottom-A.top+"px");}},renderNavContents:function(A){var D=YAHOO.widget.CalendarNavigator,E=D.CLASSES,B=A;B[B.length]="<div class=\""+E.MONTH+"\">";this.renderMonth(B);B[B.length]="</div>";B[B.length]="<div class=\""+E.YEAR+"\">";this.renderYear(B);B[B.length]="</div>";B[B.length]="<div class=\""+E.BUTTONS+"\">";this.renderButtons(B);B[B.length]="</div>";B[B.length]="<div class=\""+E.ERROR+"\" id=\""+this.id+D.ERROR_SUFFIX+"\"></div>";return B;},renderMonth:function(D){var G=YAHOO.widget.CalendarNavigator,H=G.CLASSES;var I=this.id+G.MONTH_SUFFIX,F=this.__getCfg("monthFormat"),A=this.cal.cfg.getProperty((F==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),E=D;if(A&&A.length>0){E[E.length]="<label for=\""+I+"\">";E[E.length]=this.__getCfg("month",true);E[E.length]="</label>";E[E.length]="<select name=\""+I+"\" id=\""+I+"\" class=\""+H.MONTH_CTRL+"\">";for(var B=0;B<A.length;B++){E[E.length]="<option value=\""+B+"\">";E[E.length]=A[B];E[E.length]="</option>";}E[E.length]="</select>";}return E;},renderYear:function(B){var E=YAHOO.widget.CalendarNavigator,F=E.CLASSES;var G=this.id+E.YEAR_SUFFIX,A=E.YR_MAX_DIGITS,D=B;D[D.length]="<label for=\""+G+"\">";D[D.length]=this.__getCfg("year",true);D[D.length]="</label>";D[D.length]="<input type=\"text\" name=\""+G+"\" id=\""+G+"\" class=\""+F.YEAR_CTRL+"\" maxlength=\""+A+"\"/>";return D;},renderButtons:function(A){var D=YAHOO.widget.CalendarNavigator.CLASSES;var B=A;B[B.length]="<span class=\""+D.BUTTON+" "+D.DEFAULT+"\">";B[B.length]="<button type=\"button\" id=\""+this.id+"_submit\">";B[B.length]=this.__getCfg("submit",true);B[B.length]="</button>";B[B.length]="</span>";B[B.length]="<span class=\""+D.BUTTON+"\">";B[B.length]="<button type=\"button\" id=\""+this.id+"_cancel\">";B[B.length]=this.__getCfg("cancel",true);B[B.length]="</button>";B[B.length]="</span>";return B;},applyListeners:function(){var B=YAHOO.util.Event;function A(){if(this.validate()){this.setYear(this._getYearFromUI());}}function C(){this.setMonth(this._getMonthFromUI());}B.on(this.submitEl,"click",this.submit,this,true);B.on(this.cancelEl,"click",this.cancel,this,true);B.on(this.yearEl,"blur",A,this,true);B.on(this.monthEl,"change",C,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}this.applyKeyListeners();},purgeListeners:function(){var A=YAHOO.util.Event;A.removeListener(this.submitEl,"click",this.submit);A.removeListener(this.cancelEl,"click",this.cancel);A.removeListener(this.yearEl,"blur");A.removeListener(this.monthEl,"change");if(this.__isIEQuirks){A.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}this.purgeKeyListeners();},applyKeyListeners:function(){var D=YAHOO.util.Event;var A=YAHOO.env.ua;var C=(A.ie)?"keydown":"keypress";var B=(A.ie||A.opera)?"keydown":"keypress";D.on(this.yearEl,"keypress",this._handleEnterKey,this,true);
D.on(this.yearEl,C,this._handleDirectionKeys,this,true);D.on(this.lastCtrl,B,this._handleTabKey,this,true);D.on(this.firstCtrl,B,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var C=YAHOO.util.Event;var B=(YAHOO.env.ua.ie)?"keydown":"keypress";var A=(YAHOO.env.ua.ie||YAHOO.env.ua.opera)?"keydown":"keypress";C.removeListener(this.yearEl,"keypress",this._handleEnterKey);C.removeListener(this.yearEl,B,this._handleDirectionKeys);C.removeListener(this.lastCtrl,A,this._handleTabKey);C.removeListener(this.firstCtrl,A,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var B=this.cal;var C=this;function D(){B.setYear(C.getYear());B.setMonth(C.getMonth());B.render();}var A=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(A>0){window.setTimeout(D,A);}else{D();}}},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(A){if(this.errorEl){this.errorEl.innerHTML=A;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var A=this.submitEl;var B=this.__getCfg("initialFocus");if(B&&B.toLowerCase){B=B.toLowerCase();if(B=="year"){A=this.yearEl;try{this.yearEl.select();}catch(C){}}else{if(B=="month"){A=this.monthEl;}}}if(A&&YAHOO.lang.isFunction(A.focus)){try{A.focus();}catch(C){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}var B=this.navEl.parentNode;if(B){B.removeChild(this.navEl);}this.navEl=null;var A=this.maskEl.parentNode;if(A){A.removeChild(this.maskEl);}this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(B,A){if(B){YAHOO.util.Dom.setStyle(B,"display",(A)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var B=YAHOO.widget.CalendarNavigator;var A=null;if(this.yearEl){var C=this.yearEl.value;C=C.replace(B.TRIM,"$1");if(B.YR_PATTERN.test(C)){A=parseInt(C,10);}}return A;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(B){var A=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(B)==A.ENTER){this.submit();}},_handleDirectionKeys:function(G){var F=YAHOO.util.Event;var A=YAHOO.util.KeyListener.KEY;var C=YAHOO.widget.CalendarNavigator;var D=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(D)){var B=false;switch(F.getCharCode(G)){case A.UP:this.yearEl.value=D+C.YR_MINOR_INC;B=true;break;case A.DOWN:this.yearEl.value=Math.max(D-C.YR_MINOR_INC,0);B=true;break;case A.PAGE_UP:this.yearEl.value=D+C.YR_MAJOR_INC;B=true;break;case A.PAGE_DOWN:this.yearEl.value=Math.max(D-C.YR_MAJOR_INC,0);B=true;break;default:break;}if(B){F.preventDefault(G);try{this.yearEl.select();}catch(G){}}}},_handleTabKey:function(C){var B=YAHOO.util.Event;var A=YAHOO.util.KeyListener.KEY;if(B.getCharCode(C)==A.TAB&&!C.shiftKey){try{B.preventDefault(C);this.firstCtrl.focus();}catch(C){}}},_handleShiftTabKey:function(C){var B=YAHOO.util.Event;var A=YAHOO.util.KeyListener.KEY;if(C.shiftKey&&B.getCharCode(C)==A.TAB){try{B.preventDefault(C);this.lastCtrl.focus();}catch(C){}}},__getCfg:function(D,B){var C=YAHOO.widget.CalendarNavigator._DEFAULT_CFG;var A=this.cal.cfg.getProperty("navigator");if(B){return(A!==true&&A.strings&&A.strings[D])?A.strings[D]:C.strings[D];}else{return(A!==true&&A[D])?A[D]:C[D];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.4.1",build:"742"});
// Content: connection-min-new
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
*/
YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(B){var A=YAHOO.util.Event.getTarget(B);if(A.type&&A.type.toLowerCase()=="submit"){YAHOO.util.Connect._submitElementValue=encodeURIComponent(A.name)+"="+encodeURIComponent(A.value);}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(A){this._msxml_progid.unshift(A);},setDefaultPostHeader:function(A){if(typeof A=="string"){this._default_post_header=A;}else{if(typeof A=="boolean"){this._use_default_post_header=A;}}},setDefaultXhrHeader:function(A){if(typeof A=="string"){this._default_xhr_header=A;}else{this._use_default_xhr_header=A;}},setPollingInterval:function(A){if(typeof A=="number"&&isFinite(A)){this._polling_interval=A;}},createXhrObject:function(E){var D,A;try{A=new XMLHttpRequest();D={conn:A,tId:E};}catch(C){for(var B=0;B<this._msxml_progid.length;++B){try{A=new ActiveXObject(this._msxml_progid[B]);D={conn:A,tId:E};break;}catch(C){}}}finally{return D;}},getConnectionObject:function(A){var C;var D=this._transaction_id;try{if(!A){C=this.createXhrObject(D);}else{C={};C.tId=D;C.isUpload=true;}if(C){this._transaction_id++;}}catch(B){}finally{return C;}},asyncRequest:function(F,C,E,A){var D=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();var B=(E&&E.argument)?E.argument:null;if(!D){return null;}else{if(E&&E.customevents){this.initCustomEvents(D,E);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(D,E,C,A);return D;}if(F.toUpperCase()=="GET"){if(this._sFormData.length!==0){C+=((C.indexOf("?")==-1)?"?":"&")+this._sFormData;}}else{if(F.toUpperCase()=="POST"){A=A?this._sFormData+"&"+A:this._sFormData;}}}if(F.toUpperCase()=="GET"&&(E&&E.cache===false)){C+=((C.indexOf("?")==-1)?"?":"&")+"rnd="+new Date().valueOf().toString();}D.conn.open(F,C,true);if(this._use_default_xhr_header){if(!this._default_headers["X-Requested-With"]){this.initHeader("X-Requested-With",this._default_xhr_header,true);}}if((F.toUpperCase()=="POST"&&this._use_default_post_header)&&this._isFormSubmit===false){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(D);}this.handleReadyState(D,E);D.conn.send(A||null);if(this._isFormSubmit===true){this.resetFormState();}this.startEvent.fire(D,B);if(D.startEvent){D.startEvent.fire(D,B);}return D;}},initCustomEvents:function(A,C){for(var B in C.customevents){if(this._customEvents[B][0]){A[this._customEvents[B][0]]=new YAHOO.util.CustomEvent(this._customEvents[B][1],(C.scope)?C.scope:null);A[this._customEvents[B][0]].subscribe(C.customevents[B]);}}},handleReadyState:function(C,D){var B=this;var A=(D&&D.argument)?D.argument:null;if(D&&D.timeout){this._timeOut[C.tId]=window.setTimeout(function(){B.abort(C,D,true);},D.timeout);}this._poll[C.tId]=window.setInterval(function(){if(C.conn&&C.conn.readyState===4){window.clearInterval(B._poll[C.tId]);delete B._poll[C.tId];if(D&&D.timeout){window.clearTimeout(B._timeOut[C.tId]);delete B._timeOut[C.tId];}B.completeEvent.fire(C,A);if(C.completeEvent){C.completeEvent.fire(C,A);}B.handleTransactionResponse(C,D);}},this._polling_interval);},handleTransactionResponse:function(F,G,A){var D,C;var B=(G&&G.argument)?G.argument:null;try{if(F.conn.status!==undefined&&F.conn.status!==0){D=F.conn.status;}else{D=13030;}}catch(E){D=13030;}if(D>=200&&D<300||D===1223){C=this.createResponseObject(F,B);if(G&&G.success){if(!G.scope){G.success(C);}else{G.success.apply(G.scope,[C]);}}this.successEvent.fire(C);if(F.successEvent){F.successEvent.fire(C);}}else{switch(D){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:C=this.createExceptionObject(F.tId,B,(A?A:false));if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}break;default:C=this.createResponseObject(F,B);if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}}this.failureEvent.fire(C);if(F.failureEvent){F.failureEvent.fire(C);}}this.releaseObject(F);C=null;},createResponseObject:function(A,G){var D={};var I={};try{var C=A.conn.getAllResponseHeaders();var F=C.split("\n");for(var E=0;E<F.length;E++){var B=F[E].indexOf(":");if(B!=-1){I[F[E].substring(0,B)]=F[E].substring(B+2);}}}catch(H){}D.tId=A.tId;D.status=(A.conn.status==1223)?204:A.conn.status;D.statusText=(A.conn.status==1223)?"No Content":A.conn.statusText;D.getResponseHeader=I;D.getAllResponseHeaders=C;D.responseText=A.conn.responseText;D.responseXML=A.conn.responseXML;if(G){D.argument=G;}return D;},createExceptionObject:function(H,D,A){var F=0;var G="communication failure";var C=-1;var B="transaction aborted";var E={};E.tId=H;if(A){E.status=C;E.statusText=B;}else{E.status=F;E.statusText=G;}if(D){E.argument=D;}return E;},initHeader:function(A,D,C){var B=(C)?this._default_headers:this._http_headers;B[A]=D;if(C){this._has_default_headers=true;}else{this._has_http_headers=true;}},setHeader:function(A){if(this._has_default_headers){for(var B in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,B)){A.conn.setRequestHeader(B,this._default_headers[B]);
}}}if(this._has_http_headers){for(var B in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,B)){A.conn.setRequestHeader(B,this._http_headers[B]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(K,E,B){this.resetFormState();var J;if(typeof K=="string"){J=(document.getElementById(K)||document.forms[K]);}else{if(typeof K=="object"){J=K;}else{return ;}}if(E){var F=this.createFrame(B?B:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=J;return ;}var A,I,G,L;var H=false;for(var D=0;D<J.elements.length;D++){A=J.elements[D];L=A.disabled;I=A.name;G=A.value;if(!L&&I){switch(A.type){case"select-one":case"select-multiple":for(var C=0;C<A.options.length;C++){if(A.options[C].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].attributes["value"].specified?A.options[C].value:A.options[C].text)+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].hasAttribute("value")?A.options[C].value:A.options[C].text)+"&";}}}break;case"radio":case"checkbox":if(A.checked){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(H===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}H=true;}break;default:this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}}}this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);this.initHeader("Content-Type",this._default_form_header);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(A){var B="yuiIO"+this._transaction_id;var C;if(window.ActiveXObject){C=document.createElement("<iframe id=\""+B+"\" name=\""+B+"\" />");if(typeof A=="boolean"){C.src="javascript:false";}else{if(typeof secureURI=="string"){C.src=A;}}}else{C=document.createElement("iframe");C.id=B;C.name=B;}C.style.position="absolute";C.style.top="-1000px";C.style.left="-1000px";document.body.appendChild(C);},appendPostData:function(A){var D=[];var B=A.split("&");for(var C=0;C<B.length;C++){var E=B[C].indexOf("=");if(E!=-1){D[C]=document.createElement("input");D[C].type="hidden";D[C].name=B[C].substring(0,E);D[C].value=B[C].substring(E+1);this._formNode.appendChild(D[C]);}}return D;},uploadFile:function(D,M,E,C){var N=this;var H="yuiIO"+D.tId;var I="multipart/form-data";var K=document.getElementById(H);var J=(M&&M.argument)?M.argument:null;var B={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",E);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",H);if(this._formNode.encoding){this._formNode.setAttribute("encoding",I);}else{this._formNode.setAttribute("enctype",I);}if(C){var L=this.appendPostData(C);}this._formNode.submit();this.startEvent.fire(D,J);if(D.startEvent){D.startEvent.fire(D,J);}if(M&&M.timeout){this._timeOut[D.tId]=window.setTimeout(function(){N.abort(D,M,true);},M.timeout);}if(L&&L.length>0){for(var G=0;G<L.length;G++){this._formNode.removeChild(L[G]);}}for(var A in B){if(YAHOO.lang.hasOwnProperty(B,A)){if(B[A]){this._formNode.setAttribute(A,B[A]);}else{this._formNode.removeAttribute(A);}}}this.resetFormState();var F=function(){if(M&&M.timeout){window.clearTimeout(N._timeOut[D.tId]);delete N._timeOut[D.tId];}N.completeEvent.fire(D,J);if(D.completeEvent){D.completeEvent.fire(D,J);}var P={};P.tId=D.tId;P.argument=M.argument;try{P.responseText=K.contentWindow.document.body?K.contentWindow.document.body.innerHTML:K.contentWindow.document.documentElement.textContent;P.responseXML=K.contentWindow.document.XMLDocument?K.contentWindow.document.XMLDocument:K.contentWindow.document;}catch(O){}if(M&&M.upload){if(!M.scope){M.upload(P);}else{M.upload.apply(M.scope,[P]);}}N.uploadEvent.fire(P);if(D.uploadEvent){D.uploadEvent.fire(P);}YAHOO.util.Event.removeListener(K,"load",F);setTimeout(function(){document.body.removeChild(K);N.releaseObject(D);},100);};YAHOO.util.Event.addListener(K,"load",F);},abort:function(E,G,A){var D;var B=(G&&G.argument)?G.argument:null;if(E&&E.conn){if(this.isCallInProgress(E)){E.conn.abort();window.clearInterval(this._poll[E.tId]);delete this._poll[E.tId];if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{if(E&&E.isUpload===true){var C="yuiIO"+E.tId;var F=document.getElementById(C);if(F){YAHOO.util.Event.removeListener(F,"load");document.body.removeChild(F);if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{D=false;}}if(D===true){this.abortEvent.fire(E,B);if(E.abortEvent){E.abortEvent.fire(E,B);}this.handleTransactionResponse(E,G,true);}return D;},isCallInProgress:function(B){if(B&&B.conn){return B.conn.readyState!==4&&B.conn.readyState!==0;}else{if(B&&B.isUpload===true){var A="yuiIO"+B.tId;return document.getElementById(A)?true:false;}else{return false;}}},releaseObject:function(A){if(A&&A.conn){A.conn=null;A=null;}}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.4.1",build:"742"});
// Content: js eBT7 calendar
/* calendar functions */
var type = '';
var days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];

function showCalendar(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer');
	var header = document.getElementById('calendartop');
	header.innerHTML = txt; 
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month').options.selectedIndex;
	document.getElementById('calendarmonth').options.selectedIndex = index;
	updateMonth(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
                document.getElementById('calendarmonth').focus();
}

function showCalendar_other(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer_other');
	var header = document.getElementById('calendartop_other');
	header.innerHTML = txt;
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month_other').options.selectedIndex;
	document.getElementById('calendarmonth_other').options.selectedIndex = index;
	updateMonth_other(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
  document.getElementById('calendarmonth_other').focus();
}

function fill(type, day, month) {
	closeCalendar();
	document.getElementById(type + '_day').options.selectedIndex = day;
	document.getElementById(type + '_month').options.selectedIndex = month;
	syncDate(document.getElementById(type + '_month'));
	if (type=='dep'){document.getElementById('ret_day').focus();}
	if (type=='ret') {document.getElementById('on').focus();}
}

function fillother(type, day, month) {
	closeCalendar_other();
	document.getElementById(type + '_day_other').options.selectedIndex = day;
	document.getElementById(type + '_month_other').options.selectedIndex = month;
	syncDate_other(document.getElementById(type + '_month_other'));
	if (type=='dep'){document.getElementById('ret_day_other').focus();}
	if (type=='ret') {document.getElementById('default').focus();}	
}

function closeCalendar () {
	var container = document.getElementById('calendarcontainer');
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function closeCalendar_other () {
	var container = document.getElementById('calendarcontainer_other');
		
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function updateMonth(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth(month, firstDay, noOfDays, selection);
}

function updateMonth_other(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth_other(month, firstDay, noOfDays, selection);
}
function getNumberOfDays(m, y) {
	var days = 31;
	switch (parseInt(m, 10)) {
		case 4: case 6: case 9: case 11:
			days = 30;
			break;
		case 2:
		  if ((y % 4 == 0) ^ (y % 100 == 0) ^ (y % 400 == 0))
			days = 29;
		  else
			days = 28;
		  break;
	}
	return days;
}
function getFirstDay(m, y) {
	d = new Date(y, m-1, 1);
	d.setHours(12);
	return (d.getDay() - 1 >= 0 ? d.getDay() - 1 : d.getDay() + 6);
}
function fillMonth(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fill(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');">' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable').innerHTML = sHTML;
}

function fillMonth_other(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fillother(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');" tabindex=301>' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable_other').innerHTML = sHTML;
}

function RecalcCalendar(id,days) { //,matchdates) {
	this.calendar = document.getElementById(id);
	this.days = days||new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
	/*this.minMatch = false;
	this.maxMatch = false;
	if (matchdates!=null) {
		if (matchdates.minMatch!=null) {
			this.minMatch = true;
			this.matchCalendar = document.getElementById(matchdates.minMatch);
		} else if(matchdates.maxMatch!=null) {
			this.maxMatch = true;
			this.matchCalendar = document.getElementById(matchdates.maxMatch);
		}
	}*/
	var self = this;
	addEventHandler(this.calendar, "click", function(e) {
		return self.clickHandler(e);
	});
}

RecalcCalendar.prototype = {
	aRE:/a/i,
	relRE:/date/i,
	divRE:/div/i,
	dateRE:/\b[0-9]{1,2}\b/,
	dayRE:/^[^ ]*/,
	clickHandler:function(e) {
		var e = e||event;
		var target = e.target||e.srcElement;
		var eventResult = true;

		while (target.nodeType>1)target = target.parentNode; //Safari targets textnodes.

		if (this.aRE.test(target.nodeName) && this.relRE.test(target.getAttribute("rel"))) {//It's a date link
			//de-select current date
			var selSpans = getElementsByClassName(this.calendar, "span", "sel");
			removeClass(selSpans[0], "sel");

			//select current date
			var span = target.parentNode;
			addClass(span, "sel");

			//change date-string
			var div = target;
			while (div.parentNode && !this.divRE.test(div.nodeName)) div = div.parentNode;
			if (this.divRE.test(div.nodeName)) {
				var strong = div.getElementsByTagName("strong").item(0);
				var sDate = strong.firstChild.nodeValue;
				sDate = sDate.replace(this.dateRE, target.firstChild.nodeValue);

				//count how many-eth day this is
				var td = target.parentNode.parentNode;
				var day = this.days[td.cellIndex];
				sDate = sDate.replace(this.dayRE, day);
				strong.replaceChild(document.createTextNode(sDate),strong.firstChild);
			} else alert("Could not find a div");

			//set variable on button-action
			var button = document.getElementById("recalcon"), buttonlink = button.getElementsByTagName("a").item(0), buttonhref = buttonlink.getAttribute("href"), href="";
			var re = new RegExp("([\\?&]" + this.calendar.id + "=)[^&]*");
			if (re.test(buttonhref)) {
				href = buttonhref.replace(re, "$1" + target.firstChild.nodeValue);
			} else {
				href = buttonhref + (buttonhref.indexOf("?")>0?"&":"?") + this.calendar.id + "=" + target.firstChild.nodeValue;
			}
			buttonlink.setAttribute("href",href);

			//enable recalcButton
			addClass(button, "enable");
			//cancel original event
			eventResult = cancelEvent(e);
		}
		return eventResult;
	}
}
// Content: js eBT7 DBFlightSearch
// --------------------------------------------------------------------------------------------
//
// DBFlightSearch component
//
// --------------------------------------------------------------------------------------------
function DBFlightSearch (container, inputSearchCriteriaJSON, ebtPage, cabinClassURL, cityCode, closeText) {
	this.ebtPage = ebtPage;
	this.cabinClassURL = cabinClassURL;
	this.container = YAHOO.util.Dom.get(container);
	this.destFinder = new FindDestinationBox(this);
	this.closeText = closeText;
	this.getInputSearchCriteria(inputSearchCriteriaJSON);
	this.cityCode = cityCode;
	this.acSelectionMade = false;
}
DBFlightSearch.prototype.getInputSearchCriteria = function (JSONData) {
	var callback = { 
		success: this.parseInputSearchCriteria, 
		failure: this.handleFailure,
		scope: this
	};
	YAHOO.util.Connect.asyncRequest('GET', JSONData, callback, null);
}
DBFlightSearch.prototype.parseInputSearchCriteria = function (o) {
	if (o.responseText == '')
		alert('A backend error occurred. Contact the system administrator.');
	else
	{
		this.inputSearchCriteria = eval('(' + o.responseText + ')');
		this.init();
		if (this.cityCode!=undefined)
			this.initCity();
	}
}
DBFlightSearch.prototype.handleFailure = function (o) {
}

DBFlightSearch.prototype.initCity = function () {
	if (YAHOO.util.Dom.get('ebt-destination-place'))
	{
	
		var airports = this.inputSearchCriteria.allowedDestinations;
	
		for (var i = 0; i < airports.length; i++) {
			if (airports[i].code==this.cityCode)
			{
				YAHOO.util.Dom.get('ebt-destination-place').value = airports[i].content;
				YAHOO.util.Dom.get('ebt-airportcode').value = airports[i].code;
				YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value = "city";
				//YAHOO.util.Dom.get('ebt-destination-container').value = 
			}
		}
	}	
}


DBFlightSearch.prototype.init = function () {
	this.waitingPageActive = false;
	this.ebtRoundTrip = YAHOO.util.Dom.get('ebt-round-trip');
	YAHOO.util.Event.addListener(this.ebtRoundTrip, 'click', this.showReturnDates, this, true);
	this.ebtOneWay = YAHOO.util.Dom.get('ebt-one-way');
	YAHOO.util.Event.addListener(this.ebtOneWay, 'click', this.hideReturnDates, this, true);
	this.submitButton = YAHOO.util.Dom.get('ebt-flightsearch-submit');
	YAHOO.util.Event.addListener(this.submitButton, 'click', this.doSubmitData, this, true);
	this.openJawButton = YAHOO.util.Dom.get('ebt-open-jaw-opt-link');
	YAHOO.util.Event.addListener(this.openJawButton, 'click', this.doSubmitData2, this, true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-departure-place'), 'change', this.updateOriginType, this, true);
	this.initDefaultSearch(this.inputSearchCriteria.defaultSearchByPeriod);
	this.initAdults(this.inputSearchCriteria.minimumNumberOfAdults, this.inputSearchCriteria.maximumSeats);
	this.initBestPriceGuarantee(this.inputSearchCriteria.bestPriceGuarantee);
	this.initCabinClass(this.inputSearchCriteria.brandedCabinClasses);
	this.getInitialCabinClasses();
	this.initOrigins(this.inputSearchCriteria.allowedOrigins, this.inputSearchCriteria.defaultOrigin);
	this.flightDater = new FlightDater(this, this.inputSearchCriteria.dateFormat, this.inputSearchCriteria.defaultDaysDeparture, this.inputSearchCriteria.defaultDaysAfterDeparture, this.inputSearchCriteria.maximumAdvancePurchase, this.inputSearchCriteria.months, this.inputSearchCriteria.shortWeekDays, this.closeText);
	this.childrensBox = new ChildrensBox(this, this.inputSearchCriteria.shortMonths);
	// subscribe childrensBox to listen to dateChange event to update children's types
	this.flightDater.depDateChange.subscribe(this.childrensBox.updateChildrensData, this.childrensBox);

	if (YAHOO.util.Dom.get('ebt-destination-place') && YAHOO.util.Dom.get('ebt-destination-container')) 
		this.autoCompleteTo = new AutoComplete(this, this.inputSearchCriteria.allowedDestinations, 'ebt-destination-place', 'ebt-airportcode', 'ebt-outbound-destination-location-type', 'ebt-destination-container', false);
	// recent searches popup
	if (YAHOO.util.Dom.get('ebt-recent-search-link')) {
		this.recentSearches = new RecentSearch(this);
	}
	// tooltips for Hotels and Cars, Best-price and Local Shop
	
	if (YAHOO.util.Dom.get('ebt-local-shop-box')) {
		this.tooltipLocalshop = new ToolTip('ebt-local-shop-box');
		this.tooltipLocalshoplLink = YAHOO.util.Dom.get('ebt-local-shop');
		YAHOO.util.Event.addListener(this.tooltipLocalshoplLink, 'mouseover', this.tooltipLocalshop.show, this.tooltipLocalshop, true);
		YAHOO.util.Event.addListener(this.tooltipLocalshoplLink, 'mouseout', this.tooltipLocalshop.hide, this.tooltipLocalshop, true);
	}
	if (YAHOO.util.Dom.get('ebt-hotel-box')) {
		this.tooltipHotel = new ToolTip('ebt-hotel-box');
		this.tooltipHotelLink = YAHOO.util.Dom.get('ebt-hotel-link');
                                YAHOO.util.Event.addListener(this.tooltipHotelLink, 'mouseover', this.showCompleteYourTrip, [this, this.tooltipHotel], true);
                                YAHOO.util.Event.addListener(this.tooltipHotelLink, 'mouseout', this.hideCompleteYourTrip, [this, this.tooltipHotel], true);
	}
	if (YAHOO.util.Dom.getElementsByClassName('shopping-cart') && YAHOO.util.Dom.getElementsByClassName('shopping-cart')[0]) {
		YAHOO.util.Dom.getElementsByClassName('shopping-cart')[0].onclick = function () {
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "ShoppingCartLink", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
		}
	}

	if (YAHOO.util.Dom.get('ebt-best-price-box')) {
		this.tooltipBestPrice = new ToolTip('ebt-best-price-box');
		this.tooltipBestPriceLink = YAHOO.util.Dom.get('ebt-best-price-link');
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseover', this.tooltipBestPrice.show, this.tooltipBestPrice, true);
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseout', this.tooltipBestPrice.hide, this.tooltipBestPrice, true);
	}

                if (YAHOO.util.Dom.get('ebt-multiple-city-box')) {
		this.tooltipMultiCity = new ToolTip('ebt-multiple-city-box');
		this.tooltipMultiCityLink = YAHOO.util.Dom.get('ebt-multiple-city-link');
		YAHOO.util.Event.addListener(this.tooltipMultiCityLink, 'mouseover', this.tooltipMultiCity.show, this.tooltipMultiCity, true);
		YAHOO.util.Event.addListener(this.tooltipMultiCityLink, 'mouseout', this.tooltipMultiCity.hide, this.tooltipMultiCity, true);
	}


	this.initShoppingCartLink();
}
DBFlightSearch.prototype.initAdults = function (minNum, maxNum) {
	var adultBox = YAHOO.util.Dom.get('ebt-number-adults');
	var option;
	if (adultBox) {
		for (var i = minNum; i <= maxNum; i++) {
			option = new HTMLNode(document, 'option', {value:i.toString()}, i.toString());
			adultBox.appendChild(option);
		}
	}
}
DBFlightSearch.prototype.initBestPriceGuarantee = function (show) {
	if (show) {
		YAHOO.util.Dom.getElementsByClassName('best-price')[0].style.display = 'block';
	}
}
DBFlightSearch.prototype.initCabinClass = function (ccData) {
	this.cabinClassBox = YAHOO.util.Dom.get('ebt-cabin-class');
	var option;
	for (var i = 0; i < ccData.length; i++) {
		option = new HTMLNode(document, 'option', {value:ccData[i].brandedCabinClassCode}, ccData[i].name);
		this.cabinClassBox.appendChild(option);
	}
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-departure-place'), 'blur', this.getCabinClasses, this, true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-destination-place'), 'blur', this.getCabinClasses, this, true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-destination-place-oj'), 'blur', this.getCabinClasses, this, true);
}
DBFlightSearch.prototype.initDefaultSearch = function (defaultPeriod) {
	if (defaultPeriod) {
		YAHOO.util.Dom.get('ebt-flexible-dates').checked = 'checked';
	} else {
		YAHOO.util.Dom.get('ebt-fixed-dates').checked = 'checked';
	}
}
DBFlightSearch.prototype.initOrigins = function (origins, defaultOrigin) {
	this.origins = origins;
	this.originBox = YAHOO.util.Dom.get('ebt-departure-place');
	this.originBox.options.length = 0; // CB 20090730 Added line to remove previous origins because of a second call to inputSearchCriteria.ajax
	var option;
                YAHOO.util.Dom.addClass(this.originBox, "waiting");
                this.originBox.disabled="disabled";
	for (var i = 0; i < origins.length; i++) {
		option = new HTMLNode(document, 'option', {value:origins[i].code}, origins[i].content);
		if (origins[i].code == defaultOrigin) option.selected = 'selected';
		this.originBox.appendChild(option);
	}
                this.originBox.disabled="";
                YAHOO.util.Dom.removeClass(this.originBox, "waiting");


}
DBFlightSearch.prototype.showCompleteYourTrip = function (e, args) {
	if (args[0].showCompleteYourTripFired) return;
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "complete_your_trip", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
	args[1].show();
	args[0].showCompleteYourTripFired = true;
}
DBFlightSearch.prototype.hideCompleteYourTrip = function (e, args) {
	args[0].showCompleteYourTripFired = false;
	args[1].hide();
}
DBFlightSearch.prototype.fillChildInfo = function () {
	var objForm = YAHOO.util.Dom.get('ebt-flight-searchform');
	var objChildren = YAHOO.util.Dom.get('ebt-children-formdata');
	var strChildId;
	var objChildDay, objChildMonth, objChildYear, objChildIsInfant, objChildIsChild;
	var strChildId, strInfantId;
	var objChild, objInfant;
	var chdQty = 0;
	var infQty = 0;
	for ( var ii = 0; ii < 9; ii++ ) {
		strChildId = 'child[' + ii + ']';
		objChildDay = YAHOO.util.Dom.get(strChildId + '.day');
		objChildMonth = YAHOO.util.Dom.get(strChildId + '.month');
		objChildYear = YAHOO.util.Dom.get(strChildId + '.year');
		objChildIsInfant = YAHOO.util.Dom.get(strChildId + '.isInfant');
		objChildIsChild = YAHOO.util.Dom.get(strChildId + '.isChild');
		if ( objChildYear ) {
			if ( objChildIsChild.value.toLowerCase() == "true" ) {
				strChildId = 'chds[' + chdQty + '].dateOfBirth';
				objChild = new HTMLNode(document, 'input', {id:strChildId, name:strChildId, type:'hidden'}, null, strChildId);
				objChild.value =	objChildYear.value + '-' +
				   					this.getValueString(objChildMonth.value) + '-' +
									this.getValueString(objChildDay.value);
				objForm.appendChild(objChild);
				chdQty++;
			}
			else if ( objChildIsInfant.value.toLowerCase() == "true" ) {
				strInfantId = 'infs[' + infQty + '].dateOfBirth';
				objInfant = new HTMLNode(document, 'input', {id:strInfantId, name:strInfantId, type:'hidden'}, null, strInfantId);
				objInfant.value =	objChildYear.value + '-' +
				   					this.getValueString(objChildMonth.value) + '-' +
									this.getValueString(objChildDay.value);
				objForm.appendChild(objInfant);
				infQty++;
			}
		}
	}
	var objChdQty = new HTMLNode(document, 'input', {id:'chdQty', name:'chdQty', type:'hidden'}, null, 'chdQty');
	var objInfQty = new HTMLNode(document, 'input', {id:'infQty', name:'infQty', type:'hidden'}, null, 'infQty');
	objChdQty.value = chdQty;
	objInfQty.value = infQty;
	objForm.appendChild(objChdQty);
	objForm.appendChild(objInfQty);
}

DBFlightSearch.prototype.getValueString = function(strValue) {
	var strReturnValue = strValue;
	if ( strValue < 10 ) {
		strReturnValue = "0" + strValue;
	}
	return strReturnValue;
}
DBFlightSearch.prototype.doSubmitData2 = function (e) {
	if(YAHOO.util.Dom.hasClass(this.openJawButton, 'disabled')) return;
	YAHOO.util.Dom.get('goToPage').value = "home_openjaw";
	this.doSubmitDataRoot(e);
}
DBFlightSearch.prototype.doSubmitData = function (e) {
	YAHOO.util.Dom.get('goToPage').value = "";
	this.doSubmitDataRoot(e);
}
DBFlightSearch.prototype.doSubmitDataRoot = function (e) {
	this.setCabinClassParameter();
	this.fillChildInfo();
	YAHOO.util.Event.preventDefault(e);
	try {top.document.documentElement.scrollTop = 0} catch (e) {};
	document.body.className = 'waiting';
	this.waitingPageActive = true;
	if (!this.acSelectionMade) {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "autocomplete_no_selection_from_list", "z_ebt_eventplace" : this.ebtPage.wtEventPlace, "z_ebt_event" : "1"});
	}
	if (this.recentSearches && YAHOO.util.Dom.getElementsByClassName('error').length < 1) this.recentSearches.add();
	this.formatDataBeforeSubmit();
	document.forms['ebt-flight-searchform'].submit();
}
DBFlightSearch.prototype.setCabinClassParameter = function () {
	var cabinClass = YAHOO.util.Dom.get('ebt-cabin-class');
	var ccIndex = cabinClass.selectedIndex;
	var ccValue = cabinClass.options[cabinClass.selectedIndex].value;
	var cffccValue = "ECONOMY";
	if (ccValue.indexOf( "BUS") > -1)
	{
		cffccValue = "BUSINESS";
	}
	YAHOO.util.Dom.get('cffcc').value = cffccValue;
}
DBFlightSearch.prototype.showErrors = function (e) {
	var errorContainer = YAHOO.util.Dom.get('ebt-home-error-messages');
	var errorDisplayContainer = YAHOO.util.Dom.get('error-message-home-container');
	if (errorContainer && errorDisplayContainer && errorContainer.innerHTML != '') {
		errorDisplayContainer.innerHTML = errorContainer.innerHTML;
		errorDisplayContainer.id = 'error-message-home-container-show';
	}
}
DBFlightSearch.prototype.hideReturnDates = function () {
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-return-label'), 'disabled');
	YAHOO.util.Dom.get('ebt-return-label').disabled = 'disabled';
                YAHOO.util.Dom.get('ebt-return-date').disabled = 'disabled';
                YAHOO.util.Dom.get('ebt-fixed-dates').click();
                YAHOO.util.Dom.get('ebt-flexible-dates').disabled = 'disabled';
                if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').disabled = 'disabled';
                var ojLink = YAHOO.util.Dom.get('ebt-open-jaw-opt-link');
                if (ojLink) {
                        YAHOO.util.Dom.addClass(ojLink, 'disabled');
               }
                if (YAHOO.util.Dom.get('ebt-return-date-icon') && (YAHOO.util.Dom.get('ebt-return-date-icon').childNodes[0])) {
                        YAHOO.util.Dom.get('ebt-return-date-icon').style.cursor = 'default';
                        YAHOO.util.Dom.get('ebt-return-date-icon').style.backgroundPosition = '0 -50px';
                }
}
DBFlightSearch.prototype.showReturnDates = function () {
                YAHOO.util.Dom.get('ebt-return-label').disabled = '';
                YAHOO.util.Dom.get('ebt-return-date').disabled = '';
                YAHOO.util.Dom.get('ebt-flexible-dates').disabled = '';
                if (YAHOO.util.Dom.get('ebt-return-label')) YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('ebt-return-label'), 'disabled');
                if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').disabled = '';
                var ojLink = YAHOO.util.Dom.get('ebt-open-jaw-opt-link');
                if (ojLink) {
                        YAHOO.util.Dom.removeClass(ojLink, 'disabled');
                }
                if (YAHOO.util.Dom.get('ebt-return-date-icon') && (YAHOO.util.Dom.get('ebt-return-date-icon').childNodes[0])) {
                        YAHOO.util.Dom.get('ebt-return-date-icon').style.cursor = 'pointer';
                        YAHOO.util.Dom.get('ebt-return-date-icon').style.cursor = 'hand';
                        YAHOO.util.Dom.get('ebt-return-date-icon').style.backgroundPosition = '0 0';
                }
}

DBFlightSearch.prototype.getInitialCabinClasses = function () {
	var callback = { 
		success: this.parseCabinClasses, 
		scope: this
	};

	var url = this.cabinClassURL
	YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}
DBFlightSearch.prototype.getCabinClasses = function (e) {
	var callback = { 
		success: this.parseCabinClasses, 
		scope: this
	};
	var orgBox = YAHOO.util.Dom.get('ebt-departure-place');
	if (orgBox) var org = orgBox.options[orgBox.selectedIndex].value;
	var dest = YAHOO.util.Dom.get('ebt-airportcode').value;

	var url = this.cabinClassURL + '&origin=' + org + '&destination=' + dest;
	YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}
DBFlightSearch.prototype.parseCabinClasses = function (o) {
	if (this.waitingPageActive) return;
	var currentSelected = this.cabinClassBox.selectedIndex;
	var ccOptions = (eval('(' + o.responseText + ')'));
	var newOption;
	while (this.cabinClassBox.childNodes[0]) this.cabinClassBox.removeChild(this.cabinClassBox.childNodes[0]);
	for (var i =0; i < ccOptions.options.length; i+=2) {
		newOption = new HTMLNode(document, 'option', {}, ccOptions.options[i]);
		newOption.value = ccOptions.options[i+1];
		this.cabinClassBox.appendChild(newOption);
	}
	if (currentSelected == 2 && this.cabinClassBox.options.length == 2) currentSelected = 1;
	try {this.cabinClassBox.selectedIndex = currentSelected} catch (e) {}
	
}
DBFlightSearch.prototype.initShoppingCartLink	= function () {
	var scLink = YAHOO.util.Dom.get('ebt-shoppingcart-link');
	var cookie = getCookie(this.ebtPage.pos + "_ShoppingCartCookie");
	var today = new Date();
	
	if (scLink && cookie) {
		
		var date, y, m, d;
		var scItems = eval(cookie.split('+')[1]);
		var total = scItems.length;
		
		for (var i = 0; i < scItems.length; i++) {
			y = scItems[i].split('-')[0];
			m = scItems[i].split('-')[1];
			d = scItems[i].split('-')[2];
			date = new Date(parseInt(y, 10), parseInt((m - 1), 10), parseInt((d), 10) + 1);
			if (today.getTime() > date.getTime()) {
				total--;
			}
		}
		if (total=='undefined') total=0;
		scLink.innerHTML = total;
		
		if (total > 0) {
			scLink.parentNode.parentNode.style.visibility = 'visible';
		}
		return;
	}
}
DBFlightSearch.prototype.formatDataBeforeSubmit = function () {
	var depDate = YAHOO.util.Dom.get('ebt-departure-date').value.split('/');
	if (depDate[this.flightDater.yPos] && depDate[this.flightDater.yPos].length == 2) {
		depDate[this.flightDater.yPos] = '20' + depDate[this.flightDater.yPos];
	}
	if (depDate[this.flightDater.mPos] && depDate[this.flightDater.mPos].length == 1) {
		depDate[this.flightDater.mPos] = '0' + depDate[this.flightDater.mPos];
	}
	if (depDate[this.flightDater.dPos] && depDate[this.flightDater.dPos].length == 1) {
		depDate[this.flightDater.dPos] = '0' + depDate[this.flightDater.dPos];
	}
	YAHOO.util.Dom.get('ebt-departure-date').value = depDate[this.flightDater.yPos] + '-' + depDate[this.flightDater.mPos] + '-' + depDate[this.flightDater.dPos];
	
	var retDate = YAHOO.util.Dom.get('ebt-return-date').value.split('/');
	if (retDate[this.flightDater.yPos] && retDate[this.flightDater.yPos].length == 2) {
		retDate[this.flightDater.yPos] = '20' + retDate[this.flightDater.yPos];
	}
	if (retDate[this.flightDater.mPos] && retDate[this.flightDater.mPos].length == 1) {
		retDate[this.flightDater.mPos] = '0' + retDate[this.flightDater.mPos];
	}
	if (retDate[this.flightDater.dPos] && retDate[this.flightDater.dPos].length == 1) {
		retDate[this.flightDater.dPos] = '0' + retDate[this.flightDater.dPos];
	}
	
	YAHOO.util.Dom.get('ebt-return-date').value = retDate[this.flightDater.yPos] + '-' + retDate[this.flightDater.mPos] + '-' + retDate[this.flightDater.dPos];
	
	YAHOO.util.Dom.get('ebt-inboundOrigin').value = YAHOO.util.Dom.get('ebt-airportcode').value;
	YAHOO.util.Dom.get('ebt-inboundOrigin-location-type').value = YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value;
	YAHOO.util.Dom.get('ebt-inboundDestination').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].value;
}
DBFlightSearch.prototype.updateOriginType = function (e) {
    var orgBox = YAHOO.util.Dom.get('ebt-departure-place');
    var orgLocType = YAHOO.util.Dom.get('ebt-outbound-origin-location-type');
    if (this.origins[orgBox.selectedIndex].group == "true" || this.origins[orgBox.selectedIndex].group == true) {
        orgLocType.value = "city";
    } else {
        orgLocType.value = "airport";
    }
}

// --------------------------------------------------------------------------------------------
//
// FlightDater component
//
// --------------------------------------------------------------------------------------------
function FlightDater (bookingTool, dateFormat, depDate, retDate, maxDate, months, days, closeText) {
	this.bookingTool = bookingTool;
	this.initDateFormat(dateFormat);
	var today = new Date();
	this.depDate = this.formatDate(dateFormat, (today.getTime() + (depDate * 1000 * 60 * 60 * 24)));
	this.retDate = this.formatDate(dateFormat, (today.getTime() + ((depDate + retDate) * 1000 * 60 * 60 * 24)));
	this.minDate = this.formatDate('mm/dd/yyyy', today);
	this.maxDate = this.formatDate('mm/dd/yyyy', (today.getTime() + (maxDate * 1000 * 60 * 60 * 24)));
	
	// init departuredate
	this.depDateIcon = YAHOO.util.Dom.get('ebt-departure-date-icon');
	this.depCalendar = new EBTCalendar (null, YAHOO.util.Dom.get('ebt-departure-date'), dateFormat, this.depDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.depDateIcon, "click", this.depCalendar.show, [this.depCalendar, YAHOO.util.Dom.get('ebt-departure-date'), true], true); 
	
	// init returndate
	this.retDateIcon = YAHOO.util.Dom.get('ebt-return-date-icon');
	this.retCalendar = new EBTCalendar (null, YAHOO.util.Dom.get('ebt-return-date'), dateFormat, this.retDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.retDateIcon, "click", this.retCalendar.show, [this.retCalendar, YAHOO.util.Dom.get('ebt-return-date'), true], true); 
	this.depCalendar.cal.selectEvent.subscribe(this.selectdepDate, this, true);
	this.depDateChange = new YAHOO.util.CustomEvent("dateChange", this);
	this.selectdepDate();
}
FlightDater.prototype.formatDate = function (format, d) {
	var date = new Date(d);
	var dPos, mPos, yPos;
	var sDate = format.split('/');
	
	// determine format;
	sDate[0] == 'mm' ? mPos = 0 : (sDate[1] == 'mm' ? mPos = 1 : mPos = 2);
	sDate[0] == 'dd' ? dPos = 0 : (sDate[1] == 'dd' ? dPos = 1 : dPos = 2);
	sDate[0].indexOf('yy') != -1 ? yPos = 0 : (sDate[1].indexOf('yy') != -1 ? yPos = 1 : yPos = 2);

	// format new date in array
	var aFormattedDate = new Array();
	aFormattedDate[dPos] = date.getDate();
	aFormattedDate[mPos] = date.getMonth() + 1;
	aFormattedDate[yPos] = date.getFullYear();
	
	// make string from array
	var s = aFormattedDate[0] + '/' + aFormattedDate[1] + '/' + aFormattedDate[2];
	
	return s;
}
FlightDater.prototype.initDateFormat = function (format) {
	var sDate = format.split('/');
	
	// determine format;
	sDate[0] == 'mm' ? this.mPos = 0 : (sDate[1] == 'mm' ? this.mPos = 1 : this.mPos = 2);
	sDate[0] == 'dd' ? this.dPos = 0 : (sDate[1] == 'dd' ? this.dPos = 1 : this.dPos = 2);
	sDate[0].indexOf('yy') != -1 ? this.yPos = 0 : (sDate[1].indexOf('yy') != -1 ? this.yPos = 1 : this.yPos = 2);
    this.longYear = sDate[this.yPos].length > 2 ? true : false;
}
FlightDater.prototype.selectdepDate = function (e) {
	// update Return calendar
	var selectedDepDate = this.depCalendar.getSelectedDates()[0];
	this.retCalendar.cal.cfg.setProperty("mindate", selectedDepDate); 
	if ((selectedDepDate > this.retCalendar.getSelectedDates()[0])) {
		this.retCalendar.cal.select(selectedDepDate);
	}
	this.depDateChange.fire(selectedDepDate);
}
// --------------------------------------------------------------------------------------------
//
// ChildrensBox component
//
// --------------------------------------------------------------------------------------------
function ChildrensBox (bookingTool, months) {
	this.bookingTool = bookingTool;
	this.months = months;
	this.createChildrensBoxDOM();
	this.cbTooltipElement = new ToolTip('ebt-children-tooltip');
	this.cbTooltipLink = YAHOO.util.Dom.get('ebt-children-tooltiplink');
	this.cbTooltipLinkText = this.cbTooltipLink.innerHTML;
	this.childrenList = YAHOO.util.Dom.get('ebt-children-listed');
	this.childrenFormdata = YAHOO.util.Dom.get('ebt-children-formdata');
	this.cbCheckBox = YAHOO.util.Dom.get('ebt-with-children');
		
	// init language dependent texts for children's box
	this.infantText = YAHOO.util.Dom.get('ebt-cb-infant-text').innerHTML;
	this.childText = YAHOO.util.Dom.get('ebt-cb-child-text').innerHTML;
	this.youngadultText = YAHOO.util.Dom.get('ebt-cb-youngadult-text').innerHTML;
	this.adultText = YAHOO.util.Dom.get('ebt-cb-adult-text').innerHTML;
	this.removeText = YAHOO.util.Dom.get('ebt-cb-remove-text').innerHTML;
	this.errorText = YAHOO.util.Dom.get('ebt-cb-error-text').innerHTML;
	
	this.nrOfChildren = 0;
	this.maxChildren = 9;
	this.children = new Array();
	this.childrenAdmin = new Array();
	this.years = new Array();
	var today = new Date();
	var thisYear = today.getFullYear();
	var yearIndex = 0;
	for (var i = thisYear - 14; i <= thisYear; i++) {
		this.years[yearIndex] = i;
		yearIndex++;
	}
	var currentChildren = this.childrenFormdata.getElementsByTagName('input');
	if (currentChildren.length > 0) {
		this.init(currentChildren);
	} else {
		// add first child (by default);
		// this.clickAddChild();
	}

	// init click event to open popup
	YAHOO.util.Event.addListener(this.cbCheckBox, 'click', this.open, [this, this.cbCheckBox] , true);

	// init click event to close popup and cancel
	YAHOO.util.Event.addListener(this.cbCloseBut, 'click', this.cancelAndclose, this, true);

	// init button to add Child
	YAHOO.util.Event.addListener(this.addChildBut, 'click', this.clickAddChild, this, true);

	// init click event to save entered data
	YAHOO.util.Event.addListener(this.cbSubmitForm, 'click', this.saveAndClose, this, true);
}
ChildrensBox.prototype.createChildrensBoxDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.cbPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-children-box'}, '<h3>' + YAHOO.util.Dom.get('ebt-cb-title').innerHTML + '</h3>');

	this.cbCloseBut = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, null, 'close-overlay');
	this.cbPopupElement.appendChild(this.cbCloseBut);

	var cbContent = new HTMLNode(targetDocument, 'div', {}, '', 'content');
	var myLink =  YAHOO.util.Dom.get('ebt-cb-helplink') ? YAHOO.util.Dom.get('ebt-cb-helplink').innerHTML : '/';
	var helpLink = new HTMLNode(targetDocument, 'a', {id:'tt-help-children', href:myLink, target:'_blank'}, YAHOO.util.Dom.get('ebt-cb-helptext').innerHTML, 'help-overlay');
	cbContent.appendChild(helpLink);
	
	var myh4 = new HTMLNode(targetDocument, 'h4', {}, YAHOO.util.Dom.get('ebt-cb-subtitle').innerHTML);
	cbContent.appendChild(myh4);
	
	var mybr = new HTMLNode(targetDocument, 'br', {clear: 'all'});
	cbContent.appendChild(mybr);
	
	var cbInnerContent = new HTMLNode(targetDocument, 'div', {}, '<p>' + YAHOO.util.Dom.get('ebt-cb-introtext').innerHTML + '</p>', 'inner-content');
	this.childrenContainer = new HTMLNode(targetDocument, 'div', {id:'ebt-child-form'}, null, 'form-container');
	cbInnerContent.appendChild(this.childrenContainer);
	
	this.maxChildrenError = new HTMLNode(targetDocument, 'div', {id:'ebt-maxchildren-error'}, '<p class="date-warning">' + YAHOO.util.Dom.get('ebt-cb-max-error').innerHTML + '</p>');
	cbInnerContent.appendChild(this.maxChildrenError);
	cbContent.appendChild(cbInnerContent);
	this.cbPopupElement.appendChild(cbContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	var span1 = new HTMLNode(targetDocument, 'span', {}, null, 'add-child');
	this.addChildBut = new HTMLNode(targetDocument, 'a', {id:'ebt-add-child', href:'javascript:;'}, YAHOO.util.Dom.get('ebt-cb-add-text').innerHTML);
	span1.appendChild(this.addChildBut);
	footer.appendChild(span1);

	this.cbSubmitForm = new HTMLNode(targetDocument, 'a', {id:'ebt-children-submit', href:'javascript:;'});
	var span2 = new HTMLNode(targetDocument, 'span', {}, YAHOO.util.Dom.get('ebt-cb-save-text').innerHTML, 'save-button');
	this.cbSubmitForm.appendChild(span2);
	footer.appendChild(this.cbSubmitForm);

	this.cbPopupElement.appendChild(footer);
	targetDocument.body.appendChild(this.cbPopupElement);
}
ChildrensBox.prototype.open = function (e, args) {
	var base = args[0];
	var checkBox = args[1];
	
	if (checkBox.checked && base.childrenAdmin) {
		while(base.nrOfChildren > 0) base.children[base.nrOfChildren-1].remove();
		if (base.childrenAdmin.length == 0) 
			base.clickAddChild();
		else {
			for (var i = 0; i < base.childrenAdmin.length; i++) {
				base.addChild(base.childrenAdmin[i]);
			}
		}
		base.maxChildrenError.style.display = 'none';
		if (base.bookingTool.ebtPage.lightBox) base.bookingTool.ebtPage.lightBox.show();
		base.animateOpen();
	} else {
		while(base.nrOfChildren > 0) base.children[base.nrOfChildren-1].remove();
		base.childrenAdmin = [];
		base.returnFormElements();
		base.cbTooltipLink.innerHTML = base.cbTooltipLinkText;
		base.cbTooltipLink.className = '';
		base.cbCheckBox.checked = false;
		YAHOO.util.Event.removeListener(base.cbTooltipLink, 'mouseover', base.cbTooltipElement.show);
	}
}
ChildrensBox.prototype.animateOpen = function () {
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "open"});
	this.cbPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.cbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
ChildrensBox.prototype.cancelAndclose = function () {
	this.maxChildrenError.style.display = 'none';
	if (this.childrenAdmin.length == 0) {
		this.cbCheckBox.checked = false;
	}
	this.close();
}
ChildrensBox.prototype.saveAndClose = function () {
	if (this.nrOfChildren > 0) {
		// ignore saveclick if date error(s)
		for (var i = 0; i < this.nrOfChildren; i++) {
			if (this.children[i].hasError) return;
		}
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "save all"});
		this.cbTooltipLink.className = 'ebt-children-tooltiplink';
		this.cbTooltipLink.innerHTML = this.nrOfChildren + '&nbsp;'  + this.cbTooltipLinkText;
		while (this.childrenList.childNodes.length > 0) {
			this.childrenList.removeChild (this.childrenList.firstChild);
		}
		var newChild;
		this.childrenAdmin = [];
		for (var i = 0; i < this.nrOfChildren; i++) {
			newChild = document.createElement('li');
			newChild.innerHTML = this.children[i].day + '-' + this.months[this.children[i].month -1] + '-' + this.children[i].year + ' (' + this.children[i].ageGroupText + ')';
			this.childrenList.appendChild(newChild);
            this.childrenAdmin[i] = [this.children[i].selectedDayIndex, this.children[i].selectedMonthIndex, this.children[i].selectedYearIndex, this.children[i].isInfant, this.children[i].isChild];
		}
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show, this.cbTooltipElement, true);
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide, this.cbTooltipElement, true);
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'click', this.open);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'click', this.open, [this, this.cbCheckBox], true);
	} else {
		while(this.nrOfChildren > 0) this.children[base.nrOfChildren-1].remove();
		this.childrenAdmin = [];
		this.cbTooltipLink.innerHTML = this.cbTooltipLinkText;
		this.cbTooltipLink.className = '';
		this.cbCheckBox.checked = false;
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
	}
	this.returnFormElements();
	this.close();
}
ChildrensBox.prototype.returnFormElements = function () {
	while (this.childrenFormdata.childNodes.length > 0) this.childrenFormdata.removeChild(this.childrenFormdata.firstChild);
	if (this.childrenAdmin) {
		for (var i = 0; i < this.childrenAdmin.length; i++) {
			var inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].day';
			inputEl.name = 'child[' + i + '].day';
			inputEl.value = this.children[i].day;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].month';
			inputEl.name = 'child[' + i + '].month';
			inputEl.value = this.children[i].month;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].year';
			inputEl.name = 'child[' + i + '].year';
			inputEl.value = this.children[i].year;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isInfant';
			inputEl.name = 'child[' + i + '].infant';
			inputEl.value = this.children[i].isInfant;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isChild';
			inputEl.name = 'child[' + i + '].child';
			inputEl.value = this.children[i].isChild;
			this.childrenFormdata.appendChild(inputEl);
		}
	}
}
ChildrensBox.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.cbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.cb = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.hide();
}
ChildrensBox.prototype.finishClose = function () {
	this.cb.cbPopupElement.style.display = 'none';
}
ChildrensBox.prototype.init = function (inputFields) {
	this.cbCheckBox.checked = true;
	var yearIndex;
	for (var i=0; i < inputFields.length; i+=5) {
		yearIndex = 0;
		while ((yearIndex < this.years.length) && (this.years[yearIndex] != inputFields[i+2].value)) yearIndex++;
		this.addChild([(inputFields[i].value - 1), (inputFields[i+1].value - 1), yearIndex]);
	}
	this.saveAndClose();
}
ChildrensBox.prototype.addChild = function (initValues) {
	if (this.nrOfChildren < this.maxChildren) {
		this.nrOfChildren++;
		this.children[this.nrOfChildren-1] = new Child(this, this.nrOfChildren, initValues);
	} else {
		this.maxChildrenError.style.display = 'block';
	}
}
ChildrensBox.prototype.clickAddChild = function () {
	if (this.nrOfChildren < this.maxChildren) {
		this.nrOfChildren++;
		this.children[this.nrOfChildren-1] = new Child(this, this.nrOfChildren, null);
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "add child"});
	} else {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "more_then_9"});
		this.maxChildrenError.style.display = 'block';
	}
}
ChildrensBox.prototype.updateChildOrder = function (num) {
	this.maxChildrenError.style.display = 'none';
	for (var i = num; i < this.nrOfChildren; i++) {
		this.children[i-1] = this.children[i];
		this.children[i-1].updateOrderNr(i);
	}
	this.children[this.nrOfChildren - 1] = null;
	this.nrOfChildren--;
}
ChildrensBox.prototype.updateChildrensData = function (type, args, base) {
    for (var i = 0; i < base.nrOfChildren; i++) {
        base.children[i].checkDate();
    }
    while (base.childrenList.childNodes.length > 0) base.childrenList.removeChild (base.childrenList.firstChild);
    var newChild;
    for (var i = 0; i < base.nrOfChildren; i++) {
        newChild = document.createElement('li');
        newChild.innerHTML = base.children[i].day + '-' + base.months[base.children[i].month -1] + '-' + base.children[i].year + ' (' + base.children[i].ageGroupText + ')';
        base.childrenList.appendChild(newChild);
    }
}

// --------------------------------------------------------------------------------------------
//
// Child component
//
// --------------------------------------------------------------------------------------------
function Child (cb, num, selectedValues) {
	this.childrenBox = cb;
	this.targetDocument = this.childrenBox.bookingTool.ebtPage.targetDoc;
	this.container = this.targetDocument.createElement('fieldset');
	this.num = num;
	this.saved = false;
	this.generateChildsHTML();
	// ranking for child
	YAHOO.util.Event.addListener(this.removeBut, 'click', this.remove, this,  true);
	// referrer to errortext
	YAHOO.util.Event.addListener(this.dayBox, 'change', this.checkDate, this, true);
	YAHOO.util.Event.addListener(this.monthBox, 'change', this.checkDate, this, true);
	YAHOO.util.Event.addListener(this.yearBox, 'change', this.checkDate, this, true);
	if (selectedValues && selectedValues.length >= 3) {
		this.dayBox.selectedIndex = selectedValues[0];
		this.monthBox.selectedIndex = selectedValues[1];
		this.yearBox.selectedIndex = selectedValues[2];
	}
	// init default date set
	this.checkDate();
}
Child.prototype.generateChildsHTML = function () {
	var days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'];
	
	this.rankingText = new HTMLNode(this.targetDocument, 'span', {id:"ebt-ranking-" + this.num}, this.num, 'ranking');
	this.container.appendChild(this.rankingText);

	this.dayBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-day-" + this.num}, '');
	
	var o;
	for (var i = 0; i < days.length; i++) {
			o = new HTMLNode(this.targetDocument, 'option', {value:days[i]}, days[i]);
			this.dayBox.appendChild(o);
	}
	this.container.appendChild(this.dayBox);

	this.monthBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-month-" + this.num}, '');
	for (i = 0; i < this.childrenBox.months.length; i++) {
			o = new HTMLNode(this.targetDocument, 'option', {value:i+1}, this.childrenBox.months[i]);
			this.monthBox.appendChild(o);
	}
	this.container.appendChild(this.monthBox);

	this.yearBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-year-" + this.num}, '');
	var today = new Date();
	var thisYear = today.getFullYear();
	var yearIndex = 0;
	for (i = thisYear - 14; i <= thisYear; i++) {
		o = new HTMLNode(this.targetDocument, 'option', {value:i}, i);
		this.yearBox.appendChild(o);
		this.childrenBox.years[yearIndex] = i;
		yearIndex++;
	}
	this.container.appendChild(this.yearBox);

	this.ageGroup = new HTMLNode(this.targetDocument, 'span', {id:"ebt-child-agegroup-" + this.num}, this.childrenBox.youngadultText, 'classification');
	this.container.appendChild(this.ageGroup);

	this.removeBut = new HTMLNode(this.targetDocument, 'span', {id:"ebt-child-remove-" + this.num}, '<a href="javascript:;" id="ebt-child-remove-' + this.num + '">' + this.childrenBox.removeText + '</a>', 'remove-record');
	this.container.appendChild(this.removeBut);

	this.errorP = new HTMLNode(this.targetDocument, 'p', {id:"ebt-child-error-" + this.num}, this.childrenBox.errorText, 'date-warning');
	this.container.appendChild(this.errorP);
	this.childrenBox.childrenContainer.appendChild(this.container);
}
Child.prototype.generateYears = function () {
	var today = new Date();
	var thisYear = today.getFullYear();
	var sHTML = '';
	var yearIndex = 0;
	for (var i = thisYear - 14; i <= thisYear; i++) {
		sHTML += '<option value="' + i + '">' + i + '</option>';
		this.childrenBox.years[yearIndex] = i;
		yearIndex++;
	}
	
	return sHTML;
}
Child.prototype.checkDate = function () {
	this.selectedDayIndex = this.dayBox.options.selectedIndex;
	this.day = parseInt(this.dayBox.options[this.selectedDayIndex].value, 10);
	this.selectedMonthIndex = this.monthBox.options.selectedIndex;
	this.month = parseInt(this.monthBox.options[this.selectedMonthIndex].value, 10);
	this.selectedYearIndex = this.yearBox.options.selectedIndex;
	this.year = parseInt(this.yearBox.options[this.selectedYearIndex].value, 10);
	this.isInfant = this.isChild = this.isYoungAdult = false;
	var date = new Date(this.year, this.month-1, this.day);
	var today = new Date();
	if ((date.getMonth() + 1) == this.month && date < today) {
		this.errorP.style.display = 'none';
		this.hasError = false;
	} else {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "wrong_dob"});
		this.errorP.style.display = 'block';
		this.hasError = true;
		this.ageGroup.innerHTML = '';
		return;
	}
	// check age group for entered birthdate
	if (this.childrenBox.bookingTool.flightDater && this.childrenBox.bookingTool.flightDater.depCalendar) {
		var refDate = this.childrenBox.bookingTool.flightDater.depCalendar.getSelectedDates()[0];
	} else {
		var refDate = new Date();
	}
	refDate.setDate(refDate.getDate());
	// check if Infant
	refDate.setFullYear(refDate.getFullYear() - 2);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.infantText;
		this.isInfant = true;
		return;
	}
	// check if Child
	refDate.setFullYear(refDate.getFullYear() - 10);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.childText;
		this.isChild = true;
		return;
	}

                //young adult
	refDate.setFullYear(refDate.getFullYear() - 2);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.youngadultText;
		return;
	}

	this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.adultText;
}
Child.prototype.remove = function () {
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "remove child"});
	this.container.parentNode.removeChild(this.container);
	this.childrenBox.updateChildOrder(this.num);
}
Child.prototype.updateOrderNr = function (newNr) {
	this.num = newNr;
	if (newNr % 2 == 0) 
		this.container.className = 'fieldset-even';
	else
		this.container.className = '';
	this.rankingText.id = 'ebt-ranking-' + newNr;
	this.rankingText.innerHTML = newNr;
	this.ageGroup.id = 'ebt-child-agegroup-' + newNr;
	this.removeBut.id = 'ebt-child-remove-' + newNr;
	this.errorP.id = 'ebt-child-error-' + newNr;
	this.dayBox.id = this.dayBox.name = 'ebt-child-day-' + newNr;
	this.monthBox.id = this.monthBox.name = 'ebt-child-month-' + newNr;
	this.yearBox.id = this.yearBox.name = 'ebt-child-year-' + newNr;
}
// --------------------------------------------------------------------------------------------
//
// AutoComplete component
//
// --------------------------------------------------------------------------------------------
var airportToData = new Array();
var airportFromData = new Array();
function AutoComplete (bookTool, JSONData, inputField, airportCodeInputField, locationTypeInputField, dataContainer, from) {
	this.dataReady = new YAHOO.util.CustomEvent("dataReady", this);
	this.bookingTool = bookTool;
	this.from = from;
	this.airportCodeInputField = YAHOO.util.Dom.get(airportCodeInputField);
	this.locationTypeInputField = YAHOO.util.Dom.get(locationTypeInputField);
	this.inputField = YAHOO.util.Dom.get(inputField);
	YAHOO.util.Event.addListener(this.inputField, "focus", function () {if (YAHOO.util.Dom.hasClass(this, 'entered')) {this.select()} else {this.value = ''}});
	YAHOO.util.Event.addListener(this.inputField, "focus", this.autoHelptip, this, true); 
	YAHOO.util.Event.addListener(this.inputField, "keydown", function () {this.style.color = '#023167'; YAHOO.util.Dom.addClass(this, 'entered')});
	YAHOO.util.Event.addListener(this.inputField, "keyup", this.updateHiddenField, this, true);
	YAHOO.util.Event.addListener(this.inputField, "blur", function (e) {YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'on')});
	if (this.airportCodeInputField.value != '') {this.inputField.style.color = '#023167'; YAHOO.util.Dom.addClass(this.inputField, 'entered')}
	YAHOO.util.Dom.addClass(this.inputField, "waiting");
	this.inputField.disabled = "disabled";
	this.parseAirportData(JSONData);
	this.from ? this.ACDS = new YAHOO.widget.DS_JSFunction(this.getFromMatches) : this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatches);
	this.autoComplete = new YAHOO.widget.AutoComplete(inputField, dataContainer, this.ACDS);
	this.autoComplete.queryDelay = 0; 
	this.autoComplete.maxResultsDisplayed = 100;
	this.autoComplete.obj = this;
	if (this.bookingTool.ebtPage.browser == 'ie55' || this.bookingTool.ebtPage.browser == 'ie6') this.autoComplete.useIFrame = true;
	this.autoComplete.autoHighlight = false; 

	this.autoComplete.itemSelectEvent.subscribe(this.selectAirport);
	this.autoComplete.dataReturnEvent.subscribe(this.onDataReturn);
	// formats the autocomplete suggestions; highlight the searchquery by making it bold
	this.autoComplete.formatResult = function(oResultItem, sQuery) {
		var city = oResultItem[0];
		var state = oResultItem[1];
		var country = oResultItem[2];
		var airport = oResultItem[3];
		var airportCode = oResultItem[4];
		var cityGroup = oResultItem[5];
		var numberOf = oResultItem[6];
		
		sQuery = unescape(sQuery);		
		// highlight (<strong>) searchquery in resultlist
		var regExp = new RegExp("(^)(" + sQuery + ")(.*)", "i");
		city = city.replace(regExp, '$1<strong>$2</strong>$3');
		if (state) state = state.replace(regExp, '$1<strong>$2</strong>$3');
		country = country.replace(regExp, '$1<strong>$2</strong>$3');
		airport = airport.replace(regExp, '$1<strong>$2</strong>$3');
		airportCode = airportCode.replace(regExp, '$1<strong>$2</strong>$3');
		if (cityGroup) {
			airportCode = numberOf;
		}
		// return markup for ac-suggestions
		var sMarkup = '';
		sMarkup += city + ' - ' + airport + ' (' + airportCode + ')';
		// add state if available
		sMarkup += state ? ", " + state + ", " : ", ";
		sMarkup += country;
		// if airportgroup, make italic;
		if (cityGroup) sMarkup = '<i>' + sMarkup + '</i>';
		
		return (sMarkup);
	}

	// replace _sResultKey in autocomplete Object to display full text on selectEvent
	this.autoComplete.doBeforeExpandContainer = function (oTextbox, oContainer, sQuery, aResults) {
		var resultList = oContainer.getElementsByTagName('li');
		// delete <strong> tags
		var regExp = new RegExp("<strong>(.*?)</strong>", "ig");
		for (var i = 0; i < resultList.length; i++) {
			// add ranking for WebTrends measurement
			resultList[i].ranking = i + 1;
			if (resultList[i].innerHTML != '') {
				resultList[i]._sResultKey = resultList[i].innerHTML.replace(regExp, '$1')
			} 
		}
		// delete <i> tags, if present
		regExp = new RegExp("<i>(.*?)</i>", "ig");
		for (var i = 0; i < resultList.length; i++) {
			if (resultList[i].innerHTML != '') {
				resultList[i]._sResultKey = resultList[i]._sResultKey.replace(regExp, '$1')
			} 
		}
		return true;
	}
}

// activate the helptip on the autocomplete inputbox
AutoComplete.prototype.autoHelptip = function (e) {

       if (YAHOO.util.Dom.get('ebt-autosuggest-helptip') != null)
       {
	YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on'); 
	var parentXY;
	
	if (YAHOO.util.Dom.get('klm-ebt') != null)
		parentXY = YAHOO.util.Dom.getXY(YAHOO.util.Dom.get('klm-ebt'));
	else if (YAHOO.util.Dom.get('mini-ebt') != null)
		parentXY = YAHOO.util.Dom.getXY(YAHOO.util.Dom.get('mini-ebt'));

	var helptip = YAHOO.util.Dom.get('ebt-autosuggest-helptip');
	YAHOO.util.Dom.setStyle(helptip, 'left', (YAHOO.util.Dom.getX(this.inputField) - parentXY[0]) - 6 + 'px');
	YAHOO.util.Dom.setStyle(helptip, 'top', (YAHOO.util.Dom.getY(this.inputField) - parentXY[1] + parseInt(this.inputField.offsetHeight, 10) - 1) + 'px');

                 var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", helptip)[0];
                 switch(YAHOO.util.Event.getTarget(e).id) {
                                  case "ebt-destination-place": helptipLink.id = "autoHelptip-od-link";
                                                                            break;
                                  case "ebt-from-place-oj": helptipLink.id = "autoHelptip-io-link";
                                                                            break;
                                  case "ebt-destination-place-oj": helptipLink.id = "autoHelptip-id-link"; 
                 }
       }

}
AutoComplete.prototype.onDataReturn = function (e, args) {
	var autoComplete = args[0];
	var query = args[1];
	var results = args[2];
	var error = YAHOO.util.Dom.get('ebt-destination-place-error');


	if (results.length == 0 && query.length > 2)  {
		YAHOO.util.Dom.addClass(autoComplete._oTextbox, 'error');
                                if (error != null)
                                {
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'error');
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on');
			error.style.display = 'block';
		}
		return;
	}
	YAHOO.util.Dom.removeClass(autoComplete._oTextbox, 'error');
                if (error != null)
                {
		YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'error');
		error.style.display = 'none';

		if (results.length > 0 && query.length > 2)  {
			YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'on');
			error.style.display = 'none';
		}
		else {
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on');
		}
	}

}
AutoComplete.prototype.selectAirport = function (e, args) {
	var base = args[0];
	var airportCode = args[2][4];
	var group = args[2][5];
	
	base.obj.bookingTool.acSelectionMade = true;
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "autocomplete_selection_from_list", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : args[1].ranking});
	if (group) {
		base.obj.locationTypeInputField.value = "city";
	} else {
		base.obj.locationTypeInputField.value = "airport";
	}
	base.obj.airportCodeInputField.value = airportCode;
	base.obj.inputField.select();
	base.obj.inputField.blur();
}
AutoComplete.prototype.updateHiddenField = function (e) {
	if (e.keyCode != 13) this.airportCodeInputField.value = this.inputField.value;
}
AutoComplete.prototype.getAirportData = function (xmlFile) {
	var callback = { 
		success: this.parseAirportData, 
		failure: this.handleFailure,
		scope: this
	};
	this.airportXMLData = YAHOO.util.Connect.asyncRequest('GET', xmlFile, callback, null);
}
AutoComplete.prototype.parseAirportData = function (airports) {
	var airportRecord;

	for (var i = 0; i < airports.length; i++) {
		airportRecord = new Array();
		airportRecord[0] = airports[i].city; // City
		airportRecord[1] = airports[i].state; // State
		airportRecord[2] = airports[i].country; // Country
		airportRecord[3] = airports[i].name; // Airportname
		airportRecord[4] = airports[i].code; // AirportCode
		airportRecord[5] = airports[i].group; // grouping name
		if (airportRecord[5]) {
			airportRecord[6] = airports[i].numberof; // Number of airports in this group
		}
		airportToData[i] = airportRecord;
	}
	airportToData.sort(initialSortFunc);
	this.bookingTool.destFinder.parseData(null, null, this.bookingTool.destFinder); 
	YAHOO.util.Dom.removeClass(this.inputField, "waiting");
	this.inputField.disabled="";
}
AutoComplete.prototype.handleFailure = function () {
}
AutoComplete.prototype.getToMatches = function (sQuery) {
	sQuery = unescape(decodeURIComponent(sQuery));
	var aResults = [];
	if (sQuery.length < 3) return aResults;
	
	// priority array; defines order to show results: city, airportcode, airportname, country, state
	var priority = [0, 4, 3, 2, 1, 5];
	var regExp = new RegExp("^" + sQuery, "i");
	
	for (var i = 0; i < airportToData.length; i++) {
		for (var j = 0; j < airportToData[i].length; j++) {
			if (regExp.test(airportToData[i][priority[j]])) {
				aResults.push(airportToData[i]);
				aResults[aResults.length - 1][7] = j;
				break;
			}
		}
	}
	
	aResults.sort(acSortFunc);
	return (sortSecLevelAlphabetic(aResults));
}
function sortSecLevelAlphabetic (results) {
	var arSorted = new Array();
	var arSub = new Array();
	if (results[0])	var group = results[0][7];

	for (var i = 0; i < results.length; i++) {
		if (results[i][7] == group) {
			arSub[arSub.length] = results[i]
		} else {
			arSub.sort(initialSortFunc);
			arSorted = arSorted.concat(arSub);
			arSub = new Array();
			arSub[arSub.length] = results[i]
			group = results[i][7];
		}
	}
	arSub.sort(initialSortFunc);
	arSorted = arSorted.concat(arSub);
	
	return arSorted;
}
function acSortFunc (a, b) {
	if (parseInt(a[7], 10) >= parseInt(b[7], 10)) return 1;
	if (parseInt(a[7], 10) < parseInt(b[7], 10)) return -1;
	return 0;
}
function initialSortFunc (a, b) {
	if (a[0] == b[0] && a[5]) return -1;
	if (a[0] >= b[0]) return 1;
	return -1;
}
// --------------------------------------------------------------------------------------------
//
// RecentSearch component
//
// --------------------------------------------------------------------------------------------
function RecentSearch (bookingTool) {
	this.bookingTool = bookingTool;
	var c = getCookie('klm-ebt-searches');
	if (c) {
		this.searches = eval('(' + c + ')').searches;
		if (this.searches[0].p != this.bookingTool.ebtPage.pos) {
			this.searches = new Array();
		}
	} else {
		this.searches = new Array();
	}
	
	this.createDOM();
	this.rsLink = YAHOO.util.Dom.get('ebt-recent-search-link');
	this.rsPopupElement = YAHOO.util.Dom.get('ebt-rs-box');

	// init click event to open popup
	YAHOO.util.Event.addListener(this.rsLink, 'click', this.open, this, true);

	// init click event to close popup
	YAHOO.util.Event.addListener(this.rsCloseBut, 'click', this.close, this, true);
	YAHOO.util.Event.addListener(this.cbBack, 'click', this.close, this, true);
}
RecentSearch.prototype.createDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.rsPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-rs-box'}, '<h3>' + YAHOO.util.Dom.get('ebt-rs-title').innerHTML + '</h3>');

	this.rsCloseBut = new HTMLNode(targetDocument, 'a', {id:'ebt-rs-close', href:'javascript:;'}, null, 'close-overlay');
	this.rsPopupElement.appendChild(this.rsCloseBut);

	var rsContent = new HTMLNode(targetDocument, 'div', {}, '<p>' + YAHOO.util.Dom.get('ebt-rs-intro').innerHTML + '</p>', 'content');
	
	var s, a, t, p, d, pHTML;
	for (var i = 0; i < this.searches.length; i++) {
		s =  new HTMLNode(targetDocument, 'div', {}, null, 'ebt-rs');
		a = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, '<span>' + YAHOO.util.Dom.get('ebt-rs-selecttext').innerHTML + '</span>', 'ebt-button-special');
		YAHOO.util.Event.addListener(a, 'click', this.selectSearch, [this, i], true);
		s.appendChild(a);
		
		t = new HTMLNode(targetDocument, 'table', {cellspacing:'0'});
		var tbody = new HTMLNode(targetDocument, 'tbody', {});
		var tr = new HTMLNode(targetDocument, 'tr');
		var td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-fromtext').innerHTML);
		tr.appendChild(td);
		if (this.searches[i].oos) {
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].oos + '</strong>'); 
		} else {
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + '' + '</strong>');
		}
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-deptext').innerHTML);
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].od + '</strong>');
		tr.appendChild(td);
		tbody.appendChild(tr);
		
		tr = new HTMLNode(targetDocument, 'tr');
		td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-totext').innerHTML);
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].ois + '</strong>');
		tr.appendChild(td);
		if (this.searches[i].i == '1' ) {
			td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-rettext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].id + '</strong>');
			tr.appendChild(td);
		}
		tbody.appendChild(tr);
		
		if (this.searches[i].i == '2') {
			tr = new HTMLNode(targetDocument, 'tr');
			td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-fromtext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].dos + '</strong>');
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-rettext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].id + '</strong>');
			tr.appendChild(td);
			tbody.appendChild(tr);
			tr = new HTMLNode(targetDocument, 'tr');
			td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-totext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].dis + '</strong>');
			tr.appendChild(td);
			tbody.appendChild(tr);
		}
		
		t.appendChild(tbody);
		s.appendChild(t);
		
		pHTML = this.searches[i].cct + ', ' + YAHOO.util.Dom.get('ebt-number-adults')[this.searches[i].a].value + ' ' + YAHOO.util.Dom.get('ebt-rs-adulttext').innerHTML;
		if (this.searches[i].c.length > 0) {
			pHTML += ', ' + this.searches[i].noc + ' ' + YAHOO.util.Dom.get('ebt-rs-childrentext').innerHTML;
		}
		if (this.searches[i].hotel == "true") {
			pHTML += ', ' + YAHOO.util.Dom.get('ebt-rs-hoteltext').innerHTML;
		}
		p = new HTMLNode(targetDocument, 'p', {}, pHTML);
		s.appendChild(p);
		
		d =  new HTMLNode(targetDocument, 'div', {}, null, 'ebt-rs-bot');
		s.appendChild(d);
		
		rsContent.appendChild(s);
	}

	this.rsPopupElement.appendChild(rsContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	this.cbBack = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, '<span>' + YAHOO.util.Dom.get('ebt-rs-backtext').innerHTML + '</span>', 'ebt-button-back');
	
	footer.appendChild(this.cbBack);
	this.rsPopupElement.appendChild(footer);

	targetDocument.body.appendChild(this.rsPopupElement);
}
RecentSearch.prototype.open = function (e, args) {
    YAHOO.util.Event.preventDefault(e);
	this.rsPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.rsPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.show();
}
RecentSearch.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.rsPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.rs = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.hide();
}
RecentSearch.prototype.finishClose = function () {
	this.rs.rsPopupElement.style.display = 'none';
}
RecentSearch.prototype.add = function () {
	var s = new Object();
	s.p = this.bookingTool.ebtPage.pos;
	
	var orgOut = YAHOO.util.Dom.get('ebt-departure-place');
	s.oov = orgOut[orgOut.selectedIndex].value;
	s.oos = orgOut[orgOut.selectedIndex].text;
	s.oic = YAHOO.util.Dom.get('ebt-airportcode').value;
	var input1 = YAHOO.util.Dom.get('ebt-destination-place');
	if ((input1.value == '') || (!YAHOO.util.Dom.hasClass(input1, 'entered'))) return;
	s.ois = YAHOO.util.Dom.get('ebt-destination-place').value;
	if (YAHOO.util.Dom.get('ebt-outbound-origin-location-type')) s.oolt = YAHOO.util.Dom.get('ebt-outbound-origin-location-type').value;
	s.odlt = YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value;
	
	if (YAHOO.util.Dom.get('ebt-airportcode-from-oj')) {
		s.doc = YAHOO.util.Dom.get('ebt-airportcode-from-oj').value;
		s.dos = YAHOO.util.Dom.get('ebt-from-place-oj').value;
		s.dic = YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value;
		s.dis = YAHOO.util.Dom.get('ebt-destination-place-oj').value;
		s.iolt = YAHOO.util.Dom.get('ebt-inbound-origin-location-type').value;
		s.idlt = YAHOO.util.Dom.get('ebt-inbound-destination-location-type').value;
	}
	
	s.i = this.getItinerary();
	s.fs = YAHOO.util.Dom.get('ebt-flexible-dates').checked;
	var cabinClass = YAHOO.util.Dom.get('ebt-cabin-class');
	s.cc = cabinClass.selectedIndex;
	s.cct = cabinClass.options[cabinClass.selectedIndex].text;
	s.od = YAHOO.util.Dom.get('ebt-departure-date').value;
	s.id = YAHOO.util.Dom.get('ebt-return-date').value;
	s.a = YAHOO.util.Dom.get('ebt-number-adults').selectedIndex;
	s.noc = this.bookingTool.childrensBox.childrenAdmin.length;
	s.c = this.getChildren();
	
	this.findMatch(s);
	this.searches.unshift(s);
	this.storeCookies();
}
RecentSearch.prototype.findMatch = function (s) {
	var matchFound = false;
	if (this.searches.length == 0) return;
	for (var i = 0; i < this.searches.length; i++) {
		matchFound = this.searchesEqual(s, this.searches[i]);
		if (matchFound) {
			this.searches.splice(i, 1)
			return;
		}
	}
}
RecentSearch.prototype.searchesEqual = function (s, storedS) {
	if (s.oov != storedS.oov) return false;
	if (s.oos != storedS.oos) return false;
	if (s.oic != storedS.oic) return false;
	if (s.doc != storedS.doc) return false;
	if (s.dic != storedS.dic) return false;
	if (s.oolt != storedS.oolt) return false;
	if (s.odlt != storedS.odlt) return false;
	if (s.iolt != storedS.iolt) return false;
	if (s.idlt != storedS.idlt) return false;
	if (s.i != storedS.i) return false;
	if ((s.fs && storedS.fs == 'false') || (!s.fs && storedS.fs == 'true')) return false;
	if (s.cc != storedS.cc) return false;
	if (s.cct != storedS.cct) return false;
	if (s.od != storedS.od) return false;
	if (s.id != storedS.id) return false;
	if (s.a != storedS.a) return false;
	if (this.childrenUnique(s.c, storedS.c)) return false;

	return true;
}
RecentSearch.prototype.childrenUnique = function (newC, C) {
	// counter added because C is stored as one-dimensional array and newC as 2-dimensional
	var counter = 0;
	for (var i = 0; i < newC.length; i++) {
		for (var j = 0; j < newC[i].length; j++) {
			if (parseInt(newC[i][j], 10) != parseInt(C[counter], 10)) {return true;}
			counter++;
		}
	}
	return false;
}

RecentSearch.prototype.storeCookies = function () {
	var cookieVal = '{"searches":[';
	for (var i = 0; i < 5; i++) {
		if (this.searches[i]) {
			cookieVal += "{";
			for (var prop in this.searches[i]) {
				if (prop == "c") {
					cookieVal += '"' + prop + '": [' + this.searches[i][prop] + '],';
				} else {
					cookieVal += '"' + prop + '":"' + this.searches[i][prop] + '",';
				}
			}
			// remove last ","
			cookieVal = cookieVal.substr(0, cookieVal.length - 1);
			cookieVal += "}";
			if (this.searches[i+1] && i < 5) cookieVal += ",";
		}
	}
	cookieVal += "]}";
	if (escape(cookieVal).length > 3000) {
		this.searches.pop();
		this.storeCookies();
	} else {
		setEscapedCookie('klm-ebt-searches', cookieVal, 30);
	}
}
RecentSearch.prototype.selectSearch = function (e, args) {
	var base = args[0];
	var index = args[1];
	var s = base.searches[index];
	base.close();
	
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "recent_search", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
    if (s.i == 2) {
        base.deepLinkToOpenJaw(s);
        return;
    }
	var dep = YAHOO.util.Dom.get('ebt-departure-place');
	for (var i = 0; i < dep.options.length; i++) {
		if (dep.options[i].value == s.oov) {
			dep.selectedIndex = i;
			break;
		}
	}
	YAHOO.util.Dom.get('ebt-airportcode').value = s.oic;
	YAHOO.util.Dom.get('ebt-destination-place').value = s.ois;
	YAHOO.util.Dom.get('ebt-destination-place').style.color = '#023167';
	if (YAHOO.util.Dom.get('ebt-outbound-origin-location-type')) YAHOO.util.Dom.get('ebt-outbound-origin-location-type').value = s.oolt;
	YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value = s.odlt;
	if (YAHOO.util.Dom.get('ebt-airportcode-from-oj')) {
		YAHOO.util.Dom.get('ebt-airportcode-from-oj').value = s.doc;
		YAHOO.util.Dom.get('ebt-from-place-oj').value = s.dos;
		YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';
		YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value = s.dic;
		YAHOO.util.Dom.get('ebt-destination-place-oj').value = s.dis;
		YAHOO.util.Dom.get('ebt-destination-place-oj').style.color = '#023167';
		YAHOO.util.Dom.get('ebt-inbound-origin-location-type').value = s.iolt;
		YAHOO.util.Dom.get('ebt-inbound-destination-location-type').value = s.idlt;
	}
	
	if (s.fs == 'true') {
		var ebtFlex = YAHOO.util.Dom.get('ebt-flexible-dates');
		var ebtFix = YAHOO.util.Dom.get('ebt-fixed-dates');
		if ( ebtFlex ) {
			ebtFlex.checked = true;
		}
		if ( ebtFix ) {
			ebtFix.checked = false;
		}
	} else {
		var ebtFlex = YAHOO.util.Dom.get('ebt-flexible-dates');
		var ebtFix = YAHOO.util.Dom.get('ebt-fixed-dates');
		if ( ebtFlex ) {
			ebtFlex.checked = false;
		}
		if ( ebtFix ) {
			ebtFix.checked = true;
		}
	}
	YAHOO.util.Dom.get('ebt-number-adults').selectedIndex = s.a;
	if (new Date(s.od).getTime() + (24 * 60 * 60 * 1000) >= new Date().getTime()) {
		base.bookingTool.flightDater.depCalendar.cal.select(s.od);
	} else {
		base.bookingTool.flightDater.depCalendar.cal.select(base.bookingTool.flightDater.depCalendar.defaultDate);
	}
	base.bookingTool.flightDater.retCalendar.cal.select(s.id);
	// set Children
	if (s.c.length > 0) {
		while(base.bookingTool.childrensBox.nrOfChildren > 0) base.bookingTool.childrensBox.children[base.bookingTool.childrensBox.nrOfChildren-1].remove();
		base.bookingTool.childrensBox.childrenAdmin = [];
		base.bookingTool.childrensBox.cbCheckBox.checked = true;
		for (var i = 0; i < base.searches[index].c.length; i+=5) {
			base.bookingTool.childrensBox.addChild([s.c[i], s.c[i+1], s.c[i+2]]);
		}
		base.bookingTool.childrensBox.saveAndClose();
	} else {
		while(base.bookingTool.childrensBox.nrOfChildren > 0) base.bookingTool.childrensBox.children[base.bookingTool.childrensBox.nrOfChildren-1].remove();
		base.bookingTool.childrensBox.childrenAdmin = [];
		base.bookingTool.childrensBox.cbCheckBox.checked = false;
		base.bookingTool.childrensBox.saveAndClose();
	}
	base.setItinerary(s.i);
	if (s.cc == 2) s.cc = 1;
	YAHOO.util.Dom.get('ebt-cabin-class').selectedIndex = s.cc;
	base.bookingTool.getCabinClasses();

}
RecentSearch.prototype.getChildren = function () {
	return this.bookingTool.childrensBox.childrenAdmin;
}
RecentSearch.prototype.getItinerary = function () {
	if (YAHOO.util.Dom.get('ebt-open-jaw-opt') && YAHOO.util.Dom.get('ebt-open-jaw-opt').checked) {
		return 2;	// Open Jaw
	} else if (YAHOO.util.Dom.get('ebt-round-trip').checked) {
		return 1;	// Retour ticket
	} else {
		return 0;	// One way
	}
}
RecentSearch.prototype.setItinerary = function (itinerary) {
	if (itinerary == 2) {
		if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').checked = 'checked';
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		YAHOO.util.Dom.get('ebt-round-trip').click();
		return;
	} else {
		if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').checked = '';
		YAHOO.util.Dom.removeClass(document.body, 'open-jaw');
	}
	if (itinerary == 1) {
		YAHOO.util.Dom.get('ebt-round-trip').click();
	} else {
		var ebtOneWay = YAHOO.util.Dom.get('ebt-one-way');
		if ( ebtOneWay ) {
			ebtOneWay.click();
		}
	}
}



RecentSearch.prototype.deepLinkToOpenJaw = function (s) {
        var searchString = '?';
       
        searchString += 'pos=' + this.bookingTool.ebtPage.pos;
        searchString += '&lang=' + YAHOO.util.Dom.get('ebt-language').value;
        searchString += '&goToPage=home_openjaw';
        searchString += '&c[0].os=' + s.oov;
        searchString += '&c[0].ost=' + s.oolt.toUpperCase();
        searchString += '&c[0].ds=' + s.oic;
        searchString += '&c[0].dst=' + s.odlt.toUpperCase();
        searchString += '&c[0].dd=' + this.formatDateForDeepLink(s.od);
        searchString += '&c[1].os=' + s.doc;
        searchString += '&c[1].ost=' + s.iolt.toUpperCase();
        searchString += '&c[1].ds=' + s.dic;
        searchString += '&c[1].dst=' + s.idlt.toUpperCase();
        searchString += '&c[1].dd=' + this.formatDateForDeepLink(s.id);
        searchString += '&cffcc=' + (s.cc == "0" ? 'ECONOMY' : 'BUSINESS');
        searchString += '&flex=' + s.fs;
        searchString += '&adtQty=' + this.getNrOfAdults(s);
        searchString += '&chdQty=' + this.getNrOfChildren(s);
        searchString += this.getBirthDates(s, 'chds', 4); // get childrens birthdates (4th in array)
        searchString += '&infQty=' + this.getNrOfInfants(s);
        searchString += this.getBirthDates(s, 'infs', 3); // get infants birthdates (3rd in array)

        var submitURL = YAHOO.util.Dom.get('ebt-flight-searchform').action;
       
        document.location.href = submitURL + searchString;
}
RecentSearch.prototype.formatDateForDeepLink = function (d, longYear) {
    var s = '';
    var splitted = d.split('/');
    s = splitted[this.bookingTool.flightDater.yPos] + '-' + this.addLeadingZero(splitted[this.bookingTool.flightDater.mPos]) + '-' + this.addLeadingZero(splitted[this.bookingTool.flightDater.dPos]);
    if (longYear) return s;
    
    if (!this.bookingTool.flightDater.longYear) {
        s = '20' + s;
    }
    return s;
}
RecentSearch.prototype.getNrOfAdults = function (s) {
    var total = 0;
    
    total += parseInt(YAHOO.util.Dom.get('ebt-number-adults').options[s.a].value, 10);
    for(var i = 0; i < s.c.length; i+=5) {
            if (!s.c[i+3] && !s.c[i+4]) total++;
    }
    return total;
}
RecentSearch.prototype.getNrOfChildren = function (s) {
    var total = 0;
    
    for(var i = 0; i < s.c.length; i+=5) {
            if (s.c[i+4]) total++;
    }
    return total;
}
RecentSearch.prototype.getNrOfInfants = function (s) {
    var total = 0;
    
    for(var i = 0; i < s.c.length; i+=5) {
            if (s.c[i+3]) total++;
    }
    return total;
}
RecentSearch.prototype.getBirthDates = function (s, name, idx) {
    var result = '';
    var counter = 0;
    
    for(var i = 0; i < s.c.length; i+=5) {
            if (s.c[i+idx]) {
                result += '&' + name + '[' + counter + '].dateOfBirth=' + this.formatDateForDeepLink(this.bookingTool.childrensBox.years[s.c[i+2]] + '/' + parseInt(s.c[i+1] + 1, 10) + '/' + parseInt(s.c[i] + 1, 10), true);
                counter++;
            }
    }
    return result;
}
RecentSearch.prototype.addLeadingZero = function (num) {
    return (num > 9 ? num : '0' + num);
}
// --------------------------------------------------------------------------------------------
//
// Find destination component
//
// --------------------------------------------------------------------------------------------
function FindDestinationBox (bookingTool) {
	this.bookingTool = bookingTool;
	// init language dependent texts for find destination box
if ( YAHOO.util.Dom.get('ebt-fd-title') != null )
{
	this.titleText = YAHOO.util.Dom.get('ebt-fd-title').innerHTML;
	this.introText = YAHOO.util.Dom.get('ebt-fd-intro').innerHTML;
	this.buttonText = YAHOO.util.Dom.get('ebt-fd-buttontext').innerHTML;
	this.chooseCountryText = YAHOO.util.Dom.get('ebt-fd-choosecountry').innerHTML;
	this.chooseAirportText = YAHOO.util.Dom.get('ebt-fd-chooseairport').innerHTML;

	this.createFindDestinationBoxDOM();

	this.airportBox.disabled='disabled';
	
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
	YAHOO.util.Event.addListener(this.countryBox, 'change', this.changeCountry, this, true);
	YAHOO.util.Event.addListener(this.airportBox, 'change', this.changeAirport, this, true);

	// init click events to open popup
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-od-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-od-find-destination-link')], true);
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-io-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-io-find-destination-link')], true);
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-id-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-id-find-destination-link')], true);

	var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", "ebt-autosuggest-helptip")[0];
	YAHOO.util.Event.addListener(helptipLink, 'mousedown', this.findHelptipLink, this, true);


	var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", "ebt-autosuggest-helptip")[0];
	YAHOO.util.Event.addListener(helptipLink, 'mousedown', this.findHelptipLink, this, true);


	YAHOO.util.Event.addListener(this.fdCloseBut, 'click', this.close, this, true);
	YAHOO.util.Event.addListener(this.submitBut, 'click', this.saveAndClose, this, true);

}
}

FindDestinationBox.prototype.createFindDestinationBoxDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.fdPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-finddestination-box'}, '<h3>' + this.titleText + '</h3>');

	this.fdCloseBut = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, null, 'close-overlay');
	this.fdPopupElement.appendChild(this.fdCloseBut);

	var fdContent = new HTMLNode(targetDocument, 'div', {}, '', 'content');
	
	var mybr = new HTMLNode(targetDocument, 'br', {clear: 'all'});
	fdContent.appendChild(mybr);

	var fdInnerContent = new HTMLNode(targetDocument, 'div', {}, '<p>' + this.introText + '</p>', 'inner-content');
	
	var destForm = new HTMLNode(targetDocument, 'div', {id:'ebt-finddestination-form'}, null, 'form-container');
	var fieldset = new HTMLNode(targetDocument, 'fieldset', null, null);
		
	this.countryBox = new HTMLNode(targetDocument, 'select', null);
	var firstOption = new HTMLNode(targetDocument, 'option', {value:null}, this.chooseCountryText);
	this.countryBox.appendChild(firstOption);
	
	fieldset.appendChild(this.countryBox);  
	
	this.airportBox = new HTMLNode(targetDocument, 'select', null);
	var firstOption = new HTMLNode(targetDocument, 'option', {value:null}, this.chooseAirportText);
	this.airportBox.appendChild(firstOption);

	fieldset.appendChild(this.airportBox);  

	destForm.appendChild(fieldset);
	fdInnerContent.appendChild(destForm);
	fdContent.appendChild(fdInnerContent);
	this.fdPopupElement.appendChild(fdContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	this.submitBut = new HTMLNode(targetDocument, 'a', {id:'ebt-finddest-submit', href:'javascript:;'});
	var span = new HTMLNode(targetDocument, 'span', {},  this.buttonText, 'save-button');
	this.submitBut.appendChild(span);
	footer.appendChild(this.submitBut);

	this.fdPopupElement.appendChild(footer);
	targetDocument.body.appendChild(this.fdPopupElement);
}
FindDestinationBox.prototype.parseData = function (type, args, base) {
if ( base.countryBox != null )
{
	base.countryBox.style.display = 'none';
	var countries = new Array();
	var countriesandcities = new Array();
	for(i=0; i<airportToData.length; i++) {
		var country = airportToData[i][2];
		var city = airportToData[i][0];
		var airportname = airportToData[i][3];
		countriesandcities[i] = new Array(3);
		countriesandcities[i][0] = country;
		countriesandcities[i][1] = city;
		countriesandcities[i][2] = airportname;
		var doublecheck=false;
		for(j=0; j<countries.length; j++) {
			if(country == countries[j]){doublecheck=true;break;}
		}
		if(!doublecheck) {
			countries.push(country);
		}
	}
	countries.sort();
	for(i=0; i<countries.length; i++) {
		var newoption = document.createElement('option');
		newoption.innerHTML = countries[i];
		newoption.value = countries[i];
		base.countryBox.appendChild(newoption);
	}
}
}
FindDestinationBox.prototype.findHelptipLink = function(e, args) {
	var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", YAHOO.util.Dom.get("ebt-autosuggest-helptip"))[0];
	var el = YAHOO.util.Dom.get('ebt-od-find-destination-link');    
	if(helptipLink.id.search("-io-") > -1)
		el = YAHOO.util.Dom.get('ebt-io-find-destination-link') 
	else if(helptipLink.id.search("-id-") > -1) 
		el = YAHOO.util.Dom.get('ebt-id-find-destination-link');    
	 this.open(e, [this, el]);
}
FindDestinationBox.prototype.open = function (e, args) {
	var base = args[0];
	var link = args[1];
	base.countryBox.style.display = 'block';
	base.target = link.id;
	if (base.bookingTool.ebtPage.lightBox) base.bookingTool.ebtPage.lightBox.show();
	base.animateOpen();
}
FindDestinationBox.prototype.animateOpen = function () {
	this.fdPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.fdPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
FindDestinationBox.prototype.saveAndClose = function () {
	if (YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled')) return;
	this.returnFormElements();
	this.close();
}
FindDestinationBox.prototype.returnFormElements = function () {
	var inputField;
	var hiddenTypeField;
	var hiddenCodeField;
	if (this.target.search('-od-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-destination-place');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-outbound-destination-location-type'); 
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode');
	}
	if (this.target.search('-io-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-from-place-oj');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-inbound-origin-location-type');   
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode-from-oj');
	}
	if (this.target.search('-id-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-destination-place-oj');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-inbound-destination-location-type');  
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode-dest-oj');
	}
	var selectedIndex = this.airportBox.childNodes[this.airportBox.selectedIndex].className;
	var selectedAirport = airportToData[selectedIndex];
	var city = selectedAirport[0];
	var state = selectedAirport[1];
	var country = selectedAirport[2];
	var airport = selectedAirport[3];
	var code = selectedAirport[4];
	var citygroup = selectedAirport[5];
	var sMarkup = "";
	sMarkup += city + ' - ' + airport + ' (' + code + ')';
	// add state if available
	sMarkup += state ? ", " + state + ", " : ", "; 
	sMarkup += country; 
	inputField.value = sMarkup;
	inputField.style.color = '#023167';
	YAHOO.util.Dom.removeClass(inputField, 'error');
	if(YAHOO.util.Dom.get(inputField.id + '-error')) YAHOO.util.Dom.get(inputField.id + '-error').style.display = 'none';
	if (citygroup) {hiddenTypeField.value = 'city'} else {hiddenTypeField.value = 'airport';}
	hiddenCodeField.value = code;
}
FindDestinationBox.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.fdPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.fd = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.hide();
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
	this.countryBox.selectedIndex = 0;
	this.airportBox.selectedIndex = 0;
	this.airportBox.disabled = 'disabled';
}
FindDestinationBox.prototype.finishClose = function () {
	this.fd.fdPopupElement.style.display = 'none';
}
FindDestinationBox.prototype.changeCountry = function (type, args, base) { 
	var fdairportbox = this.airportBox;
	var fdcountrybox = this.countryBox;
	fdairportbox.selectedIndex = 0;
	if(fdcountrybox.selectedIndex < 1) {fdairportbox.disabled='disabled';}
	else {
		fdairportbox.disabled=false;
		while (this.airportBox.childNodes[1]) {
			this.airportBox.removeChild(this.airportBox.childNodes[1]);
		}

		for(i=0; i<airportToData.length; i++) {
			if(airportToData[i][2] == fdcountrybox.value) {
				var newoption = document.createElement('option');
				newoption.innerHTML = airportToData[i][0] + ' - ' + airportToData[i][3] + '(' + airportToData[i][4] + ')';
				newoption.className = i;
				this.airportBox.appendChild(newoption);
			}
		}

	}
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
}
FindDestinationBox.prototype.changeAirport = function (type, args, base) { 
	YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
}


// Content: js eBT7 elements
// --------------------------------------------------------------------------------------------
//
// Lightbox component
//
// --------------------------------------------------------------------------------------------
function Lightbox (ebtPage) {
	this.ebtPage = ebtPage;
	this.lbElement = parent.document.createElement('div');
	this.lbElement.className = 'lightbox';
	parent.document.body.appendChild(this.lbElement);
	if (this.ebtPage.browser == 'ie6' || this.ebtPage.browser == 'ie55') this.selects = document.getElementById(this.ebtPage.container.id).getElementsByTagName('select');
}
Lightbox.prototype.show = function () {
	if (this.ebtPage.browser == 'ie6' || this.ebtPage.browser == 'ie55') this.hideSelectBoxes();
	this.lbElement.style.display = 'block';
	var attributes = {
		opacity: { to: .8 }
	}
	anim = new YAHOO.util.Motion(this.lbElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
Lightbox.prototype.hide = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.lbElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.lb = this;
	anim.onComplete.subscribe(this.finishHide);
	anim.animate();
}
Lightbox.prototype.finishHide = function () {
	if (this.lb.ebtPage.browser == 'ie6' || this.lb.ebtPage.browser == 'ie55') this.lb.showSelectBoxes();
	this.lb.lbElement.style.display = 'none';
}
Lightbox.prototype.hideSelectBoxes = function () {
	for (var i = 0; i < this.selects.length; i++) {
		this.selects[i].style.visibility = 'hidden';
	}
}
Lightbox.prototype.showSelectBoxes = function () {
	for (var i = 0; i < this.selects.length; i++) {
		this.selects[i].style.visibility = 'visible';
	}
}
// --------------------------------------------------------------------------------------------
//
// ToolTip component
//
// --------------------------------------------------------------------------------------------
function ToolTip (container, link, deltaX, deltaY) {
	this.container = container.tagName ? container : YAHOO.util.Dom.get(container);
	this.link = link;
	this.deltaX = deltaX;
	this.deltaY = deltaY;
 	if (document.all) {
		this.iframe = document.createElement('iframe');
		this.iframe.className = 'tooltip-iframe';
		// src added to make sure there is no problem with secure/non-secure items
		this.iframe.src = 'javascript:false;';
		this.iframe.frameBorder = 0;
		this.container.appendChild(this.iframe);
	}
}
ToolTip.prototype.show = function () {
	if (!isNaN(this.deltaX) && !isNaN(this.deltaX)) {
		this.container.style.left = calculateLeft(this.link) + this.deltaX + "px";
		this.container.style.top = calculateTop(this.link) + this.deltaY + "px";
		this.container.style.bottom = "auto";
	}
	this.toShow = setTimeout(createContextFunction(this, "doShow"), 300);
}
ToolTip.prototype.showPos = function (e, args) {
	var ieFix = document.all ? 120 : 30; 
	var leftCorr =  YAHOO.util.Dom.hasClass(args[0].container, 'goleft') ? -300 : 0;
	args[0].container.style.left = (args[1].offsetLeft + ieFix + leftCorr) + "px";
	args[0].container.parentNode.style.zIndex = 200;
	args[0].toShow = setTimeout(createContextFunction(args[0], "doShow"), 300);
}
ToolTip.prototype.hide = function () {
	clearTimeout(this.toShow);
	this.toShow = -1;
	this.container.style.display = 'none';
}
ToolTip.prototype.doShow = function () {
	this.container.style.display = 'block';
	if (document.all) {
		this.iframe.style.width = (this.container.offsetWidth)+ 'px';
		this.iframe.style.height = (this.container.offsetHeight) + 'px';
	}
}
// --------------------------------------------------------------------------------------------
//
// HoverToolTip component
//
// --------------------------------------------------------------------------------------------
function HoverToolTip (container) {
	this.container = container.tagName ? container : YAHOO.util.Dom.get(container);
}
HoverToolTip.prototype.show = function (e, args) {
	args.followMouse(e, args);
	if (args.container) args.container.style.display = 'block';
}
HoverToolTip.prototype.hide = function (e, args) {
	args.priceset = false;
	if (args.container) args.container.style.display = 'none';
}
HoverToolTip.prototype.followMouse = function (e, args) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	YAHOO.util.Dom.setX(args.container, posx);
	YAHOO.util.Dom.setY(args.container, posy + 34);
}
// --------------------------------------------------------------------------------------------
//
// ClickToolTip component
//
// --------------------------------------------------------------------------------------------
function ClickToolTip (cont, myLink, deltaX, deltaY) {
	this.container = cont;
	this.deltaX = deltaX;
	this.deltaY = deltaY;
	YAHOO.util.Event.addListener(myLink, 'click', this.show, [this, myLink], true);
	YAHOO.util.Event.addListener(myLink, 'blur', this.hide, this, true);
}
ClickToolTip.prototype.show = function (e, args) {
	YAHOO.util.Event.preventDefault(e);
	var base = args[0];
	var myLink = args[1];
	base.container.style.left = ((YAHOO.util.Dom.getX(myLink) + base.deltaX) - YAHOO.util.Dom.getX(YAHOO.util.Dom.get('ebt-main-container'))) + "px";
	base.container.style.top = (YAHOO.util.Dom.getY(myLink) + base.deltaY) + "px";
	base.container.style.display = 'block';
}
ClickToolTip.prototype.hide = function (e) {
	this.container.style.display = 'none';
}
// --------------------------------------------------------------------------------------------
//
// HTMLNode component
//
// --------------------------------------------------------------------------------------------
function HTMLNode(target, type, attributes, innerHtml, className, hrefText) {
	var newNode = target.createElement(type);
	for (var prop in attributes) {
		newNode.setAttribute(prop, attributes[prop]);
	}
	if (type = 'a' && hrefText) newNode.href = hrefText;
	if (className) newNode.className = className;
	if (innerHtml) newNode.innerHTML = innerHtml;
	return newNode;
}
// --------------------------------------------------------------------------------------------
//
// PriceBreakdown component
//
// --------------------------------------------------------------------------------------------
function PriceBreakdown (hideText) {
	this.toggleLink = YAHOO.util.Dom.get('ebt-show-price-breakdown');
	this.hideText = hideText;
	if (this.toggleLink) this.showText = this.toggleLink.innerHTML;
	this.extendedData = YAHOO.util.Dom.get('ebt-price-breakdown');
	this.opened = false;
	YAHOO.util.Event.addListener(this.toggleLink, 'click', this.toggle, this, true);
	
	this.totalAdultPrice = YAHOO.util.Dom.get('ebt-total-adult-price');
	this.totalPriceTop = YAHOO.util.Dom.get('ebt-total-price-top');
	this.totalPriceBot = YAHOO.util.Dom.get('ebt-total-price-bot');
	this.adultPrice = YAHOO.util.Dom.get('ebt-adult-price');
	this.childPrice = YAHOO.util.Dom.get('ebt-child-price');
	this.infantPrice = YAHOO.util.Dom.get('ebt-infant-price');
	this.adultTax = YAHOO.util.Dom.get('ebt-adult-tax');
	this.childTax = YAHOO.util.Dom.get('ebt-child-tax');
	this.infantTax = YAHOO.util.Dom.get('ebt-infant-tax');
	this.adultFee = YAHOO.util.Dom.get('ebt-adult-fee');
	this.childFee = YAHOO.util.Dom.get('ebt-child-fee');
	this.infantFee = YAHOO.util.Dom.get('ebt-infant-fee');
	this.adultTotal = YAHOO.util.Dom.get('ebt-adult-total');
	this.childTotal = YAHOO.util.Dom.get('ebt-child-total');
	this.infantTotal = YAHOO.util.Dom.get('ebt-infant-total');
	this.departPrice = YAHOO.util.Dom.get('ebt-depart-price');
	this.returnPrice = YAHOO.util.Dom.get('ebt-return-price');
	if (YAHOO.util.Dom.get('ebt-best-price-pb-link')) {
		this.tooltipBestPrice = new ToolTip('ebt-best-price-box');
		this.tooltipBestPriceLink = YAHOO.util.Dom.get('ebt-best-price-pb-link');
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseover', this.tooltipBestPrice.show, this.tooltipBestPrice, true);
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseout', this.tooltipBestPrice.hide, this.tooltipBestPrice, true);
	}
}
PriceBreakdown.prototype.toggle = function (e) {
	YAHOO.util.Event.preventDefault(e);
	if (this.opened) {
		this.opened = false;
		this.toggleLink.innerHTML = this.showText;
		YAHOO.util.Dom.removeClass(this.toggleLink, 'hide-price-breakdown');
		this.extendedData.style.display = 'none';
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "price_details", "z_ebt_eventplace" : "customize", "z_ebt_event" : "1", "z_ebt_eventvalue" : "close"});
	} else {
		this.opened = true;
		this.toggleLink.innerHTML = this.hideText;
		YAHOO.util.Dom.addClass(this.toggleLink, 'hide-price-breakdown');
		this.extendedData.style.display = 'block';
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "price_details", "z_ebt_eventplace" : "customize", "z_ebt_event" : "1", "z_ebt_eventvalue" : "open"});
	}
}
PriceBreakdown.prototype.update = function (prices) {
	if (!prices || prices.length == 0) {
		prices = null;
	}
	if (this.adultPrice) this.adultPrice.innerHTML = prices ? prices[0] : '-';
	if (this.adultTax) this.adultTax.innerHTML = prices ? prices[1] : '-';
	if (this.adultFee) this.adultFee.innerHTML = prices ? prices[2] : '-';
	
	if (this.childPrice) this.childPrice.innerHTML = prices ? prices[3] : '-';
	if (this.childTax) this.childTax.innerHTML = prices ? prices[4] : '-';
	if (this.childFee) this.childFee.innerHTML = prices ? prices[5] : '-';

	if (this.infantPrice) this.infantPrice.innerHTML = prices ? prices[6] : '-';
	if (this.infantTax) this.infantTax.innerHTML = prices ? prices[7] : '-';
	if (this.infantFee) this.infantFee.innerHTML = prices ? prices[8] : '-';
	
	if (this.totalAdultPrice) this.totalAdultPrice.innerHTML = prices ? prices[9] : '-';
	if (this.adultTotal) this.adultTotal.innerHTML = prices ? prices[10] : '-';
	if (this.childTotal) this.childTotal.innerHTML = prices ? prices[11] : '-';
	if (this.infantTotal) this.infantTotal.innerHTML = prices ? prices[12] : '-';
	if (this.totalPriceTop) this.totalPriceTop.innerHTML = prices ? prices[13] : '-';
	if (this.totalPriceBot) this.totalPriceBot.innerHTML = prices ? prices[13] : '-';
	if (this.departPrice) this.departPrice.innerHTML = prices ? prices[14] : '-';
	if (this.returnPrice) this.returnPrice.innerHTML = prices ? prices[15] : '-';
}
// --------------------------------------------------------------------------------------------
//
// PriceBumbMessage component
//
// --------------------------------------------------------------------------------------------
function PriceBumbMessage(page) {
	this.ebtPage = page;
	this.pbText = YAHOO.util.Dom.get('ebt-pb-text').innerHTML;
	this.createPBMDOM();
}
PriceBumbMessage.prototype.createPBMDOM = function () {
	var targetDocument = this.ebtPage.targetDoc;
	this.pbPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-pricebumb-message'}, '<div id="ebt-pricebumb-top">&nbsp;</div><p>' + this.pbText + '</p>');
	targetDocument.body.appendChild(this.pbPopupElement);
}
PriceBumbMessage.prototype.show = function () {
	if (this.ebtPage.lightBox) this.ebtPage.lightBox.show();
	var dd = document.documentElement ? document.documentElement : document.body;
	this.pbPopupElement.style.top = (dd.scrollTop + 200) + 'px';
	this.pbPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.pbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
	this.timeOut = setTimeout(createContextFunction(this, "close"), 1100);
}
PriceBumbMessage.prototype.close = function () {
	clearTimeout(this.timeOut);
	this.timeOut = -1;
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.pbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.pb = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.ebtPage.lightBox) this.ebtPage.lightBox.hide();
}
PriceBumbMessage.prototype.finishClose = function () {
	this.pb.pbPopupElement.style.display = 'none';
}
// --------------------------------------------------------------------------------------------
//
// general functions
//
// --------------------------------------------------------------------------------------------
function createContextFunction(context, method, method2) {
	return (function(x){
		method = (method == "post") ? method2 : method;
		eval("context."+method+"(x)");
		return false;
	});
}
// compare function to compare Arrays
Array.prototype.compare = function(testArr) {
    if (this.length != testArr.length) return false;
    for (var i = 0; i < testArr.length; i++) {
        if (this[i].compare) { 
            if (!this[i].compare(testArr[i])) return false;
        }
        if (this[i] !== testArr[i]) return false;
    }
    return true;
}
/* get, set, and delete cookies */
function getCookie( name ) {
	var 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 ) );
}
	
function setEscapedCookie( name, value, expires, path, domain, secure ) {
	path = '/';
	var today = new Date();
	today.setTime( today.getTime() );
	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() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
	
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

// --------------------------------------------------------------------------------------------
//
// checkoutpage 4 -- confirmation
//
// --------------------------------------------------------------------------------------------
function showConditions () {
	var showConditionsLinks = YAHOO.util.Dom.getElementsByClassName('ebt-show-conditions', 'a', 'left-check-out');
	var showConditionsHTML = YAHOO.util.Dom.getElementsByClassName('cond-popup', 'div', 'left-check-out');
	for (var i = 0; i < showConditionsLinks.length; i++) {
		new ClickToolTip(showConditionsHTML[i], showConditionsLinks[i], 0, -85);
	}
}

// --------------------------------------------------------------------------------------------
//
// Open Jaw
//
// --------------------------------------------------------------------------------------------

function Openjaw (fs) {
	this.flightSearch = fs;
	this.docBody = document.getElementsByTagName('body');
	this.ojCheck = document.getElementById('ebt-open-jaw-opt');
	this.init();
}

Openjaw.prototype.init = function () {
	YAHOO.util.Event.addListener(this.ojCheck, 'click', this.toggleOpenJaw, [this, this.ojCheck], true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-departure-place'), 'blur', this.prefillFields, [this, this.ojCheck], true);
	
	if (this.ojCheck && this.ojCheck.checked) {
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		// prefill fields
		if (YAHOO.util.Dom.get('ebt-airportcode-from-oj').value) YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';
	}
}
Openjaw.prototype.toggleOpenJaw = function (e, args) {
	var base = args[0];
	var check = args[1];
	
	if(check && check.checked) {
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		// prefill fields
		YAHOO.util.Dom.get('ebt-from-place-oj').value = YAHOO.util.Dom.get('ebt-destination-place').value;
		YAHOO.util.Dom.get('ebt-airportcode-from-oj').value = YAHOO.util.Dom.get('ebt-airportcode').value;
		if (YAHOO.util.Dom.get('ebt-airportcode-from-oj').value) YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';

		YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].value;		
		YAHOO.util.Dom.get('ebt-destination-place-oj').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].text;
		YAHOO.util.Dom.get('ebt-destination-place-oj').style.color = '#023167';
	} else {
		YAHOO.util.Dom.removeClass(document.body, 'open-jaw');
	}
}
function calculateTop(object) {if (object) return object.offsetTop + calculateTop(object.offsetParent); else return 0;}
function calculateLeft(object) {if (object) return object.offsetLeft + calculateLeft(object.offsetParent); else return 0;}
function isChild(ancestor, candidate) {
	while (candidate && candidate != ancestor.parentNode) {
		if (candidate == ancestor) return true;
		candidate = candidate.parentNode;
	}
	return false;
}

// --------------------------------------------------------------------------------------------
//
// EBTCalendar component
//
// --------------------------------------------------------------------------------------------
function EBTCalendar (container, inputBox, dateFormat, defaultDate, minDate, maxDate, months, days, closeText) {
	if (!container) {
		this.container = new HTMLNode(document, 'div', null, '', 'ebt-calendar');
		document.body.appendChild(this.container);
	} else {
		this.container = container;
	}
	this.homepage = true;
	this.closeText = closeText ? closeText : 'close';
	this.closeBut = new HTMLNode(document, 'a', {href:'javascript:;'}, this.closeText, 'close-calendar');
	this.container.appendChild(this.closeBut);
	this.tableContainer = new HTMLNode(document, 'div', {id:'cal' + Math.random()});
	this.container.appendChild(this.tableContainer);
	this.cal = new YAHOO.widget.Calendar('myCal', this.tableContainer.id, {mindate:minDate, maxdate:maxDate});
	this.inputBox = inputBox;
	this.dateFormat = dateFormat;
	this.minDate = minDate;
	this.maxDate = maxDate;
	this.months = months;
	this.days = days;
	this.mover = false;
	this.configDateFormat();
	this.initEvents();
	this.defaultDate = defaultDate;
	if (defaultDate) this.cal.select(this.defaultDate);
}
EBTCalendar.prototype.configDateFormat = function () {
	this.cal.cfg.setProperty("WEEKDAYS_SHORT", this.days);
	this.cal.cfg.setProperty("MONTHS_LONG", this.months);
	var sDate = this.dateFormat.split('/');
	sDate[0] == 'mm' ? this.mPos = 1 : (sDate[1] == 'mm' ? this.mPos = 2 : this.mPos = 3);
	sDate[0] == 'dd' ? this.dPos = 1 : (sDate[1] == 'dd' ? this.dPos = 2 : this.dPos = 3);
	sDate[0].indexOf('yy') != -1 ? this.yPos = 1 : (sDate[1].indexOf('yy') != -1 ? this.yPos = 2 : this.yPos = 3);
	this.cal.cfg.setProperty("MDY_MONTH_POSITION", this.mPos);
	this.cal.cfg.setProperty("MDY_DAY_POSITION", this.dPos);
	this.cal.cfg.setProperty("MDY_YEAR_POSITION", this.yPos);
	this.cal.cfg.setProperty("START_WEEKDAY", 1);
	this.yearShort = sDate[this.yPos-1].length > 2 ? false : true;
}
EBTCalendar.prototype.initEvents = function () {
	YAHOO.util.Event.addListener(this.container, "mouseover", this.overCal, this, true); 
	YAHOO.util.Event.addListener(this.container, "mouseout", this.outCal, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "focus", this.show, [this, this.inputBox], true); 
	YAHOO.util.Event.addListener(this.closeBut, "click", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "keydown", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "blur", this.checkEnteredDate, this, true); 
	this.cal.selectEvent.subscribe(this.selectDate, this, true);
	this.cal.renderEvent.subscribe(this.updateCalNavigation, this, true);

	this.dateInputError = new YAHOO.util.CustomEvent("dateError", this);
	this.dateNoError = new YAHOO.util.CustomEvent("dateNoError", this);
}
EBTCalendar.prototype.overCal = function (e) {
	this.mover = true;
}
EBTCalendar.prototype.outCal = function (e) {
	try {if (isChild(this.container, YAHOO.util.Event.resolveTextNode(YAHOO.util.Event.getRelatedTarget(e)))) return} catch(e) {}
	this.mover = false;
}
EBTCalendar.prototype.show = function (e, args) {
	var base = args[0];
	var inputBox = args[1];
	
	if (inputBox.disabled) return;
	if (base.homepage) {
		if (inputBox.id.indexOf('depart') > -1) {
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "calendar_departure", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
		} else {
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "calendar_return", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
		}
	}
	if (inputBox) inputBox.select();
	if (base.cal.getSelectedDates().length > 0) {
		base.cal.cfg.setProperty("pagedate", (base.cal.getSelectedDates()[0].getMonth() + 1) + '/' + base.cal.getSelectedDates()[0].getFullYear());
	}
	base.cal.render();
	base.container.style.display = 'block';
	YAHOO.util.Dom.setXY(base.container, [calculateLeft(inputBox) - 3, calculateTop(inputBox) + 16]);
}
EBTCalendar.prototype.close = function (e) {
	this.mover = false;
	this.container.style.display = 'none';
}
EBTCalendar.prototype.selectDate = function (e, args) {
	var selectedRetDate = args[0][0];
	var selDay = selectedRetDate[2];
	var selMonth = selectedRetDate[1];
	var selYear = selectedRetDate[0];

	selectedDate = selDay + '/' + selMonth + '/' + selYear;
	this.close();
	this.inputBox.value = this.formatDate(selectedDate);
	YAHOO.util.Dom.removeClass(this.inputBox, 'error');
	this.dateNoError.fire(this.inputBox); 
}
EBTCalendar.prototype.formatDate = function (date) {
	var aDate = date.split('/');
	var aFormattedDate = new Array();
	
	aFormattedDate[this.dPos-1] = aDate[0];
	aFormattedDate[this.mPos-1] = aDate[1];
	aFormattedDate[this.yPos-1] = aDate[2];
	if (this.yearShort) aFormattedDate[this.yPos-1] = aFormattedDate[this.yPos-1].substr(2, 2); // show only last 2 characters of year
	var s = aFormattedDate[0] + '/' + aFormattedDate[1] + '/' + aFormattedDate[2];
	
	return s;
}
EBTCalendar.prototype.checkEnteredDate = function (e) {
	if (this.mover) return;
	this.close();
	var dateValues = this.inputBox.value.split('/');
	var day = parseInt(dateValues[this.dPos-1], 10);
	var month = parseInt(dateValues[this.mPos-1], 10);
	var year = parseInt(dateValues[this.yPos-1], 10);
	if (this.yearShort) year += 2000;
	var date = new Date(year, month-1, day);
	if ((date.getMonth() + 1) != month) {
		this.dateInputError.fire(this.inputBox); 
		YAHOO.util.Dom.addClass(this.inputBox, 'error');
		if (this.homepage) {
			if (this.inputBox.id.indexOf('depart') > -1) 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "departure_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "nonvalid"});
			else 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "return_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "nonvalid"});
		}
		return false;
	} else {
		this.dateNoError.fire(this.inputBox);
		YAHOO.util.Dom.removeClass(this.inputBox, 'error');
		this.cal.select(date);
		if (this.homepage) {
			if (this.inputBox.id.indexOf('depart') > -1) 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "departure_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "valid"});
			else 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "return_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "valid"});
		}
		return true;
	}
}
EBTCalendar.prototype.getSelectedDates = function () {
	return this.cal.getSelectedDates();
}
EBTCalendar.prototype.updateCalNavigation = function (e) {
	var mindate = new Date(this.cal.cfg.getProperty("minDate"));
	var maxdate = new Date(this.cal.cfg.getProperty("maxDate"));
	maxdate.setMonth(maxdate.getMonth() - 1);
	if (this.cal.cfg.getProperty("pagedate").getTime() <= mindate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavleft', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
	if (this.cal.cfg.getProperty("pagedate").getTime() > maxdate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavright', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
}
// Content: js EBT7 layover
// use for new ebt7 dashboard 
//if (this.canScriptDomain) this.lightBox = new LayOver(document.body, "lightbox", .4, .5);
function LayOver(container, className, animationSpeed, maxOpacity, useReplacementBoxes) {
	this.speed = animationSpeed;
	this.opacity = maxOpacity;
	// Get parentregion
	var parentRegion = YAHOO.util.Dom.getRegion(container);
	// make sure you fill out the whole page
	var height = YAHOO.util.Dom.getViewportHeight() > document.body.offsetHeight ? YAHOO.util.Dom.getViewportHeight() : document.body.offsetHeight;
	// Create the layover
	this.layOver = document.createElement("div");
	this.layOver.className = className;
	container.appendChild(this.layOver);

	// Settings for the layover
	// The layover is put in the parentobject of the application that uses the layover
	// Because else ie has problems with z-index
	this.layOver.style.height = height + "px";
	this.layOver.style.width = YAHOO.util.Dom.getViewportWidth() + "px";
	// Set negative margin to align the layover with the screen
	this.layOver.style.marginLeft = - parentRegion.left + "px";
	this.layOver.style.marginTop = - parentRegion.top + "px";
	
	if (is_ie6) {
		this.selectBoxes = document.getElementsByTagName("select");
		if (useReplacementBoxes) this.replacements = createReplacementSelectBoxes(this.selectBoxes);
//		alert(this.replacements.length)
	}
}
LayOver.prototype.hide = function() {
	var attributes = {
		opacity : { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.layOver, attributes, this.speed, YAHOO.util.Easing.easeOut);
	anim.lo = this;
	anim.onComplete.subscribe(this.finishHide);
	anim.animate();
}
LayOver.prototype.finishHide = function() {
	if (this.lo.selectBoxes) this.lo.showSelectBoxes();
	this.lo.layOver.style.display = "none";
}
LayOver.prototype.show = function() {
	if (this.selectBoxes) this.hideSelectBoxes();
	this.layOver.style.display = "block";
	var attributes = {
		opacity : { to: this.opacity }
	}
	anim = new YAHOO.util.Motion(this.layOver, attributes, this.speed, YAHOO.util.Easing.easeOut);
	anim.animate();
}
LayOver.prototype.hideSelectBoxes = function() {
	for (var i = 0; i < this.selectBoxes.length; i++) {
		this.selectBoxes[i].style.visibility = "hidden";
		if (this.replacements) this.replacements[i].style.visibility = "visible";
	}
}
LayOver.prototype.showSelectBoxes = function() {
	for (var i = 0; i < this.selectBoxes.length; i++) {
		this.selectBoxes[i].style.visibility = "visible";
		if (this.replacements) this.replacements[i].style.visibility = "hidden";
	}
}

function createReplacementSelectBoxes(selectBoxes) {
	var replacements = new Array();
	for (var i = 0; i < selectBoxes.length; i++) {
		var div = document.createElement("div");
		div.style.position = "absolute";
		div.style.visibility = "hidden";
		
		var input = document.createElement("input");
		input.type = "text";
//		input.value = selectBoxes[i].value;
		input.style.width = (selectBoxes[i].offsetWidth - 4) + "px";
		input.style.height = (selectBoxes[i].offsetHeight - 4) + "px";
		
		// Get the location of the selectbox on the screen
		var region = YAHOO.util.Dom.getRegion(selectBoxes[i]);
		div.style.left = (region.left - 2) + "px";
		div.style.top = (region.top - 3) + "px";
		div.appendChild(input);
		
		var img = document.createElement("img");
		img.src = "images/ie6-selectbox-arrow.gif";
		img.className = "replacement-image";
		img.style.position = "absolute";
		img.style.right = 1 + "px";
		img.style.top = 3 + "px";
		div.appendChild(img);
		
//		selectBoxes[i].parentNode.appendChild(div);
		document.body.appendChild(div);
		
		replacements[i] = div;
	}
	return replacements;
}
// Content: js eBT7 Page
if (top.location != document.location){
	document.domain = 'klm.com';
}
var _metron2;

// --------------------------------------------------------------------------------------------
//
// EBTPage component
//
// --------------------------------------------------------------------------------------------
function EBTPage (container) {
	try {
		_metron2 = new Metron();
	} catch (e) {}
	this.container = YAHOO.util.Dom.get(container);
	this.canScriptDomain = this.checkScriptingPoss();
	this.browser = this.getBrowser();
	this.addStylesheets();
	if (this.browser == 'safari') this.attachCSS('static/css/safari.css', document);
	if (this.canScriptDomain) this.lightBox = new Lightbox(this);
	//the following gives an error in ie6+ , have to ask Cor about this
	//if (this.canScriptDomain) this.lightBox = new LayOver(document.body, "lightbox", .4, .5);
	
}
EBTPage.prototype.addStylesheets = function () {
	var host = document.location.protocol+'//'+document.domain+(document.location.port ? ':'+document.location.port : '');
	var publication = 'fr_fr';
	var aCssURLs = [
		host+'/travel/'+publication+'/static/css/ebt-elements.css'
		];
		
	if ( is_ie6 )
	{
		aCssURLs[aCssURLs.length] = host+'/travel/'+publication+'/static/css/ebt-elements-ie6.css';
	}
	else if ( is_ie7 )
	{
		aCssURLs[aCssURLs.length] = host+'/travel/'+publication+'/static/css/ebt-elements-ie7.css';
	}
	else if ( is_ie8 )
	{
		aCssURLs[aCssURLs.length] = host+'/travel/'+publication+'/static/css/ebt-elements-ie8.css';
	}
	YAHOO.util.Get.css(aCssURLs);
}
EBTPage.prototype.checkScriptingPoss = function () {
	try {
		var o = parent.document.body.offsetHeight;
		this.targetDoc = parent.document;
		
		return true;
	} catch (e) {
		this.targetDoc = document;
		
		return false;
	}
}
EBTPage.prototype.getBrowser = function () {
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
		return 'opera';
	} else if (ua.indexOf('msie 7')!=-1) { // IE7
		return 'ie7';
	} else if (ua.indexOf('msie 6') !=-1) { // IE6
		return 'ie6';
	} else if (ua.indexOf('msie') !=-1) { // IE5.5
		return 'ie55';
	} else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
		return 'safari';
	} else if (ua.indexOf('gecko') != -1) { // Gecko
		return 'gecko';
	} else {
		return false;
	}
}
EBTPage.prototype.attachCSS = function (css, target) {
	if (target) {
		var headID = target.getElementsByTagName("head")[0];
		var cssNode = target.createElement('link');
	} else {
		var headID = this.targetDoc.getElementsByTagName("head")[0];
		var cssNode = this.targetDoc.createElement('link');
	}
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/travel/fr_fr/' + css;
	cssNode.media = 'screen, print';
	headID.appendChild(cssNode);
}
// Content: js overlay
function Overlay(container, properties){
  if(container){
    if(typeof(container) == 'object')
      this.container = container;
    else if(typeof(container) == 'string')
      this.container = YAHOO.util.Dom.get(container);
    else
      this.container = document.getElementsByTagName('body')[0];
  }else{
    this.container = document.getElementsByTagName('body')[0];
  }
  
  this.properties = properties;

  this.properties['id'] = (this.properties['id'] ? this.properties['id'] : 'overlay');
  this.properties['iframe-id'] = (this.properties['iframe-id'] ? this.properties['iframe-id'] : this.properties['id'] + '-iframe');
  this.properties['className'] = (this.properties['className'] ? this.properties['className'] : 'overlay');
  
  if(this.properties['animate']){
    this.properties['opacity'] = this.properties['opacity'] ? this.properties['opacity'] : .5
    this.properties['speed'] = this.properties['speed'] ? this.properties['speed'] : .5
  }
  
  this.children = new Array();
}

Overlay.prototype.addOnClickHandler = function(child, sOnClickFunction){
  if(sOnClickFunction == null || sOnClickFunction == "")
    sOnClickFunction = "close";
  this.children.push({"child" : child, "func" : sOnClickFunction});
}

Overlay.prototype.show = function(){
  var self = this;
  var overlayExists = true;
  var overlayIFrameExists = true;
  var overlay = YAHOO.util.Dom.get(this.properties['id']);
  if(!overlay){
    overlay = document.createElement('div');
    overlay.id = this.properties['id'];
    overlayExists = false;
  }else{
      this.overlayAlreadyThere = true;
  }
  
  if(this.children.length > 0){
    overlay.onclick = function(){
      for(i = 0; i < self.children.length; i++){
        var child = self.children[i].child;
        var sFunction = self.children[i].func;
        eval("child." + sFunction + "();");
      }
    }
  }
  
  YAHOO.util.Dom.addClass(this.container, 'overlay-container');

  if(this.properties['className'] != null)
    overlay.className = this.properties['className'];

  if(document.all){ //IE6
    var iframe = YAHOO.util.Dom.get(this.properties['iframe-id']);
    if(!iframe){
      iframe = document.createElement('iframe');
      iframe.id = this.properties['iframe-id'];
      overlayIFrameExists = false;
    }else{
        this.iframeAlreadyThere = true;
    }
    iframe.frameBorder = 0;
    iframe.scrolling = 'no';
    iframe.src = "/travel/fr_fr/static/empty.html";
    iframe.style.height = YAHOO.util.Dom.getDocumentHeight() + "px";
    if(!overlayIFrameExists)
      this.container.appendChild(iframe);
    iframe = null;
    overlay.style.height = YAHOO.util.Dom.getDocumentHeight() + "px";
  }

  if(!overlayExists)
    this.container.appendChild(overlay);

  overlay.style.display = 'block';

  var attributes = {
    opacity : { to: this.properties['opacity'] }
  }

  if(this.properties['animate']){
    anim = new YAHOO.util.Motion(overlay, attributes, this.properties['speed'], YAHOO.util.Easing.easeOut);
    //anim.onComplete.subscribe(this.onShowComplete);
    anim.animate();
  }

  overlay = null;
}

Overlay.prototype.onShowComplete = function(){

}

Overlay.prototype.hide = function(){
  var overlay = YAHOO.util.Dom.get(this.properties['id']);
  if(this.properties['animate']){
    var attributes = {
      opacity : { to: 0 }
    }
    anim = new YAHOO.util.Motion(overlay, attributes, this.properties['speed'], YAHOO.util.Easing.easeOut);
    anim.controller = this;
    anim.onComplete.subscribe(this.onHideComplete);
    anim.animate();
  }else{
    YAHOO.util.Dom.removeClass(this.container, 'overlay-container');
    this.container.removeChild(overlay);
    var iframe = YAHOO.util.Dom.get(this.properties['iframe-id']);
    if(iframe)
      this.container.removeChild(iframe);
  }
  
}

Overlay.prototype.onHideComplete = function(){
  var overlay = YAHOO.util.Dom.get(this.controller.properties['id']);
  var iframe = YAHOO.util.Dom.get(this.controller.properties['iframe-id']);

  if(!this.controller.overlayAlreadyThere)
    this.controller.container.removeChild(overlay);

  if(iframe && !this.controller.iframeAlreadyThere)
    this.controller.container.removeChild(iframe);

  YAHOO.util.Dom.removeClass(this.controller.container, 'overlay-container');
}
// Content: js selfassist
var SelfAssist = function(country, lang){
  //General
  var self = this;
  this.base_url = "/commercial/selfassist/faq-web";
  this.loading_url = 'loading.htm';
  this.popup = 0;
  
  //Language Settings
  this.country = 'nl';
  this.language = 'en';
  
  /*if(country == null && lang == null && YAHOO.util.Cookie.get("countryLanguage") != null){
    var sLanguageSetting = YAHOO.util.Cookie.get("countryLanguage");
    this.country = sLanguageSetting.split('_')[0];
    this.lang = sLanguageSetting.split('_')[1];
  }else{*/
    if(country != null){
      this.country = country;
    }
    if(lang != null){
      this.language = lang;
    }
  //}

  if(YAHOO.util.Cookie && YAHOO.util.Cookie.get("popup") != null){
    this.popup = YAHOO.util.Cookie.get("popup");
  }else if(this.getCookie("popup") != null){
    this.popup = this.getCookie("popup");
  }
  //Self Assist controls
  //Container
  this.container = YAHOO.util.Dom.get("sa-container");
  this.container.style.display = 'block';

  var parentContainer = this.container.parentNode;
  this.layOver = new Overlay(parentContainer, {speed: .9, opacity: .8, animate: true, id:'sa-overlay'});
  this.layOver.addOnClickHandler(this);
  
  //Form
  this.defaultInput = YAHOO.util.Dom.get("mySearch");
  this.defaultButton = YAHOO.util.Dom.get("supportZoekLink");

  this.addForm(this.defaultInput, this.defaultButton);

  //Tabs
  this.searchTab = YAHOO.util.Dom.get("zoektab");
  this.catTab = YAHOO.util.Dom.get("tabcat");
  YAHOO.util.Event.addListener(this.catTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.catTab)
  this.faqTab = YAHOO.util.Dom.get("tabfaq");
  YAHOO.util.Event.addListener(this.faqTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.faqTab)
  this.closeTab = YAHOO.util.Dom.get("tabclose");
  YAHOO.util.Event.addListener(this.closeTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.closeTab)
	
  //Iframe
  this.iframe = YAHOO.util.Dom.get("sa-iframe");
  this.iframe.style.visibility = "hidden";
  YAHOO.util.Event.addListener(this.iframe, 'load', this.resetTabs, this);
  
  //Default SearchTerm
  this.searchTerm = "";
  this.defaultSearchTerm = this.defaultInput.value;

  //Load QueryString Listener
  if (location.host.match("klm.com")) {
      this.loadFromQueryString(window.location.search.substring(1));
  }
}

/** getQSVar
* Get a variable value from the querystring
* @param varname
**/
SelfAssist.prototype.getQSVar = function(varname) {
  hu = window.location.search.substring(1);
  gy = hu.split("&");
  returnValue = null;
  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == varname) {
      returnValue = ft[1];
    }
  }
  return returnValue;
}


SelfAssist.prototype.getCookie = function(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 null;
}

/** loadFromQueryString
* Checks for variables used in the querystring that loads the SelfAssist Popup
* @param queryString
**/
SelfAssist.prototype.loadFromQueryString = function(queryString){
  if(this.getQSVar("sa_url") != null)  //By URL
    this.loadUri(Url.decode(this.getQSVar("sa_url")));
  else if(this.getQSVar('q') != null) //By Question
    this.ask(this.getQSVar('q'));
  else if(this.getQSVar('q_cat') != null) //By Category
    this.cat(this.getQSVar('q_cat'));
  else if(this.getQSVar('q_faq') != null){ //By FAQ Category (If category is '1', general top 10 will be opened)
    if(this.getQSVar('q_faq') != 1){
      this.faq(this.getQSVar('q_faq'));
    }else{
      this.faq();
    }
  }
}

/** addForm
* Add a form to listen to. When the button is clicked SelfAssist will handle the click event.
* @param oInput
* @param oButton
**/
SelfAssist.prototype.addForm = function(oInput, oButton){
  oInput.title = oInput.value;
  YAHOO.util.Event.purgeElement(oInput, true);
  YAHOO.util.Event.purgeElement(oButton, true);
  YAHOO.util.Event.addListener(oButton, "click", this.onSubmitHandler, oInput, true);
  YAHOO.util.Event.addListener(oInput, "keyup", this.onSubmitHandler, oInput, true);
  YAHOO.util.Event.addListener(oInput, "focus", this.inputFocus, oInput, true);
  YAHOO.util.Event.addListener(oInput, "blur", this.inputBlur, oInput, true);
}

/** ask
* Loads a searchresult for selfassist.
* @param query
**/
SelfAssist.prototype.ask = function(query){
  if(query != this.defaultSearchTerm){
    this.searchTerm = query;
  }
  if(query != this.defaultSearchTerm && query != ''){
    this.loadUri('ask.htm', '&query=' + query);
  }else
    this.loadUri('start.htm');
  this.defaultInput.value = '';
  this.defaultButton.focus();
  this.inputBlur(null, this.defaultInput);
}

/** cat
* Loads a categoryoverview by default. 
* When a category id is supplied the top 10 for that category is loaded.
* @param category_id (optional)
**/
SelfAssist.prototype.cat = function(){
  if (arguments.length > 0){
    this.loadUri('categoryQuestions.htm', '&cid=' + arguments[0]);
  }else{
    this.loadUri('categories.htm');
  }
}

/** faq
* Loads a faq10 for general category by default. 
* When a category id is supplied the top 10 for that category is loaded.
* @param category_id (optional)
**/
SelfAssist.prototype.faq = function(){
  if (arguments.length > 0){
    this.loadUri('categoryQuestions.htm', '&cid=' + arguments[0]);
  }else{
    this.loadUri('topx.htm');
  }
}

/** loadUri
* Loads an url into the iframe.
* @param url
**/
SelfAssist.prototype.loadUri = function(url){
  var params = '';
  var uri = "";
  if(url.indexOf('?') < 0){
    params = '?locale=' + this.country + '_' + this.language + '&popup=' + this.popup;
    if(arguments.length > 1){
      params = params + arguments[1];
    }
  }

  //Only relative urls are allowed.
  if (url.indexOf(':') >= 0 && url.indexOf(':') <= 10) {
    var idx = url.lastIndexOf('/');
    url = idx < 15 ? '404.htm' : url.substr(idx + 1);
  }

  uri = this.base_url + '/' + url + params;

  //if layover is hidden, open it.
  if(this.container.className != "open"){
    this.layOver.show();
    this.open(uri);
  }else{
    this.iframe.src = uri;
  }

}

/** resetTabs
* Selects the current tab and deselects the others.
* @param oTab
**/
SelfAssist.prototype.resetTabs = function(e, obj){
  var oActiveTab = null;
  var uri = obj.iframe.contentWindow.document.location.href;
  if(uri.match("categories.htm") || uri.match("allCategoryQuestions.htm") || uri.match("categoryQuestions.htm")){
    oActiveTab = obj.catTab;
  } else if(uri.match("topx.htm")){
    oActiveTab = obj.faqTab;
  }else{
    oActiveTab = obj.searchTab;
  }
  //reset css classes
  YAHOO.util.Dom.removeClass(obj.searchTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.catTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.faqTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.closeTab.id, 'actief');

  YAHOO.util.Dom.addClass(oActiveTab, 'actief');
}

/** finishOpen 
* Callback function for open event. Shows the iframe.
**/
SelfAssist.prototype.finishOpen = function(type, args, uri) {
  this.sa.iframe.src = uri;
  this.sa.iframe.style.visibility = "visible";

}

/** finishClose
* Callback function for close event. Hides the iframe.
**/
SelfAssist.prototype.finishClose = function() {
  this.sa.container.className = "closed";
  this.sa.inputBlur();
}

/** open 
* Opens the layover in an animation.
**/
SelfAssist.prototype.open = function(uri) {
    var attributes = {
      width: { to: 907 }, 
      height: { to: 460 }
    }
    anim = new YAHOO.util.Anim(this.container, attributes, .9, YAHOO.util.Easing.easeOut);
    anim.sa = this;
    anim.onComplete.subscribe(function(){window.sa.iframe.src = uri; window.sa.iframe.style.visibility = "visible";});
    if(document.all){
      setTimeout("anim.animate();", 10);
    }else{
      anim.animate();
    }
    this.container.className = "open";
}

/*EVENTHANDLERS*/


/** close
* Closes the layover in an animation.
**/
SelfAssist.prototype.close = function(e, args) {
  //Measure variables
  var oMetron = new Metron();
  if(this.iframe._metron){
    // oMetron.measureVariable('ti', this.iframe._metron.webtrends.WT['ti']);
    oMetron.measureVariable('z_qgo_language', this.iframe._metron.webtrends.WT['z_go_language']);
  }else{
    // oMetron.measureVariable('ti', document.title);
    oMetron.measureVariable('z_qgo_language', 'en');
  }
  oMetron.measureVariable('ti', 'Close Window - Clicked');
  oMetron.measureVariable('z_application', 'Q-Go');
  oMetron.measureVariable('z_country', this.country);
  oMetron.measureVariable('z_language', this.language);
  oMetron.measureVariable('z_qgo_eventplace', 'Close Window - Clicked');
  oMetron.measureVariable('z_qgo_eventtype', 'Close Button');
  oMetron.measureVariable('z_qgo_event', 'Clicked');

  oMetron.measuresCommit();
  oMetron = null;
  this.defaultInput.value = this.defaultInput.title;
  YAHOO.util.Dom.removeClass(document.getElementsByTagName('body')[0], 'show-layover')
  //Load url into iFrame
  this.loadUri(this.loading_url);
  this.layOver.hide();
  this.iframe.style.visibility = "hidden";
  var attributes = {
    width: { to: 268 },
    height: { to: 45 }
  }
  anim = new YAHOO.util.Motion(this.container, attributes, .9, YAHOO.util.Easing.easeOut);
  anim.sa = this;
  anim.onComplete.subscribe(this.finishClose);
  anim.animate();
}

/** onSubmitHandler 
* Handles the submitentries of the Selfassist forms.
**/
SelfAssist.prototype.onSubmitHandler = function(e, obj){
  YAHOO.util.Event.preventDefault(e);
  if((e.type == 'keyup' && e.keyCode == 13) || (e.type == 'click')){
    window.sa.defaultSearchTerm = obj.title;
    window.sa.ask(obj.value);
  }
}

/** onTabClickHandler
* Handles tab clicks.
**/
SelfAssist.prototype.onTabClickHandler = function(e, obj){
  switch(obj.id){
    case window.sa.searchTab.id:
      window.sa.ask(window.sa.defaultInput.value);
      break;
    case window.sa.catTab.id:
      window.sa.cat();
      break;
    case window.sa.faqTab.id:
      window.sa.faq();
      break;
    case window.sa.closeTab.id:
      window.sa.close();
      break;
    default:
      break;
  }
}

/** inputFocus
* When a form input element is focussed, this function will be called.
* Sets style and value for the input field.
**/
SelfAssist.prototype.inputFocus = function(e , oInput) {
  if (oInput.title == "" || oInput.title == oInput.value) {
    oInput.title = oInput.value;
    oInput.value = "";
  }
  oInput.style.color = "#003145";
}

/** inputBlur
* When a form input element is blurred, this function will be called.
* Resets style and value for the input field.
**/
SelfAssist.prototype.inputBlur = function(e, oInput) {
  if (oInput.value == "" || oInput.title == oInput.value) {
    oInput.value = oInput.title;
    oInput.style.color = "";
  }
}


/*URL UTF-8 Encoder/Decoder Class*/

var Url = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

};
// Content: js ancillary dashboard
// Content: js ancillary dashboard
// --------------------------------------------------------------------------------------------
//
// Set dates in correct format
//
// --------------------------------------------------------------------------------------------
function selectDate (addDays, dateFormat) {

	var now = new Date();
	var start = new Date(now.getTime() + addDays * 3600 * 24 * 1000);
	var year = start.getFullYear();
	var month = start.getMonth()+1;
	var day = start.getDate();
	if (dateFormat == 1) {
		return day + "/" + month + "/" +  year;
	}else{
		return month + "/" + day + "/" +  year;
	}
}


// --------------------------------------------------------------------------------------------
//
// AncillarySearch component
//
// --------------------------------------------------------------------------------------------
function AncillarySearch () {

	this.browser = this.getBrowser();
	this.addStylesheets();

	this.submitForm = 'hotels-searchform';
	
	//Get the check-in and check-out dates set correctly
	//
	this.ancInDateHotel	 = selectDate(0,1);
	this.ancInDateCar 	 = selectDate(0,1);
	this.ancInDateCarPark  = selectDate(0,1);
	this.ancInDateTransport  = selectDate(0,1);

	//
	this.ancOutDateHotel	  = selectDate(7,1)
	this.ancOutDateCar 	  = selectDate(14,1);
	this.ancOutDateCarPark 	  = selectDate(7,1);
	this.ancOutDateTransport 	  = selectDate(7,1);
	
	//set min date (current day) and max date (current day +2 years)
	//
	this.maxDate = selectDate(800,0);
	this.minDate = selectDate(0,0);
	this.dateFormat	= "dd/mm/yyyy"
	this.days = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
	this.months =['January', 'February', 'March', 'April', 'May',  'June', 'July', 'August', 'September', 'October', 'November', 'December'];
	this.monthsShort= ['Jan', 'Fév', 'Mar', 'Avr', 'May', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'];

	//creating the autocompleters for destinations in hotel/car
	this.autoCompleteHotelDestination = new AutoCompl('/travel/fr_fr/static/xml/ancillary/hotels_fr.xml', 'myInputHotel', 'myContainerHotel', 'Hotel');
	this.autoCompleteCarDestination   = new AutoCompl('/travel/fr_fr/static/xml/ancillary/cars_fr.xml', 'myInputCar', 'myContainerCar', 'Car');
	this.autoCompleteCarParkDestination= new AutoCompl('/travel/fr_fr/static/xml/ancillary/parking_fr.xml', 'myInputCarPark', 'myContainerCarPark', 'CarPark');
	this.autoCompleteTransportDestination = new AutoCompl('/travel/fr_fr/static/xml/ancillary/transportation_fr.xml', 'myInputTransport', 'myContainerTransport', 'Transport');


	//setting the form to display
	YAHOO.util.Dom.get('hotel').checked = 'checked';

	this.ancHotel = YAHOO.util.Dom.get('hotel');
	this.ancHotelDestLabel = YAHOO.util.Dom.get('myInputHotel').value ;
	YAHOO.util.Event.addListener(this.ancHotel, 'click', this.showAncillary,'hotels-searchform', this, true);

	this.ancCar = YAHOO.util.Dom.get('car');
	this.ancCarDestLabel = YAHOO.util.Dom.get('myInputCar').value ;
	YAHOO.util.Event.addListener(this.ancCar, 'click', this.showAncillary,'cars-searchform', this, true);

	this.ancCarParking = YAHOO.util.Dom.get('carpark');
	this.ancCarParkDestLabel = YAHOO.util.Dom.get('myInputCarPark').value ; 
	YAHOO.util.Event.addListener(this.ancCarParking, 'click', this.showAncillary,'parking-searchform', this, true);
	
	this.ancTransport = YAHOO.util.Dom.get('transport');
	this.ancTransportDestLabel = YAHOO.util.Dom.get('myInputTransport').value ; 
	YAHOO.util.Event.addListener(this.ancTransport, 'click', this.showAncillary,'transport-searchform', this, true);

	
	//setting the submit button
	this.submitButton = YAHOO.util.Dom.get('anc-search-submit');
	YAHOO.util.Event.addListener(this.submitButton, 'click', this.doSubmitData, this, true);	

	//setting the date fields
	this.AncillaryDaterHotel 	= new AncillaryDater('hotel', this.dateFormat, this.ancInDateHotel, this.ancOutDateHotel, this.minDate, this.maxDate, this.months, this.days);
	this.AncillaryDaterCar		= new AncillaryDater('car', this.dateFormat, this.ancInDateCar, this.ancOutDateCar, this.minDate, this.maxDate, this.months, this.days);
	this.AncillaryDaterCarPark          = new AncillaryDater('carpark', this.dateFormat, this.ancInDateCarPark, this.ancOutDateCarPark, this.minDate, this.maxDate, this.months, this.days);
	this.AncillaryDaterTransport        = new AncillaryDater('transport', this.dateFormat, this.ancInDateTransport, this.ancOutDateTransport, this.minDate, this.maxDate, this.months, this.days);


}

AncillarySearch.prototype.addStylesheets = function () {
	var host = document.location.protocol+'//'+document.domain+(document.location.port ? ':'+document.location.port : '');
	var publication = 'fr_fr';
	var aCssURLs = [
		host+'/travel/'+publication+'/static/css/ancillary.css'
		];
		
	if ( is_ie6 )
	{
		aCssURLs[aCssURLs.length] = host+'/travel/'+publication+'/static/css/ancillary_ie6.css';
	}
	else if ( is_ie7 )
	{
		aCssURLs[aCssURLs.length] = host+'/travel/'+publication+'/static/css/ancillary_ie7.css';
	}
	YAHOO.util.Get.css(aCssURLs);
}

AncillarySearch.prototype.getBrowser = function () {
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
		return 'opera';
	} else if (ua.indexOf('msie 7')!=-1) { // IE7
		return 'ie7';
	} else if (ua.indexOf('msie 6') !=-1) { // IE6
		return 'ie6';
	} else if (ua.indexOf('msie') !=-1) { // IE5.5
		return 'ie55';
	} else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
		return 'safari';
	} else if (ua.indexOf('gecko') != -1) { // Gecko
		return 'gecko';
	} else {
		return false;
	}
}

AncillarySearch.prototype.doSubmitData = function (e) {

	switch(this.submitForm ){
	  case "hotels-searchform":
		document.forms[this.submitForm].For.value = "City," + document.forms[this.submitForm].elements["anc-destination-place"].value;
		indateArray = document.forms[this.submitForm].elements["hotel-check-in-date"].value.split("/");
		outdateArray = document.forms[this.submitForm].elements["hotel-check-out-date"].value.split("/");
		document.forms[this.submitForm].DateRange.value = indateArray[2] + "-" + indateArray[1] + "-" + indateArray[0]+","+outdateArray[2] + "-" + outdateArray[1] + "-" + outdateArray[0];
		break;
	  case "cars-searchform":
		document.forms[this.submitForm].PickUpLocation.value = "AirportCity," + document.forms[this.submitForm].elements["anc-destination-place"].value;
		indateArray = document.forms[this.submitForm].elements["car-check-in-date"].value.split("/");
		outdateArray = document.forms[this.submitForm].elements["car-check-out-date"].value.split("/");
		document.forms[this.submitForm].DateTimeRange.value = indateArray[2] + "-" + indateArray[1] + "-" + indateArray[0]+"T" +document.getElementById("anc-check-in-time").value + ","+outdateArray[2] + "-" + outdateArray[1] + "-" + outdateArray[0] + "T"+ document.getElementById("anc-check-out-time").value;
		break;
	case "parking-searchform":
		document.forms[this.submitForm].For.value = "City," + document.forms[this.submitForm].elements["anc-destination-place"].value;
		indateArray = document.forms[this.submitForm].elements["carpark-check-in-date"].value.split("/");
		outdateArray = document.forms[this.submitForm].elements["carpark-check-out-date"].value.split("/");
		document.forms[this.submitForm].DateRange.value = indateArray[2] + "-" + indateArray[1] + "-" + indateArray[0]+","+outdateArray[2] + "-" + outdateArray[1] + "-" + outdateArray[0];
		break;
	case "transport-searchform":
		document.forms[this.submitForm].For.value = "City," + document.forms[this.submitForm].elements["anc-destination-place"].value;
		indateArray = document.forms[this.submitForm].elements["transport-check-in-date"].value.split("/");
		outdateArray = document.forms[this.submitForm].elements["transport-check-out-date"].value.split("/");
		document.forms[this.submitForm].DateRange.value = indateArray[2] + "-" + indateArray[1] + "-" + indateArray[0]+","+outdateArray[2] + "-" + outdateArray[1] + "-" + outdateArray[0];
		break;



	  default:;
	
	}

	document.forms[this.submitForm].submit();
}


AncillarySearch.prototype.hideAncillaries = function () {
	YAHOO.util.Dom.get('hotels-searchform').style.display= 'none';
	YAHOO.util.Dom.get('cars-searchform').style.display = 'none';
	YAHOO.util.Dom.get('parking-searchform').style.display = 'none';
	YAHOO.util.Dom.get('transport-searchform').style.display = 'none';
}

AncillarySearch.prototype.showAncillary = function (e, parm) {
	//hide all the ancillary forms
	this.hideAncillaries();
	//display the selected ancillary form
	YAHOO.util.Dom.get(parm).style.display = '';
		
	if (parm == "cars-searchform"){
		YAHOO.util.Dom.get('anc-logo').style.display = '';
		YAHOO.util.Dom.get('tt-header').style.backgroundPosition = '0 -60px' ;
   		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('car-check-in-date'), 'error'); 
   		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('car-check-out-date'), 'error');       		
   		YAHOO.util.Dom.get('car-check-in-date').value   = this.ancInDateCar;
   		YAHOO.util.Dom.get('car-check-out-date').value = this.ancOutDateCar;
   		YAHOO.util.Dom.get('myInputCar').value = this.ancCarDestLabel.valueOf();
   		this.submitForm = 'cars-searchform';
	}else{
		YAHOO.util.Dom.get('anc-logo').style.display = 'none';	
		switch (parm) 
		{ 
			case "hotels-searchform" : 
		      		YAHOO.util.Dom.get('tt-header').style.backgroundPosition = '0 0px' ;
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('hotel-check-in-date'), 'error'); 
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('hotel-check-out-date'), 'error');       		
		      		YAHOO.util.Dom.get('hotel-check-in-date').value  = this.ancInDateHotel;
		      		YAHOO.util.Dom.get('hotel-check-out-date').value = this.ancOutDateHotel;
		      		YAHOO.util.Dom.get('myInputHotel').value = this.ancHotelDestLabel.valueOf();
		      		this.submitForm = 'hotels-searchform';
		      		break;

			case "parking-searchform" : 
				
				YAHOO.util.Dom.get('tt-header').style.backgroundPosition = '0 0px' ;
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('carpark-check-in-date'), 'error'); 
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('carpark-check-out-date'), 'error');       		
		      		YAHOO.util.Dom.get('carpark-check-in-date').value  = this.ancInDateCarPark;
		      		YAHOO.util.Dom.get('carpark-check-out-date').value = this.ancOutDateCarPark;
		      		YAHOO.util.Dom.get('myInputCarPark').value = this.ancCarParkDestLabel.valueOf();
		      		this.submitForm = 'parking-searchform';
		      		break;		      		
			
			case "transport-searchform" : 
				
				YAHOO.util.Dom.get('tt-header').style.backgroundPosition = '0 0px' ;
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('transport-check-in-date'), 'error'); 
		      		YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('transport-check-out-date'), 'error');       		
		      		YAHOO.util.Dom.get('transport-check-in-date').value  = this.ancInDateTransport;
		      		YAHOO.util.Dom.get('transport-check-out-date').value = this.ancOutDateTransport;
		      		YAHOO.util.Dom.get('myInputTransport').value = this.ancTransportDestLabel.valueOf();
		      		this.submitForm = 'transport-searchform';
		      		break;
		  }

	}
}
 
// --------------------------------------------------------------------------------------------
//
// AncillaryDater component
//
// --------------------------------------------------------------------------------------------
function AncillaryDater (ancillary, dateFormat, depDate, retDate, minDate, maxDate, months, days) {

	//
	// GENERAL
	// init departuredate
	var depIdIcon = ancillary+'-check-in-date-icon';
	var depIdDate = ancillary+'-check-in-date';
	this.depDateIcon = YAHOO.util.Dom.get(depIdIcon);
	this.depCalendar = new GeneralCalendar (null, YAHOO.util.Dom.get(depIdDate), dateFormat, depDate, minDate, maxDate, months, days);
	YAHOO.util.Event.addListener(this.depDateIcon, "click", this.depCalendar.show, [this.depCalendar, YAHOO.util.Dom.get(depIdDate)], true); 
	
	// init returndate
	var retIdIcon = ancillary+'-check-out-date-icon';
	var retIdDate = ancillary+'-check-out-date';
	this.retDateIcon = YAHOO.util.Dom.get(retIdIcon);
	this.retCalendar = new GeneralCalendar (null, YAHOO.util.Dom.get(retIdDate), dateFormat, retDate, minDate, maxDate, months, days);
	YAHOO.util.Event.addListener(this.retDateIcon, "click", this.retCalendar.show, [this.retCalendar, YAHOO.util.Dom.get(retIdDate)], true); 
	this.depCalendar.cal.selectEvent.subscribe(this.selectdepDate, this, true);
	this.depDateChange = new YAHOO.util.CustomEvent("dateChange", this);

}

AncillaryDater.prototype.selectdepDate = function (e) {
	// update Return calendar
	var selectedDepDate = this.depCalendar.getSelectedDates()[0];
	this.retCalendar.cal.cfg.setProperty("mindate", selectedDepDate); 
	if ((selectedDepDate > this.retCalendar.getSelectedDates()[0])) {
		this.retCalendar.cal.select(selectedDepDate);
	}
	this.depDateChange.fire(selectedDepDate);
}


// --------------------------------------------------------------------------------------------
//
// AutoComplete component
//
// --------------------------------------------------------------------------------------------

//var airportToData = new Array();
var destinationDataHotel = new Array();
var destinationDataCar = new Array();
var destinationDataCarPark = new Array();
var destinationDataTransport = new Array();


function AutoCompl (xmlFile, inputField, containerField, destinationField) {
	this.AncilaryType = destinationField;
	this.inputFld = YAHOO.util.Dom.get(inputField);
	YAHOO.util.Event.addListener(this.inputFld, "focus", function () {if (YAHOO.util.Dom.hasClass(this, 'entered')) {this.select()} else {this.value = ''}}); 
	YAHOO.util.Event.addListener(this.inputFld, "keydown", function () {this.style.color = '#023167'; YAHOO.util.Dom.addClass(this, 'entered')});
	YAHOO.util.Event.addListener(this.inputFld, "keyup", this.updateHiddenField, this, true);
	this.getAirportData(xmlFile);
	switch (this.AncilaryType) 
	{ 
		case "Hotel" : 
			this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatchesHotel)
			break; 
		case "Car" : 
			this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatchesCar)
			break; 
		case "CarPark" : 
			this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatchesCarPark)
			break; 
		case "Transport" : 
			this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatchesTransport)
			break; 
		default:			   
	}
	this.myAutoComplete = new YAHOO.widget.AutoComplete(inputField, containerField, this.ACDS);
	this.myAutoComplete.queryDelay = 0; 
	this.myAutoComplete.maxResultsDisplayed = 100;
	this.myAutoComplete.doBeforeExpandContainer = function () {
		var is_ie6 = (is_ie && is_major == 6);
		var is_ie7 = (is_ie && is_major == 7);
		if (is_ie6 || is_ie7) {
				switch (destinationField) 
			{ 
	   			case "Hotel" :
					document.getElementById('anc-return-label').style.visibility = "hidden";
					document.getElementById('hotel-check-out-date').style.visibility = "hidden";
					document.getElementById('hotel-check-out-date-icon').style.visibility = "hidden";
					break;
	   			case "Car" : 
					document.getElementById('anc-car-return-label').style.visibility = "hidden";
					document.getElementById('car-check-out-date').style.visibility = "hidden";
					document.getElementById('car-check-out-date-icon').style.visibility = "hidden";	
					break;
				case "CarPark" : 
					document.getElementById('anc-car-park-return-label').style.visibility = "hidden";
					document.getElementById('carpark-check-out-date').style.visibility = "hidden";
					document.getElementById('carpark-check-out-date-icon').style.visibility = "hidden";	
					break;
				case "Transport" : 
					document.getElementById('anc-transport-return-label').style.visibility = "hidden";
					document.getElementById('transport-check-out-date').style.visibility = "hidden";
					document.getElementById('transport-check-out-date-icon').style.visibility = "hidden";	
					break;

	   			default:
	   		}
		}
		else {};
		return true;
	};
	 
	this.myAutoComplete.containerCollapseEvent.subscribe(test_collapsEvent);


}

AutoCompl.prototype.getAirportData = function (xmlFile) {
	var callback = { 
		success: this.parseAirportData, 
		failure: this.handleFailure,
		scope: this
	};
	this.airportXMLData = YAHOO.util.Connect.asyncRequest('GET', xmlFile, callback, null);
}
AutoCompl.prototype.parseAirportData = function (o) {
	var airports = o.responseXML.getElementsByTagName('destination');
	var airportRecord;

	for (var i = 0; i < airports.length; i++) {
		airportRecord = new Array();
		airportRecord[0] = airports[i].childNodes[0].nodeValue; //general name

		switch (this.AncilaryType) 
		{ 
		   case "Hotel" : 
			destinationDataHotel[i] = airportRecord;
			break; 
		   case "Car" : 
	   		destinationDataCar[i] = airportRecord;
			break; 
		  case "CarPark" : 
	   		destinationDataCarPark[i] = airportRecord;
			break; 
		  case "Transport" : 
		   	destinationDataTransport[i] = airportRecord;
			break; 
 		   default:
		}
	}


	switch (this.AncilaryType) 
	{ 
		case "Hotel" : 
			destinationDataHotel.sort(initialSortFuncAnc);
			break; 
	  	case "Car" : 
		   	destinationDataCar.sort(initialSortFuncAnc);
		   	break;
		case "CarPark" : 
		   	destinationDataCarPark.sort(initialSortFuncAnc);
		   	break;
		case "Transport" : 
		   	destinationDataTransport.sort(initialSortFuncAnc);
		   	break;

		default:			   
	}

}
AutoCompl.prototype.handleFailure = function () {
}
AutoCompl.prototype.getToMatchesHotel = function (sQuery) {
	sQuery = unescape(sQuery);
	var aResults = [];
	if (sQuery.length < 3) return aResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	// var priority = [0,5, 4, 1, 2, 3, 6];
	// only check the general name, the city, the airport name, the airportcode and the group name
	var priority = [0,5, 4, 1, 6];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");

	for (var i = 0; i < destinationDataHotel.length; i++) {
		for (var j = 0; j < destinationDataHotel[i].length; j++) {
			if (regExp.test(destinationDataHotel[i][priority[j]])) {
				aResults.push(destinationDataHotel[i]);
				aResults[aResults.length - 1][8] = j;
				break;
			}
		}
	};

	aResults.sort(acSortFuncAnc);
	return (sortSecLevelAlphabeticAnc(aResults));
}

AutoCompl.prototype.getToMatchesCar = function (sQuery) {
	sQuery = unescape(sQuery);
	var bResults = [];
	if (sQuery.length < 3) return bResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	// var priority = [0,5, 4, 1, 2, 3, 6];
	// only check the general name, the city, the airport name, the airportcode and the group name
	var priority = [0,5, 4, 1, 6];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");

	for (var i = 0; i < destinationDataCar.length; i++) {
		for (var j = 0; j < destinationDataCar[i].length; j++) {
			if (regExp.test(destinationDataCar[i][priority[j]])) {
				bResults.push(destinationDataCar[i]);
				bResults[bResults.length - 1][8] = j;
				break;
			}
		}
	};

	bResults.sort(acSortFuncAnc);
	return (sortSecLevelAlphabeticAnc(bResults));
}

AutoCompl.prototype.getToMatchesTransport = function (sQuery) {
	sQuery = unescape(sQuery);
	var bResults = [];
	if (sQuery.length < 3) return bResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	// var priority = [0,5, 4, 1, 2, 3, 6];
	// only check the general name, the city, the airport name, the airportcode and the group name
	var priority = [0,5, 4, 1, 6];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");

	for (var i = 0; i < destinationDataTransport.length; i++) {
		for (var j = 0; j < destinationDataTransport[i].length; j++) {
			if (regExp.test(destinationDataTransport[i][priority[j]])) {
				bResults.push(destinationDataTransport[i]);
				bResults[bResults.length - 1][8] = j;
				break;
			}
		}
	};

	bResults.sort(acSortFuncAnc);
	return (sortSecLevelAlphabeticAnc(bResults));
}

AutoCompl.prototype.getToMatchesCarPark = function (sQuery) {
	sQuery = unescape(sQuery);
	var bResults = [];
	if (sQuery.length < 3) return bResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	// var priority = [0,5, 4, 1, 2, 3, 6];
	// only check the general name, the city, the airport name, the airportcode and the group name
	var priority = [0,5, 4, 1, 6];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");

	for (var i = 0; i < destinationDataCarPark.length; i++) {
		for (var j = 0; j < destinationDataCarPark[i].length; j++) {
			if (regExp.test(destinationDataCarPark[i][priority[j]])) {
				bResults.push(destinationDataCarPark[i]);
				bResults[bResults.length - 1][8] = j;
				break;
			}
		}
	};

	bResults.sort(acSortFuncAnc);
	return (sortSecLevelAlphabeticAnc(bResults));
}

AutoCompl.prototype.BasicRemote = function() {	
	  
};


function test_collapsEvent () {
	var is_ie6 = (is_ie && is_major == 6);
	var is_ie7 = (is_ie && is_major == 7);
	if (is_ie6 || is_ie7) {
		if (document.getElementById('hotel').checked) { 
			document.getElementById('anc-return-label').style.visibility = "visible";
			document.getElementById('hotel-check-out-date').style.visibility = "visible";
			document.getElementById('hotel-check-out-date-icon').style.visibility = "visible";		
		}
		if (document.getElementById('car').checked) { 
			document.getElementById('anc-car-return-label').style.visibility = "visible";
			document.getElementById('car-check-out-date').style.visibility = "visible";
			document.getElementById('car-check-out-date-icon').style.visibility = "visible";
		}
		if (document.getElementById('carpark').checked) { 
			document.getElementById('anc-car-park-return-label').style.visibility = "visible";
			document.getElementById('carpark-check-out-date').style.visibility = "visible";
			document.getElementById('carpark-check-out-date-icon').style.visibility = "visible";
		}
		if (document.getElementById('transport').checked) { 
			document.getElementById('anc-transport-return-label').style.visibility = "visible";
			document.getElementById('transport-check-out-date').style.visibility = "visible";
			document.getElementById('transport-check-out-date-icon').style.visibility = "visible";
		}
	}
}

function sortSecLevelAlphabeticAnc (results) {
	var arSorted = new Array();
	var arSub = new Array();
	if (results[0])	var group = results[0][8];

	for (var i = 0; i < results.length; i++) {
		if (results[i][8] == group) {
			arSub[arSub.length] = results[i]
		} else {
			arSub.sort(initialSortFuncAnc);
			arSorted = arSorted.concat(arSub);
			arSub = new Array();
			arSub[arSub.length] = results[i]
			group = results[i][8];
		}
	}
	arSub.sort(initialSortFuncAnc);
	arSorted = arSorted.concat(arSub);
	
	return arSorted;
}
function acSortFuncAnc (a, b) {
	if (parseInt(a[8], 10) >= parseInt(b[8], 10)) return 1;
	if (parseInt(a[8], 10) < parseInt(b[8], 10)) return -1;
	return 0;
}
function initialSortFuncAnc (a, b) {
	if (a[0] >= b[0]) return 1;
	return -1;
}	
// Content: js ancillary dashboard elements
// --------------------------------------------------------------------------------------------
//
// HTMLNode component
//
// --------------------------------------------------------------------------------------------
function HTMLNode(target, type, attributes, innerHtml, className, hrefText) {
	var newNode = target.createElement(type);
	for (var prop in attributes) {
		newNode.setAttribute(prop, attributes[prop]);
	}
	if (type = 'a' && hrefText) newNode.href = hrefText;
	if (className) newNode.className = className;
	if (innerHtml) newNode.innerHTML = innerHtml;
	return newNode;
}

// --------------------------------------------------------------------------------------------
//
// calculate offset
//
// --------------------------------------------------------------------------------------------

function calculateTop(object) {if (object) return object.offsetTop + calculateTop(object.offsetParent); else return 0;}
function calculateLeft(object) {if (object) return object.offsetLeft + calculateLeft(object.offsetParent); else return 0;}

// --------------------------------------------------------------------------------------------
//
// Ancillary Calendar component
//
// --------------------------------------------------------------------------------------------
function GeneralCalendar (container, inputBox, dateFormat, defaultDate, minDate, maxDate, months, days) {
	if (!container) {
		this.container = new HTMLNode(document, 'div', null, '', 'anc-calendar');
		document.body.appendChild(this.container);
	} else {
		this.container = container;
	}
	this.closeBut = new HTMLNode(document, 'a', {href:'javascript:;'}, 'close', 'close-calendar');
	this.container.appendChild(this.closeBut);
	this.tableContainer = new HTMLNode(document, 'div', {id:'cal' + Math.random()});
	this.container.appendChild(this.tableContainer);
	this.cal = new YAHOO.widget.Calendar('myCal', this.tableContainer.id, {mindate:minDate, maxdate:maxDate});
	this.inputBox = inputBox;
	this.dateFormat = dateFormat;
	this.minDate = minDate;
	this.maxDate = maxDate;
	this.months = months;
	this.days = days;
	this.mover = false;
	this.configDateFormat();
	this.initEvents();
	if (defaultDate) this.cal.select(defaultDate);
}
GeneralCalendar.prototype.configDateFormat = function () {
	this.cal.cfg.setProperty("WEEKDAYS_SHORT", this.days);
	this.cal.cfg.setProperty("MONTHS_LONG", this.months);
	var sDate = this.dateFormat.split('/');
	sDate[0] == 'mm' ? this.mPos = 1 : (sDate[1] == 'mm' ? this.mPos = 2 : this.mPos = 3);
	sDate[0] == 'dd' ? this.dPos = 1 : (sDate[1] == 'dd' ? this.dPos = 2 : this.dPos = 3);
	sDate[0].indexOf('yy') != -1 ? this.yPos = 1 : (sDate[1].indexOf('yy') != -1 ? this.yPos = 2 : this.yPos = 3);
	this.cal.cfg.setProperty("MDY_MONTH_POSITION", this.mPos);
	this.cal.cfg.setProperty("MDY_DAY_POSITION", this.dPos);
	this.cal.cfg.setProperty("MDY_YEAR_POSITION", this.yPos);
	this.cal.cfg.setProperty("START_WEEKDAY", 1);
	this.yearShort = sDate[this.yPos-1].length > 2 ? false : true;
}
GeneralCalendar.prototype.initEvents = function () {
	YAHOO.util.Event.addListener(this.container, "mouseover", this.overCal, this, true); 
	YAHOO.util.Event.addListener(this.container, "mouseout", this.outCal, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "focus", this.show, [this, this.inputBox], true); 
	YAHOO.util.Event.addListener(this.closeBut, "click", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "keydown", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "blur", this.checkEnteredDate, this, true); 
	this.cal.selectEvent.subscribe(this.selectDate, this, true);
	this.cal.renderEvent.subscribe(this.updateCalNavigation, this, true);

	this.dateInputError = new YAHOO.util.CustomEvent("dateError", this);
	this.dateNoError = new YAHOO.util.CustomEvent("dateNoError", this);
}
GeneralCalendar.prototype.overCal = function (e) {
	this.mover = true;
}
GeneralCalendar.prototype.outCal = function (e) {
	try {if (isChild(this.container, YAHOO.util.Event.resolveTextNode(YAHOO.util.Event.getRelatedTarget(e)))) return} catch(e) {}
	this.mover = false;
}
GeneralCalendar.prototype.show = function (e, args) {
	var base = args[0];
	var inputBox = args[1];
	
	if (inputBox.disabled) return;
	if (inputBox) inputBox.select();
	if (base.cal.getSelectedDates().length > 0) {
		base.cal.cfg.setProperty("pagedate", (base.cal.getSelectedDates()[0].getMonth() + 1) + '/' + base.cal.getSelectedDates()[0].getFullYear());
	}
	base.cal.render();
	base.container.style.display = 'block';
	YAHOO.util.Dom.setXY(base.container, [calculateLeft(inputBox) - 3, calculateTop(inputBox) + 16]);
}
GeneralCalendar.prototype.close = function (e) {
	this.mover = false;
	this.container.style.display = 'none';
}
GeneralCalendar.prototype.selectDate = function (e, args) {
	var selectedRetDate = args[0][0];
	var selDay = selectedRetDate[2];
	var selMonth = selectedRetDate[1];
	var selYear = selectedRetDate[0];

	selectedDate = selDay + '/' + selMonth + '/' + selYear;
	this.close();
	this.inputBox.value = this.formatDate(selectedDate);
	YAHOO.util.Dom.removeClass(this.inputBox, 'error');
	this.dateNoError.fire(this.inputBox); 
}
GeneralCalendar.prototype.formatDate = function (date) {
	var aDate = date.split('/');
	var aFormattedDate = new Array();
	
	aFormattedDate[this.dPos-1] = aDate[0];
	aFormattedDate[this.mPos-1] = aDate[1];
	aFormattedDate[this.yPos-1] = aDate[2];
	if (this.yearShort) aFormattedDate[this.yPos-1] = aFormattedDate[this.yPos-1].substr(2, 2); // show only last 2 characters of year
	var s = aFormattedDate[0] + '/' + aFormattedDate[1] + '/' + aFormattedDate[2];
	
	return s;
}
GeneralCalendar.prototype.checkEnteredDate = function (e) {
	if (this.mover) return;
	this.close();
	var dateValues = this.inputBox.value.split('/');
	var day = parseInt(dateValues[this.dPos-1], 10);
	var month = parseInt(dateValues[this.mPos-1], 10);
	var year = parseInt(dateValues[this.yPos-1], 10);
	if (this.yearShort) year += 2000;
	var date = new Date(year, month-1, day);
	if ((date.getMonth() + 1) != month) {
		this.dateInputError.fire(this.inputBox); 
		YAHOO.util.Dom.addClass(this.inputBox, 'error');
		return false;
	} else {
		this.dateNoError.fire(this.inputBox);
		YAHOO.util.Dom.removeClass(this.inputBox, 'error');
		this.cal.select(date);
		return true;
	}
}
GeneralCalendar.prototype.getSelectedDates = function () {
	return this.cal.getSelectedDates();
}
GeneralCalendar.prototype.updateCalNavigation = function (e) {
	var mindate = new Date(this.cal.cfg.getProperty("minDate"));
	var maxdate = new Date(this.cal.cfg.getProperty("maxDate"));
	maxdate.setMonth(maxdate.getMonth() - 1);
	if (this.cal.cfg.getProperty("pagedate").getTime() <= mindate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavleft', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
	if (this.cal.cfg.getProperty("pagedate").getTime() > maxdate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavright', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
}