/*
Author: Andrew Newnham
Creation Date: 09/03/09
Last Update:
*/

/* Creating a 3d array to hold all language data */
function fieldDef(title,residence,location,checkin,nights,rooms,adults,children,infants,select){
	this.title=title;
	this.residence=residence;
	this.location=location
	this.checkin=checkin;
	this.nights=nights;
	this.rooms=rooms;
	this.adults=adults;
	this.children=children;
	this.infants=infants;
	this.select=select;
}

var langList=new Array();

//English
langList[0]=new fieldDef('Book a Hotel','Country of Residence','location','Check-in','Nights','Rooms','Adults','Children','Infants','select');


//Creating a 3D array to hold the destination list and any translations.
function destDef (auh,amd,aly,alg,amm,ams,ath,atl,bah,dps,bkk,pek,bey,txl,bio,bos,bru,cai,cpt,cmn,ceb,clt,maa,cnx,ord,cmb,ork,dfw,dam,dmm,dar,del,den,dac,doh,dxb,dub,edi,fra,fuk,gva,gla,can,han,sgn,hkg,iah,hyd,isb,ist,cgk,jed,jnb,khi,ktm,krt,cok,ccj,kul,kwi,lhe,lon,lax,lxr,mad,agp,mle,man,mnl,mhd,mel,msp,mxp,yul,dme,bom,muc,mct,nag,nbo,nyc,kix,osl,pmi,cdg,pen,pew,phl,pnh,hkt,ruh,fco,slc,sfo,sah,cts,icn,sez,pvg,sin,arn,syd,ika,trv,hnd,yto,tip,tun,vie,iad,zrh){
	this.auh=auh;
	this.amd=amd;
	this.aly=aly;
	this.alg=alg;
	this.amm=amm;
	this.ams=ams;
	this.ath=ath;
	this.atl=atl;
	this.bah=bah;
	this.dps=dps;
	this.bkk=bkk;
	this.pek=pek;
	this.bey=bey;
	this.txl=txl;
	this.bio=bio;
	this.bos=bos;
	this.bru=bru;
	this.cai=cai;
	this.cpt=cpt;
	this.cmn=cmn;
	this.ceb=ceb;
	this.clt=clt;
	this.maa=maa;
	this.cnx=cnx;
	this.ord=ord;
	this.cmb=cmb;
	this.ork=ork;
	this.dfw=dfw;
	this.dam=dam;
	this.dmm=dmm;
	this.dar=dar;
	this.del=del;
	this.den=den
	this.dac=dac;
	this.doh=doh;
	this.dxb=dxb;
	this.dub=dub;
	this.edi=edi;
	this.fra=fra;
	this.fuk=fuk;
	this.gva=gva;
	this.gla=gla;
	this.can=can;
	this.han=han;
	this.sgn=sgn;
	this.hkg=hkg;
	this.iah=iah;
	this.hyd=hyd;
	this.isb=isb;
	this.ist=ist;
	this.cgk=cgk;
	this.jed=jed;
	this.jnb=jnb;
	this.khi=khi;
	this.ktm=ktm;
	this.krt=krt;
	this.cok=cok;
	this.ccj=ccj;
	this.kul=kul;
	this.kwi=kwi;
	this.lhe=lhe;
	this.lon=lon;
	this.lax=lax;
	this.lxr=lxr;
	this.mad=mad;
	this.agp=agp;
	this.mle=mle;
	this.man=man;
	this.mnl=mnl;
	this.mhd=mhd;
	this.mel=mel;
	this.msp=msp;
	this.mxp=mxp;
	this.yul=yul;
	this.dme=dme;
	this.bom=bom;
	this.muc=muc;
	this.mct=mct;
	this.nag=nag;
	this.nbo=nbo;
	this.nyc=nyc;
	this.kix=kix;
	this.osl=osl;
	this.pmi=pmi;
	this.cdg=cdg;
	this.pen=pen;
	this.pew=pew;
	this.phl=phl;
	this.pnh=pnh;
	this.hkt=hkt;
	this.ruh=ruh;
	this.fco=fco;
	this.slc=slc;
	this.sfo=sfo;
	this.sah=sah;
	this.cts=cts;
	this.icn=icn;
	this.sez=sez;
	this.pvg=pvg;
	this.sin=sin;
	this.arn=arn;
	this.syd=syd;
	this.ika=ika;
	this.trv=trv;
	this.hnd=hnd;
	this.yto=yto;
	this.tip=tip;
	this.tun=tun;
	this.vie=vie;
	this.iad=iad;
	this.zrh=zrh;
}

var destList=new Array();
var encodingType=new Array();
//English
destList[0]=new destDef('Abu Dhabi','Ahmedabad','Alexandria','Algiers','Amman','Amsterdam','Athens','Atlanta','Bahrain','Bali','Bangkok','Beijing','Beirut','Berlin','Bilbao','Boston','Brussels','Cairo','Cape Town','Casablanca','Cebu','Charlotte','Chennai','Chiang Mai','Chicago','Colombo','Cork','Dallas','Damascus','Dammam','Dar Es Salaam','Delhi','Denver','Dacca','Doha','Dubai','Dublin','Edinburgh','Frankfurt','Fukuoka','Geneva','Glasgow','Guangzhou','Hanoi','Ho Chi Minh','Hong Kong','Houston','Hyderabad','Islamabad','Istanbul','Jakarta','Jeddah','Johannesburg','Karachi','Kathmandu','Khartoum','Kochi','Kozhikode','Kuala Lumpur','Kuwait','Lahore','London','Los Angeles','Luxor','Madrid','Malaga','Maldives','Manchester','Manila','Mashad','Melbourne','Minneapolis','Milan','Montreal','Moscow','Mumbai','Munich','Muscat','Nagpur','Nairobi','New York','Osaka','Oslo','Palmo Mallorca','Paris','Penang','Peshawar','Philadelphia','Phnom Penh','Phuket','Riyadh','Rome','Salt Lake City','San Francisco','Sanaa','Sapparro','Seoul','Seychelles','Shanghai','Singapore','Stockholm','Sydney','Tehran','Trivandrum','Tokyo','Toronto','Tripoli','Tunis','Vienna','Washington','Zurich');

//3d Arrary for RezGateway City info
function cityDef(countryName,countryCode,cityName,cityCode,iata){
 this.countryName=countryName;
 this.countryCode=countryCode;
 this.cityName=cityName;
 this.cityCode=cityCode;
 this.iata=iata;
}

var cityList=new Array();

//English
cityList[0]=new cityDef('Algeria','143','Algiers','11234','ALG');
cityList[1]=new cityDef('Austria','154','Vienna','1639','VIE');
cityList[2]=new cityDef('Bahrain','157','Bahrain','10760','BAH');										
cityList[3]=new cityDef('Bangladesh','158','Dhaka','2244','DAC');										
cityList[4]=new cityDef('Belgium','161','Brussels','266','BRU');										
cityList[5]=new cityDef('China','184','Beijing','2294','PEK');										
cityList[6]=new cityDef('China','184','Guangzhou','10285','CAN');										
cityList[7]=new cityDef('China','184','Shanghai','2279','PVG');										
cityList[8]=new cityDef('Denmark','198','Copenhagen','393','CPH');										
cityList[9]=new cityDef('Egypt','204','Alexandria','36','ALY');										
cityList[10]=new cityDef('Egypt','204','Cairo','286','CAI');
cityList[11]=new cityDef('Egypt','204','Luxor','935','LXR');										
cityList[12]=new cityDef('Finland','213','Helsinki','660','HEL');										
cityList[13]=new cityDef('France','214','Paris','1210','CDG');										
cityList[14]=new cityDef('Germany','221','Berlin','180','TXL');										
cityList[15]=new cityDef('Germany','221','Frankfurt','549','FRA');										
cityList[16]=new cityDef('Germany','221','Munich','1081','MUC');										
cityList[17]=new cityDef('Greece','224','Athens','97','ATH');										
cityList[18]=new cityDef('Hong Kong','78','Hong Kong','2315','HKG');										
cityList[19]=new cityDef('India','81','Ahmedabad','11503','AMD');										
cityList[20]=new cityDef('India','81','Chennai','4015','MAA');										
cityList[21]=new cityDef('India','81','Cochin','11510','COK ');										
cityList[22]=new cityDef('India','81','Delhi','2329','DEL');										
cityList[23]=new cityDef('India','81','Hyderabad','11518','HYD');										
cityList[24]=new cityDef('India','81','Kozhikode','11528','CCJ');										
cityList[25]=new cityDef('India','81','Mumbai','2327','BOM');										
cityList[26]=new cityDef('India','81','Nagpur','11536','NAG');										
cityList[27]=new cityDef('India','81','Trivandrum','13207','TRV');										
cityList[28]=new cityDef('Indonesia','82','Denpasar','2863','DPS');										
cityList[29]=new cityDef('Indonesia','82','Jakarta','2318','CGK');										
cityList[30]=new cityDef('Iran','83','Tehran','11570','IKA');										
cityList[31]=new cityDef('Italy','87','Milan','1031','MXP');										
cityList[32]=new cityDef('Italy','87','Rome','1331','FCO');										
cityList[33]=new cityDef('Japan','89','Fukuoka','2337','FUK');										
cityList[34]=new cityDef('Japan','89','Sapporo','2345','CTS');									
cityList[35]=new cityDef('Japan','89','Tokyo','2536','HND');										
cityList[36]=new cityDef('Jordan','90','Amman','54','AMM');										
cityList[37]=new cityDef('Kenya','92','Nairobi','4169','NBO');										
cityList[38]=new cityDef('Lebanon','100','Beirut','10321','BEY');										
cityList[39]=new cityDef('Libya','103','Tripoli','11746','TIP');										
cityList[40]=new cityDef('Malaysia','111','Kuala Lumpur','10161','KUL');										
cityList[41]=new cityDef('Malaysia','111','Penang','10168','PEN');										
cityList[42]=new cityDef('Maldives','112','Male','2381','MLE');										
cityList[43]=new cityDef('Morocco','126','Casablanca','317','CMN');										
cityList[44]=new cityDef('Nepal','131','Kathmandu','2382','KTM');										
cityList[45]=new cityDef('Oman','231','Muscat','10425','MCT');										
cityList[46]=new cityDef('Pakistan','232','Islamabad','12289','ISB');										
cityList[47]=new cityDef('Pakistan','232','Karachi','2397','KHI');										
cityList[48]=new cityDef('Pakistan','232','Lahore','12293','LHE');										
cityList[49]=new cityDef('Pakistan','232','Peshawar','12304','PEW');										
cityList[50]=new cityDef('Philippines','1','Cebu','2533','CEB');										
cityList[51]=new cityDef('Philippines','1','Manila','2393','MNL');										
cityList[52]=new cityDef('Qatar','6','Doha','10355','DOH');										
cityList[53]=new cityDef('Russia','9','Moscow','1070','DME');										
cityList[54]=new cityDef('Saudi Arabia','19','Jeddah','6699','JED');										
cityList[55]=new cityDef('Saudi Arabia','19','Riyadh','6695','RUH');										
cityList[56]=new cityDef('Seychelles','21','Mahe Island','12451','SEZ');										
cityList[57]=new cityDef('Singapore','23','Singapore','2399','SIN');										
cityList[58]=new cityDef('South Africa','28','Cape Town','305','CPT');										
cityList[59]=new cityDef('South Africa','28','Johannesburg','733','JNB');										
cityList[60]=new cityDef('South Korea','239','Seoul','2354','ICN');										
cityList[61]=new cityDef('Spain','29','Barcelona','143','BCN');										
cityList[62]=new cityDef('Spain','29','Madrid','950','MAD');										
cityList[63]=new cityDef('Sri Lanka','30','Colombo','382','CMB');										
cityList[64]=new cityDef('Sudan','31','Khartoum','12454','KRT');										
cityList[65]=new cityDef('Sweden','35','Stockholm','1766','ARN');										
cityList[66]=new cityDef('Switzerland','36','Zurich','1712','ZRH');										
cityList[67]=new cityDef('Syria','37','Damascus','5037','DAM');										
cityList[68]=new cityDef('Taiwan','38','Taipei','2414','TPE');										
cityList[69]=new cityDef('Tanzania','40','Dar Es Salaam','12539','DAR');										
cityList[70]=new cityDef('Thailand','41','Bangkok','138','BKK');										
cityList[71]=new cityDef('Thailand','41','Chiang Mai','355','CNX');										
cityList[72]=new cityDef('Thailand','41','Phuket','1233','HKT');										
cityList[73]=new cityDef('Turkey','47','Istanbul','1772','IST');										
cityList[74]=new cityDef('United Arab Emirates','53','Abu Dhabi','12','AUH');										
cityList[75]=new cityDef('United Arab Emirates','53','Dubai','466','DXB');										
cityList[76]=new cityDef('United Kingdom','54','London','906','LON');										
cityList[77]=new cityDef('United Kingdom','54','Manchester','970','MAN');										
cityList[78]=new cityDef('USA','55','Houston','684','IAH');										
cityList[79]=new cityDef('USA','55','New York City','1117','JFK');										
cityList[80]=new cityDef('USA','55','Washington D.C.','1660','IAD');										
cityList[81]=new cityDef('Vietnam','62','Ho Chi Minh City','13115','SGN');										
cityList[82]=new cityDef('Yemen','66','Sanaa','13167','SAH');										

//Dynamic date generation
var today=new Date();
var day=today.getDate();
var month=today.getMonth();
var monthName=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var year=today.getFullYear();
var dayNum=daysInMonth(month,year);
var initialDepDay=day+5;
if(initialDepDay>dayNum)initialDepDay-=dayNum;
var initialRetDay=initialDepDay+2;
if(initialRetDay>dayNum)initialRetDay-=dayNum;

function daysInMonth(iMonth,iYear){return 32-new Date(iYear,iMonth,32).getDate();}

function generateDays(ddID){
	var dropDown=document.getElementById(ddID);
	month=today.getMonth();
	var selected=initialDepDay;
	if(ddID=='retuDay')selected=initialRetDay;
	if((ddID=='deptDay'&&initialDepDay<day)||(ddID=='retuDay'&&initialRetDay<day))dayNum=daysInMonth(month+1,year);
	while(dropDown.hasChildNodes()){dropDown.removeChild(dropDown.childNodes[0]);}
	for(i=1;i<dayNum+1;i++){
 		var option=document.createElement('option');
		if(i>9){option.setAttribute('value',i);}else{option.setAttribute('value','0'+i);}
		if(i==selected)option.setAttribute('selected','selected');
		var optionTxt=document.createTextNode(i);
		option.appendChild(optionTxt);
		dropDown.appendChild(option);
	}
}

function generateMonths(ddID){
	var dropDown=document.getElementById(ddID);
	month=today.getMonth();
	if((ddID=='deptYr'&&initialDepDay<day)||(ddID=='retuYr'&&initialRetDay<day))month++;
	for(i=month;i<month+12;i++){
		var option=document.createElement('option');
		var optionLbl='';
		var optionVal='';
		if((i<9)||(i>11))optionVal='0';
		if(i<12){
			optionVal=optionVal+((i+1)+'/'+year);
			optionLbl=monthName[i]+' '+year;
		}else{
			optionVal=optionVal+((i-11)+'/'+(year+1));
			optionLbl=monthName[i-12]+' '+(year+1);
		}
		option.setAttribute('value',optionVal);
		if(i==month)option.setAttribute('selected','selected');
		var optionTxt=document.createTextNode(optionLbl);
		option.appendChild(optionTxt);
		dropDown.appendChild(option);
	}
}

function displayHolsSearch(lang){
var lang=lang; 
//if(lang==null||lang==""){lang="0";}
switch(lang){
	case "en":
	lang=0;
  break;    
	case "fr":
  lang=1;
  break;
default:
  lang=0
}
document.writeln('<form id="holidaysIbe" name="holidaysIbe" action="" method="post">');
document.writeln('<input type="hidden" id="residence" name="residence" value="QA" />');
document.writeln('<h3>'+langList[lang].title+'</h3>');
document.writeln('<div class="fields">');
document.writeln('<div class="row"><span class="label"><label id="locationLabel" for="location">'+langList[lang].location+'</label></span>');
document.writeln('<span class="field"><select id="location" name="location">');
document.writeln('<option value="select" selected="selected">'+langList[lang].select+'</option>');
document.writeln('<option value="AUH">'+destList[lang].auh+' (AUH)</option>');
document.writeln('<option value="AMD">'+destList[lang].amd+' (AMD)</option>');
document.writeln('<option value="ALY">'+destList[lang].aly+' (ALY)</option>');
document.writeln('<option value="ALG">'+destList[lang].alg+' (ALG)</option>');
document.writeln('<option value="AMM">'+destList[lang].amm+' (AMM)</option>');
document.writeln('<option value="AMS">'+destList[lang].ams+' (AMS)</option>');
document.writeln('<option value="ATH">'+destList[lang].ath+' (ATH)</option>');
document.writeln('<option value="ATL">'+destList[lang].atl+' (ATL)</option>');
document.writeln('<option value="BAH">'+destList[lang].bah+' (BAH)</option>');
document.writeln('<option value="DPS">'+destList[lang].dps+' (DPS)</option>');
document.writeln('<option value="BKK">'+destList[lang].bkk+' (BKK)</option>');
document.writeln('<option value="PEK">'+destList[lang].pek+' (PEK)</option>');
document.writeln('<option value="BEY">'+destList[lang].bey+' (BEY)</option>');
document.writeln('<option value="TXL">'+destList[lang].txl+' (TXL)</option>');
document.writeln('<option value="BIO">'+destList[lang].bio+' (BIO)</option>');
document.writeln('<option value="BOS">'+destList[lang].bos+' (BOS)</option>');
document.writeln('<option value="BRU">'+destList[lang].bru+' (BRU)</option>');
document.writeln('<option value="CAI">'+destList[lang].cai+' (CAI)</option>');
document.writeln('<option value="CPT">'+destList[lang].cpt+' (CPT)</option>');
document.writeln('<option value="CMN">'+destList[lang].cmn+' (CMN)</option>');
document.writeln('<option value="CEB">'+destList[lang].ceb+' (CEB)</option>');
document.writeln('<option value="CLT">'+destList[lang].clt+' (CLT)</option>');
document.writeln('<option value="MAA">'+destList[lang].maa+' (MAA)</option>');
document.writeln('<option value="CNX">'+destList[lang].cnx+' (CNX)</option>');
document.writeln('<option value="ORD">'+destList[lang].ord+' (ORD)</option>');
document.writeln('<option value="CMB">'+destList[lang].cmb+' (CMB)</option>');
document.writeln('<option value="ORK">'+destList[lang].ork+' (ORK)</option>');
document.writeln('<option value="DFW">'+destList[lang].dfw+' (DFW)</option>');
document.writeln('<option value="DAM">'+destList[lang].dam+' (DAM)</option>');
document.writeln('<option value="DMM">'+destList[lang].dmm+' (DMM)</option>');
document.writeln('<option value="DAR">'+destList[lang].dar+' (DAR)</option>');
document.writeln('<option value="DEL">'+destList[lang].del+' (DEL)</option>');
document.writeln('<option value="DEN">'+destList[lang].den+' (DEN)</option>');
document.writeln('<option value="DAC">'+destList[lang].dac+' (DAC)</option>');
document.writeln('<option value="DOH">'+destList[lang].doh+' (DOH)</option>');
//document.writeln('<option value="DXB">'+destList[lang].dxb+' (DXB)</option>');
document.writeln('<option value="DUB">'+destList[lang].dub+' (DUB)</option>');
document.writeln('<option value="EDI">'+destList[lang].edi+' (EDI)</option>');
document.writeln('<option value="FRA">'+destList[lang].fra+' (FRA)</option>');
document.writeln('<option value="FUK">'+destList[lang].fuk+' (FUK)</option>');
document.writeln('<option value="GVA">'+destList[lang].gva+' (GVA)</option>');
document.writeln('<option value="GLA">'+destList[lang].gla+' (GLA)</option>');
document.writeln('<option value="CAN">'+destList[lang].can+' (CAN)</option>');
document.writeln('<option value="HAN">'+destList[lang].han+' (HAN)</option>');
document.writeln('<option value="SGN">'+destList[lang].sgn+' (SGN)</option>');
document.writeln('<option value="HKG">'+destList[lang].hkg+' (HKG)</option>');
document.writeln('<option value="IAH">'+destList[lang].iah+' (IAH)</option>');
document.writeln('<option value="HYD">'+destList[lang].hyd+' (HYD)</option>');
document.writeln('<option value="ISB">'+destList[lang].isb+' (ISB)</option>');
document.writeln('<option value="IST">'+destList[lang].ist+' (IST)</option>');
document.writeln('<option value="CGK">'+destList[lang].cgk+' (CGK)</option>');
document.writeln('<option value="JED">'+destList[lang].jed+' (JED)</option>');
document.writeln('<option value="JNB">'+destList[lang].jnb+' (JNB)</option>');
document.writeln('<option value="KHI">'+destList[lang].khi+' (KHI)</option>');
document.writeln('<option value="KTM">'+destList[lang].ktm+' (KTM)</option>');
document.writeln('<option value="KRT">'+destList[lang].krt+' (KRT)</option>');
document.writeln('<option value="COK">'+destList[lang].cok+' (COK)</option>');
document.writeln('<option value="CCJ">'+destList[lang].ccj+' (CCJ)</option>');
document.writeln('<option value="KUL">'+destList[lang].kul+' (KUL)</option>');
document.writeln('<option value="KWI">'+destList[lang].kwi+' (KWI)</option>');
document.writeln('<option value="LHE">'+destList[lang].lhe+' (LHE)</option>');
document.writeln('<option value="LON">'+destList[lang].lon+' (LON)</option>');
document.writeln('<option value="LAX">'+destList[lang].lax+' (LAX)</option>');
document.writeln('<option value="LXR">'+destList[lang].lxr+' (LXR)</option>');
document.writeln('<option value="MAD">'+destList[lang].mad+' (MAD)</option>');
document.writeln('<option value="AGP">'+destList[lang].agp+' (AGP)</option>');
document.writeln('<option value="MLE">'+destList[lang].mle+' (MLE)</option>');
document.writeln('<option value="MAN">'+destList[lang].man+' (MAN)</option>');
document.writeln('<option value="MNL">'+destList[lang].mnl+' (MNL)</option>');
document.writeln('<option value="MHD">'+destList[lang].mhd+' (MHD)</option>');
document.writeln('<option value="MEL">'+destList[lang].mel+' (MEL)</option>');
document.writeln('<option value="MSP">'+destList[lang].msp+' (MSP)</option>');
document.writeln('<option value="MXP">'+destList[lang].mxp+' (MXP)</option>');
document.writeln('<option value="YUL">'+destList[lang].yul+' (YUL)</option>');
document.writeln('<option value="DME">'+destList[lang].dme+' (DME)</option>');
document.writeln('<option value="BOM">'+destList[lang].bom+' (BOM)</option>');
document.writeln('<option value="MUC">'+destList[lang].muc+' (MUC)</option>');
document.writeln('<option value="MCT">'+destList[lang].mct+' (MCT)</option>');
document.writeln('<option value="NAG">'+destList[lang].nag+' (NAG)</option>');
document.writeln('<option value="NBO">'+destList[lang].nbo+' (NBO)</option>');
document.writeln('<option value="NYC">'+destList[lang].nyc+' (NYC)</option>');
document.writeln('<option value="KIX">'+destList[lang].kix+' (KIX)</option>');
document.writeln('<option value="OSL">'+destList[lang].osl+' (OSL)</option>');
document.writeln('<option value="PMI">'+destList[lang].pmi+' (PMI)</option>');
document.writeln('<option value="CDG">'+destList[lang].cdg+' (CDG)</option>');
document.writeln('<option value="PEN">'+destList[lang].pen+' (PEN)</option>');
document.writeln('<option value="PEW">'+destList[lang].pew+' (PEW)</option>');
document.writeln('<option value="PHL">'+destList[lang].phl+' (PHL)</option>');
document.writeln('<option value="PNH">'+destList[lang].pnh+' (PNH)</option>');
document.writeln('<option value="HKT">'+destList[lang].hkt+' (HKT)</option>');
document.writeln('<option value="RUH">'+destList[lang].ruh+' (RUH)</option>');
document.writeln('<option value="FCO">'+destList[lang].fco+' (FCO)</option>');
document.writeln('<option value="SLC">'+destList[lang].slc+' (SLC)</option>');
document.writeln('<option value="SFO">'+destList[lang].sfo+' (SFO)</option>');
document.writeln('<option value="SAH">'+destList[lang].sah+' (SAH)</option>');
document.writeln('<option value="CTS">'+destList[lang].cts+' (CTS)</option>');
document.writeln('<option value="ICN">'+destList[lang].icn+' (ICN)</option>');
document.writeln('<option value="SEZ">'+destList[lang].sez+' (SEZ)</option>');
document.writeln('<option value="PVG">'+destList[lang].pvg+' (PVG)</option>');
document.writeln('<option value="SIN">'+destList[lang].sin+' (SIN)</option>');
document.writeln('<option value="ARN">'+destList[lang].arn+' (ARN)</option>');
document.writeln('<option value="SYD">'+destList[lang].syd+' (SYD)</option>');
document.writeln('<option value="IKA">'+destList[lang].ika+' (IKA)</option>');
document.writeln('<option value="TRV">'+destList[lang].trv+' (TRV)</option>');
document.writeln('<option value="HND">'+destList[lang].hnd+' (HND)</option>');
document.writeln('<option value="YTO">'+destList[lang].yto+' (YTO)</option>');
document.writeln('<option value="TIP">'+destList[lang].tip+' (TIP)</option>');
document.writeln('<option value="TUN">'+destList[lang].tun+' (TUN)</option>');
document.writeln('<option value="VIE">'+destList[lang].vie+' (VIE)</option>');
document.writeln('<option value="IAD">'+destList[lang].iad+' (IAD)</option>');
document.writeln('<option value="ZRH">'+destList[lang].zrh+' (ZRH)</option>');
document.writeln('</select></span></div>');
document.writeln('<div class="row"><span class="label"><label for="checkinDay">'+langList[lang].checkin+'</label></span>');
document.write('<span class="field"><select id="checkinDay" name="checkinDay" class="sml"></select></span>');
document.write('<span class="field"><select id="checkinYr" name="checkinYr" onChange="generateDays(\'checkinDay\')" class="medium"></select></span></div>');
document.writeln('<div class="row"><span class="label"><label for="nights">'+langList[lang].nights+'</label></span>');
document.write('<span class="field"><select id="nights" name="nights" class="sml">');
document.write('<option value="1" selected="selected">1</option>');
for(i=2;i<32;i++){document.write('<option value="'+i+'">'+i+'</option>');}
document.write('</select></span></div>');
document.writeln('<div class="row"><span class="label"><label for="adult">'+langList[lang].rooms+'</label></span>');
document.writeln('<span class="field"><select id="rooms" name="rooms" class="sml">');
document.writeln('<option value="1" selected="selected">1</option>');
document.writeln('<option value="2">2</option>');
document.writeln('<option value="3">3</option>');
document.writeln('<option value="4">4</option>');
document.writeln('<option value="5">5</option>');
document.writeln('</select></span></div>');
document.writeln('<input type="hidden" id="adults" name="adults" value="1" />');
/*
document.writeln('<div class="row"><span class="label"><label for="adults">'+langList[lang].adults+'</label></span>');
document.writeln('<span class="field"><select id="adults" name="adults" class="sml">');
document.writeln('<option value="0">0</option>');
document.writeln('<option value="1">1</option>');
document.writeln('<option value="2" selected="selected">2</option>');
document.writeln('<option value="3">3</option>');
document.writeln('<option value="4">4</option>');
document.writeln('<option value="5">5</option>');
document.writeln('<option value="6">6</option>');
document.writeln('<option value="7">7</option>');
document.writeln('<option value="8">8</option>');
document.writeln('<option value="9">9</option>');
document.writeln('</select></span></div>');
*/
document.writeln('</div><div class="submit">');
document.writeln('<div class="formSubmit"><input type="button" id="btnFltSearch" class="ButtonBig buttonLLBig" value="search" onclick="validate('+lang+')">');
document.writeln('</div></div></form>');//</div>
document.write('<script type="text/javascript">generateDays(\'checkinDay\')</script>');
document.write('<script type="text/javascript">generateMonths(\'checkinYr\');</script>');
}

function validate(lang){
	var language=lang;
/*
	var from=document.getElementById('originLabel');
	var to=document.getElementById('destLabel');
	var missing="0";
	if(document.getElementById('origin').options[document.getElementById('origin').selectedIndex].value=="select"){
		from.style.fontWeight="bold";from.style.color="red";missing="1";
	}else{from.style.fontWeight="normal";from.style.color="black";}
	if(document.getElementById('destination').options[document.getElementById('destination').selectedIndex].value=="select"){
		to.style.fontWeight="bold";to.style.color="red";missing="1";
	}else{to.style.fontWeight="normal";to.style.color="black";}
	if(missing=="0")submitFltSearch(language);
*/
	submitFltSearch(language);
}

function submitFltSearch(lang){
	var formAction;
	formAction="http://holidays.qatarairways.com/qatarairways/packaging/reservation/ResPkgSearchCriteria.do?ActionType=Pkg&dlr=Y";
	var location=document.holidaysIbe.location.options[document.holidaysIbe.location.selectedIndex];
	var monthYear=document.holidaysIbe.checkinYr.options[document.holidaysIbe.checkinYr.selectedIndex].value;
	var rooms=document.holidaysIbe.rooms.options[document.holidaysIbe.rooms.selectedIndex].value;
	var city=location.text;
	city=city.substring(0,city.indexOf(' '));
	var iata=location.value;
	var countryCode="";
	var cityCode="";
	for(i=0;i<cityList.length;i++){
		if(cityList[i].iata==iata){countryCode=cityList[i].countryCode;cityCode=cityList[i].cityCode;}
	}
	var nights=document.holidaysIbe.nights.options[document.holidaysIbe.nights.selectedIndex].value;
	var day=document.holidaysIbe.checkinDay.options[document.holidaysIbe.checkinDay.selectedIndex].value;
	var month=monthYear.substring(0,monthYear.indexOf('/'));
	var year=monthYear.substring(monthYear.indexOf('/')+1,monthYear.length);
	var outDay="-";
	var outMonth="-";
	var outYear="-";
	var roomCode=""
	for(i=0;i<rooms;i++){
		roomCode+='1|0|-|%25|%25@';
	}
	var regionCode='1~QA';
	var searchString="";
	searchString=formAction+'&DLR1='+city+'&DLR2='+countryCode+'&DLR3='+cityCode+'&DLR4='+nights+'&DLR5='+day+'&DLR6='+month+'&DLR7='+year+'&DLR8='+rooms+'&DLR9='+outDay+'&DLR10='+outMonth+'&DLR11='+outYear+'&DLR12='+roomCode+'&DLR13='+regionCode;
	document.holidaysIbe.action=searchString;
	document.holidaysIbe.method="post";
	document.holidaysIbe.target="_top";
	document.holidaysIbe.submit();
//	document.location.href='http://www.qatarairways.com/disabled.html';
}