var iDaysOut=2;
var iDefaultDaysOut=60;

AddOnLoadScript("initWiz()",200);

function BuildDate(sDefault)
{
	var oD;
	if(sDefault != null && sDefault.length > 0)
	{
		sDefault = sDefault.replace(/ .*/g,'');
		oD = new Date(sDefault);
	}
	else oD = new Date();

	return oD;
}

//GetDate(iType_of_date,iDays_between_dates,sDefault_date,sSystemDate)
function GD(iT,iD,sD)
{
var oD,oS,iM,iSM,sR;
	if(isNaN(iD)) iD = 0;

	oS = BuildDate(g_sDate);
	iSM = oS.getMonth();

	if(sD == null || sD.length < 1)
	{

		g_sDate	= g_sDate.replace(/ +.*/g,'');
		oD		= BuildDate(g_sDate);
		oD.setDate(oD.getDate()+iDefaultDaysOut);
	}
	else
	{
		oD		= BuildDate(sD);
		iD		= 0;
	}

	oD.setTime(oD.getTime() + (iD*1000*60*60*24));

	iD			=oD.getDate();
	iM			=oD.getMonth();

	sR="";

	if(iT==0)
	{
		for(var i=1;i<32;i++)sR+=((i==iD) ?'*':'')+i+"="+i+";";
	}
	else
	{
		var sY;
		for(var i=1,j=iSM;i<13;i++,j++)
		{
			sY='';
			if(j<iSM)sY=DefYr(j,1);
			sR+=((j==iM)?'*':'')+gaMonName[j]+' '+sY+'='+(j+1)+';';
			if(j>10)j=-1;
		}

	}
	return sR;
}

//GetDropDownstring(iDrop_Down_Num,sDefault_value)
function GDD(iD,sD)
{
var sR = "";

	switch(iD)
	{
		/*FROM*/case(0):sR="aT[2]<B>Select your departure city</B></FONT>=-1;Abilene Municipal=ABI;Akron-Canton=CAK;Albany County=ALB;Albany, Dougherty County=ABY;Albuquerque=ABQ;Alexandria International=AEX;Alexandria, Esler Field=ESF;Allentown-Bethlehem-Easton=ABE;Altoona, Blair County=AOO;Amarillo=AMA;Anchorage=ANC;Appleton, Outagamie County=ATW;Ashville Regional=AVL;Aspen, Sardy Field=ASE;Athens Municipal=AHN;Atlanta, Wm B. Hartsfield=ATL;Augusta, Bush Field=AGS;Austin=AUS;Bakersfield, Meadows Field=BFL;Baltimore-Washington=BWI;Bangor=BGR;Baton Rouge Metro, Ryan Field=BTR;Beaumont-Port Arthur=BPT;Billings, Logan=BIL;Binghampton,Edwin A Link Field=BGM;Birmingham=BHM;Bismarck=BIS;Bloomington-Normal=BMI;Boise=BOI;Boston, Logan=BOS;Bozeman, Gallatin Field=BZN;Bradford-Regional=BFD;Brunswick,Glynco Jet Port=BQK;Buffalo NY, Greater Buffalo=BUF;Burbank-Glendale-Pasadena=BUR;Burlington=BTV;Burlington Municipal=BRL;Butte, Bert Mooney=BTM;Calgary=YYC;Cape Girardeau,Cape Municipal=CGI;Carlsbad, Palomar=CLD;Casper, Natrona County=CPR;Cedar City Municipal=CDC;Cedar Rapids Municipal=CID;Champaign=CMI;Charleston SC=CHS;Charleston, Yeager=CRW;Charlotte, Douglas=CLT;Charlottesville-Albemarle=CHO;Chattanooga, Lovell Field=CHA;Chicago, O'Hare=ORD;Chico Municipal=CIC;Cincinnati, Greater Cincinnati=CVG;Cleveland, Hopkins=CLE;Cody Regional=COD;College Station,Easterwood=CLL;Colorado Springs Municipal=COS;Columbia Metropolitan=CAE;Columbia Regional=COU;Columbus Metropolitan=CSG;Columbus, Golden Triangle=GTR;Columbus, Port Columbus=CMH;Corpus Christi=CRP;Crescent City Municipal=CEC;Cumberland Municipal=CBE;Dallas-Fort Worth=DFW;Dayton=DAY;Daytona Beach Regional=DAB;Decatur Municipal=DEC;Denver International Airport=DEN;Des Moines=DSM;Detroit,Metropolitan Wayne Co.=DTW;District of Columbia-National=DCA;Dothan Municipal=DHN;Du Bois, Jefferson County=DUJ;Dubuque Municipal=DBQ;Duluth=DLH;Durango, La Plata Field=DRO;Eagle County Regional=EGE;El Centro, Imperial County=IPL;El Paso=ELP;Elko, J.C. Harris=EKO;Elmira Regional=ELM;Erie=ERI;Eugene, Mahlon Sweet=EUG;Eureka, Arcata/Eureka=ACV;Evansville, Dress Regional=EVV;Fargo, Hector=FAR;Fayetteville Municipal=FAY;Fayetteville, Drake Field=FYV;Florence, City County=FLO;Fresno Air Terminal=FAT;Friedman Memorial, Sun Valley=SUN;Ft Lauderdale-Hollywood=FLL;Ft Myers, SW Florida Regional=RSW;Ft Walton Beach,Okaloosa Cty.=VPS;Ft Wayne, Baer Field=FWA;Ft. Smith Municipal=FSM;Gainesville Regional=GNV;Grand Junction, Walker Field=GJT;Grand Rapids, Kent County=GRR;Great Falls=GTF;Green Bay,Austin StraubleField=GRB;Greensboro-Piedmont Triad=GSO;Greenville, Pitt-Greenville=PGV;Greenville/Spartanburg=GSP;Gulfport-Biloxi=GPT;Gunnison County=GUC;Harrisburg=MDT;Hartford, Bradley=BDL;Helena Municipal=HLN;Hilton Head Is. Municipal=HHH;Houston Intercontinental=IAH;Houston-Hobby=HOU;Honolulu=HNL;Huntington, Tri-State=HTS;Huntsville=HSV;Idaho Falls, Fanning Field=IDA;Indianapolis=IND;Inyokern-Kern County=IYK;Islip, MacArthur=ISP;Ithaca, Tompkins County=ITH;Jackson Hole=JAC;Jackson, Allen C ThompsonField=JAN;Jackson, McKellar Field=MKL;Jacksonville=JAX;Jacksonville, Albert J. Ellis=OAJ;Jamestown, Chautauqua County=JHW;Johnstown-Cambria=JST;Joplin Municipal=JLN;Kalamazoo/Battle Creek=AZO;Kalispell,Glacier Park=FCA;Kansas City=MCI;Kansas City Municipal=MKC;Key West=EYW;Killeen Municipal=ILE;Kirksville Municipal=IRK;Knoxville, McGhee-Tyson=TYS;La Crosse Municipal=LSE;Lafayette Municipal=LFT;Lake Charles Municipal=LCH;Lancaster Municipal=LNS;Lansing, Capitol City=LAN;Laredo=LRD;Las Vegas, Mc Carran=LAS;Latrobe, Westmoreland County=LBE;Lawton Municipal=LAW;Lebanon Regional=LEB;Lexington, Blue Grass Field=LEX;Lincoln Municipal=LNK;Little Rock-Adams Field=LIT;Longview, Gregg County=GGG;Los Angeles=LAX;Louisville, Standiford Field=SDF;Lubbock=LBB;Lynchburg Municipal=LYH;Macon, Lewis B. Wilson=MCN;Madison, Dane County=MSN;Manchester Municipal=MHT;Marathon=MTH;Marion, Williamson County=MWA;McAllen, Miller=MFE;Medford-Jackson County=MFR;Melbourne Regional=MLB;Memphis=MEM;Merced Municipal=MCE;Meridian, Key Field=MEI;Metropolitan Oakland=OAK;Miami=MIA;Midland-Odessa,Midland Airpark=MAF;Milwaukee, General Mitchell=MKE;Minneapolis/St Paul=MSP;Missoula, Johnson Bell=MSO;Mobile Municipal=MOB;Modesto Municipal=MOD;Moline, Quad City=MLI;Monroe Regional=MLU;Monterey Peninsula=MRY;Montgomery, Dannelly Field=MGM;Montrose Municipal=MTJ;Morgantown, Walter Hart Field=MGW;Myrtle Beach Jetport=MYR;Nantucket Memorial=ACK;Nashville=BNA;New Bern, Simmons-Nott=EWN;New Haven, Tweed-New Haven=HVN;New London, Groton-New London=GON;New Orleans=MSY;New York, Kennedy=JFK;New York, La Guardia=LGA;New York, Westchester County=HPN;Newark=EWR;Newburgh, Stewart=SWF;Newport News=PHF;Norfolk=ORF;Northwest Arkansas Regional=XNA;Oklahoma City,Will RogersWorld=OKC;Omaha, Eppley Field=OMA;Ontario=ONT;Orange County, John Wayne=SNA;Orlando=MCO;Owensboro-Daviess=OWB;Oxnard, Ventura County=OXR;Paducah, Barkley Regional=PAH;Palm Springs Municipal=PSP;Panama City, Bay County=PFN;Pasco, Tri-Cities=PSC;Pensacola Regional=PNS;Peoria=PIA;Philadelphia=PHL;Phoenix, Sky Harbor=PHX;Pittsburgh, Greater Pittsburgh=PIT;Pocatello Municipal=PIH;Portland=PDX;Portland, Jet Port=PWM;Presque Isle,N. Maine Regional=PQI;Providence, T.F. Green State=PVD;Quincy, Baldwin Field=UIN;Raleigh-Durham=RDU;Rapid City Regional=RAP;Reading Municipal=RDG;Redding Municipal=RDD;Redmond, Roberts Field=RDM;Reno/Tahoe=RNO;Richmond=RIC;Roanoke Municipal=ROA;Rochester Municipal=RST;Rochester, Greater Rochester=ROC;Sacramento Metropolitan=SMF;Saginaw, Tri-City=MBS;Salisbury, Wicomico County=SBY;Salt Lake City=SLC;San Antonio=SAT;San Diego, Lindbergh Field=SAN;San Francisco=SFO;San Jose=SJC;San Luis Obispo=SBP;Santa Barbara Municipal=SBA;Santa Maria Public=SMX;Sarasota-Bradenton=SRQ;Savannah=SAV;Seattle-Tacoma=SEA;Shenandoah Valley=SHD;Shreveport Regional=SHV;Sioux City, Sioux Gateway=SUX;Sioux Falls, Joe Foss Field=FSD;South Bend, Michiana Regional=SBN;Spokane=GEG;Springfield Regional=SGF;Springfield, Capital=SPI;St George Municipal=SGU;St Louis, Lambert=STL;St. Petersburg/Clearwater Intl=PIE;State College,University Park=SCE;Syracuse, Hancock=SYR;Tallahassee Regional=TLH;Tampa=TPA;Texarkana Municipal=TXK;Toledo Express=TOL;Traverse City, Cherry Capital=TVC;Tri-City (Bristol / Johnson City / Kingstown)=TRI;Tucson=TUS;Tulsa=TUL;Twin Falls-Sun Valley Regional=TWF;Tyler, Pounds Field=TYR;Valdosta Regional=VLD;Vancouver=YVR;Vernal/Uintah County=VEL;Visalia Municipal=VIS;Waco, Madison Cooper=ACT;Washington Dulles=IAD;Waterloo Municipal=ALO;Watertown=ART;Wausau, Wisconsin Regional=CWA;West Palm Beach=PBI;West Yellowstone=WYS;Wichita Falls Municipal=SPS;Wichita, Mid-Continent=ICT;Wilkes-Barre/Scranton=AVP;Williamsport-Lycoming County=IPT;Wilmington, New Hanover County=ILM;Winnipeg=YWG;Worcester Municipal=ORH;Yampa Valley Regional, Hayden=HDN;";break;
		/*ADLT*/case(1):sR="1=1;2=2;3=3;4=4;5=5;6=6;7=7;8=8;9=9;";break;
		/*CHLD*/case(2):sR="0=0;1=1;2=2;3=3;4=4;5=5;6=6;7=7;8=8;";break;
		/*CLSS*/case(3):sR="Coach=Y;First=F;";break;
		/*CLSS+BIZ*/case(4):sR="Coach=Y;Business=B;First=F;";break;
	}
	if(sD != null && sD.length > 0)
	{
		sD='(= *'+sD+" *;)";
		re = new RegExp(sD,'gi');
		sR=sR.replace(re,"*$1");
	}

	return sR;
}
function initWiz()
{
var oWS = GE("WizState");
	oNF = GE("NeedFlt");

	if(bIE && oWS.value == 1)
	{
		WZTB(oNF.value,true);
        SWD();
		return;
	}
	else WZTB(oNF.value);

	if(g_sSubRegion == 'undefined' || g_sSubRegion==null)
	if(g_sDate==null)g_sDate=(BuildDate()).toDateString();

    SWD();

	oWS.value = 1;
}

//SyncWizDates
function SWD()
{
    SD('TrvlDate','MON1A','DAY1A','TrvlDate1Label');
    SD('RtnDate','MON1B','DAY1B','RtnDate1Label');
    SD('TrvlDate','MON2A','DAY2A','TrvlDate2Label');
    SD('RtnDate','MON2B','DAY2B','RtnDate2Label');
}

function SV()
{
	if(GE("NeedFlt").value=="Y")	//FLT..
	{
		GE("DepCity").value=GE("DEST1A").value;
		GE("Adlts").value=GE("NUMA1").value;
		GE("Chld").value=GE("NUMC1").value;
		GE("Class").value=GE("CABCLASS").value;

		SIP(GE("DEST1B"),GE("AirCode"));
		SD('TrvlDate','MON1A','DAY1A','TrvlDate1Label');
		SD('RtnDate','MON1B','DAY1B','RtnDate1Label');
	}
	else							//HOT..
	{
		GE("DepCity").value='';
		GE("Adlts").value=GE("NUMA2").value;
		GE("Chld").value=GE("NUMC2").value;
		SIP(GE("DEST2A"),GE("AirCode"));

		SD('TrvlDate','MON2A','DAY2A','TrvlDate2Label');
		SD('RtnDate','MON2B','DAY2B','RtnDate2Label');
	}

	try{SVS()}
	catch(e){}

}

//SyncValues2(sWizType)
function SV2(sT)
{
var iM1,iM2,aT;

if(GE("ExpHotelID").value.length==0 && GE("SingleDest").value != 1) aT="DEST1B|DEST2A|MON1A|MON2A|DAY1A|DAY2A|MON1B|MON2B|DAY1B|DAY2B|NUMA1|NUMA2|NUMC1|NUMC2".split("|");
else aT="MON1A|MON2A|DAY1A|DAY2A|MON1B|MON2B|DAY1B|DAY2B|NUMA1|NUMA2|NUMC1|NUMC2".split("|");

	if(sT=="N")iM1=1,iM2=0;
	else iM1=0,iM2=1;
	sTE = "";
	for(var i=0; i<aT.length;i+=2)
	{
		sTE+="GE('INP" + aT[i+iM1]	+ "').value=GE('INP" + aT[i+iM2] + "').value;\n"
			+"GE('" + aT[i+iM1]+ "').value=GE('" + aT[i+iM2] + "').value;\n";
	}

	sTE+="GE('TrvlDate"+ (iM1+1) +"Label').innerHTML	= GE('TrvlDate"+ (iM2+1)  +"Label').innerHTML\n"
		+"GE('RtnDate" + (iM1+1) +"Label').innerHTML	= GE('RtnDate" + (iM2+1)  +"Label').innerHTML\n";
	eval(sTE);

}


//SyncDate(oTarget_Input,oMonth_Input,oDay_Input,oDate_Label)
function SD(sT,sM,sD,sL)
{
var oT,oM,oD,oL
	oT = GE(sT);
	oM = GE(sM);
	oD = GE(sD);
	oL = GE(sL);

var sDate,oDate,m=oM.value,d=oD.value;
var ms = (BuildDate()).getMonth()+1;
var sTE = "";

	if(ms==m)
	{
		y=(BuildDate()).getYear();
		if(bNS) y+=1900;
	}
	else y = parseInt(DefYr(m,d));

	sDate=m+"/"+d+"/"+y;
	oT.value=sDate;
	oDate=BuildDate(sDate);
	oL.innerHTML=gaDayName[oDate.getDay()];
	sTE += "GE('INP"+oD.name+"').value="+d+";\n";
	sTE += "GE('INP"+oM.name+"').value="+m+";\n";

	eval(sTE);
}

//SyncDate2(oDateInput,sTarget_Control_Suffix,oDate_Label)
function SD2(sI,sT,sL)
{
oI = GE(sI);
oL = GE(sL);

if(oI == null) return;

var iM,iDM,oD,oM,oDD,oDM;
var oDate = BuildDate(oI.value);

	oD=		GE("DAY"+sT);
	oM=		GE("MON"+sT);
	oDD=	GE("INPDAY"+sT);
	oDM=	GE("INPMON"+sT);

	oD.value	= oDate.getDate();
	oM.value	= oDate.getMonth()+1;
	oDD.value 	= oD.value;

	iM	= oM.value;
	iDM	= (BuildDate(g_sDate)).getMonth();

	if(iM < iDM) oDM.value = iM;
	else oDM.value = iM;

	oL.innerHTML=gaDayName[oDate.getDay()];
}

//SyncInPutvals(oInput1,oInput2)
function SIP(o1,o2){o2.value = o1.value;}

//WiZTaB(iTab)
function WZTB(sT,bS)
{
	GE("NeedFlt").value=sT;

	if(sT.toUpperCase() == "N")
	{
		GE("wizFlt").style.display	= 'none';
		GE("tabFlt").className		= 'WIZTAB0';
		GE("NeedFlt").value			= 'N';

		GE("wizHot").style.display	= 'block';
		GE("tabHot").className		= 'WIZTAB1';

	}
	else
	{
		GE("wizFlt").style.display	= 'block';
		GE("tabFlt").className		= 'WIZTAB1';
		GE("NeedFlt").value			= 'Y';

		GE("wizHot").style.display	= 'none';
		GE("tabHot").className		= 'WIZTAB0';
	}
	if(bS) return;
	SV2(sT);
}


//Validate_Wizard()
function VW()
{
var	aE,aT,aV,sWz,iDaysDiff,i
	,cCLSS,cCTY_1_F,cCTY_2_F,cDAT1_F
	,cDAT2_F,cADLT_F,cCHLD_F,cCTY_2_H,cDAT1_H,
	cDAT2_H,cADLT_H,cCHLD_H,oED,sED,sR,sTE;

	aE			= new Array();	//ERRORS
	aT			= new Array();	//TEMP STRING MANAGER
	aV			= new Array();	//INPUT VALUES

	iWz			= (GE("NeedFlt").value=="Y")?1:2;
	iDaysDiff	= 1;
	i			= 0;

	cCLSS		= i++;
	cSUB_REG	= i++;
	cCTY_1_F	= i++;
	cCTY_2_F	= i++;
	cDAT1_F		= i++;
	cDAT2_F		= i++;
	cADLT_F		= i++;
	cCHLD_F		= i++;
	cCTY_2_H	= i++;
	cDAT1_H		= i++;
	cDAT2_H		= i++;
	cADLT_H		= i++;
	cCHLD_H		= i++;

	oED			= BuildDate(g_sDate);
	oED.setDate(oED.getDate()+iDaysOut);
	sED			= (oED.getMonth()+1) + '/' + oED.getDate() + '/' + oED.getYear();
	sR			='';
	sTE			='';

	SV();

//	aV[cSUB_REG]	= GE("SubRgnId").value;
	aV[cCLSS]		= GE("Class").value;
	aV[cCTY_1_F]	= GE("DepCity").value;
	aV[cCTY_2_F]	= GE("AirCode").value;
	aV[cDAT1_F]		= GE("TrvlDate").value;
	aV[cDAT2_F]		= GE("RtnDate").value;
	aV[cADLT_F]		= parseInt(GE("Adlts").value);
	aV[cCHLD_F]		= parseInt(GE("Chld").value);
	aV[cCTY_2_H]	= aV[cCTY_2_F];
	aV[cDAT1_H]		= aV[cDAT1_F];
	aV[cDAT2_H]		= aV[cDAT2_F];
	aV[cADLT_H]		= aV[cADLT_F];
	aV[cCHLD_H]		= aV[cCHLD_F];

	aE[cSUB_REG]	= ['','',''];
	aE[cCLSS]		= ['','',''];
	aE[cCTY_1_F]	= ['',GE("INPDEST1A"),	'Please select a departure city and continue your search.'];
	aE[cADLT_F]		= ['',GE("INPNUMA1"),	'Please change the number of travelers to nine or less.'];
	aE[cDAT1_F]		= ['',GE("INPMON1A"),	'Please enter a departure date that is on or after ' + sED +'.',GIM(aV[cDAT1_F])];
	aE[cDAT2_F]		= ['',GE("INPMON1B"),	'Your return date must be ' + (iDaysDiff+1) + ' or more days after your departure date.','Your return date must be within twenty-nine days of your departure. Please review your dates.',GIM(aV[cDAT2_F])];
	aE[cCTY_2_H]	= ['',GE("INPDEST2A"),	'--'];
	aE[cADLT_H]		= ['',GE("INPNUMA2"),	'Please change the number of travelers to nine or less.'];
	aE[cDAT1_H]		= ['',GE("INPMON2A"),	'Departure date must be on or after ' + sED +'.',GIM(aV[cDAT1_H])];
	aE[cDAT2_H]		= ['',GE("INPMON2B"),	'Your return date must be ' + (iDaysDiff+1) + ' or more days after your departure date.','Your return date must be within twenty-nine days of your departure. Please review your dates.',GIM(aV[cDAT2_H])];


	aT[0] 			= iWz;
	aT[1] 			= (iWz==2)?1:2;
	aT[2] 			= "divErr"		+ aT[0]+"_";												//CURRENT ERROR MARKER PREFIX
	aT[3] 			= "divErr"		+ aT[1]+"_";												//HIDDEN ERROR MARKER PREFIX
	aT[4] 			= "divErrMsgs"	+ aT[0];													//CURRENT MSGBOX
	aT[5] 			= "divErrMsgs"	+ aT[1];													//HIDDEN MSGBOX
	aT[6] 			= ".style.visibility="
	aT[7] 			= "'visible';\n";
	aT[8] 			= "'hidden';\n";
	aT[9] 			= aT[6]+aT[7];																//VISIBLE..
	aT[10]			= aT[6]+aT[8];																//HIDDEN..
	aT[11]			= "ErrMsgs"		+ iWz														//ERROR MESSAGES

	if(aT[0]==1)																				//FLT
	{
		if(aV[cCTY_1_F]==-1) aE[cCTY_1_F][0] += aE[cCTY_1_F][2];								//DEPT CITY
		if(!VDR(aV[cDAT1_F],aV[cDAT2_F],iDaysDiff)) aE[cDAT2_F][0] += aE[cDAT2_F][2];			//DT2 > DT1
		if(!VDR(g_sDate,aV[cDAT1_F],iDaysOut-1)) aE[cDAT1_F][0] += aE[cDAT1_F][2];				//DT1 >= TODAY+2
		if(!VDR2(aV[cDAT1_F],aV[cDAT2_F],30)) aE[cDAT2_F][0] += aE[cDAT2_F][3];					//DT2 - DT1 <= 29

		if(IDV(aV[cDAT1_F])) aE[cDAT1_F][0] += aE[cDAT1_F][3];									//D1 IS REAL DATE?
		if(IDV(aV[cDAT2_F])) aE[cDAT2_F][0] += aE[cDAT2_F][4];									//D2 IS REAL DATE?

		if(aV[cADLT_F] + aV[cCHLD_F] > 9) aE[cADLT_F][0] += aE[cADLT_F][2];						//PASSENGERS <= 9
	}
	else																						//HOT
	{
		if(!VDR(aV[cDAT1_H],aV[cDAT2_H],iDaysDiff)) aE[cDAT2_H][0] += aE[cDAT2_H][2];			//DT2 > DT1
		if(!VDR(g_sDate,aV[cDAT1_H],iDaysOut-1)) aE[cDAT1_H][0] += aE[cDAT1_H][2];				//DT1 >= TODAY+2
		if(!VDR2(aV[cDAT1_H],aV[cDAT2_H],30)) aE[cDAT2_H][0] += aE[cDAT2_H][3];					//DT2 - DT1 <= 29

		if(IDV(aV[cDAT1_H])) aE[cDAT1_H][0] += aE[cDAT1_H][3];									//D1 IS REAL DATE?
		if(IDV(aV[cDAT2_H])) aE[cDAT2_H][0] += aE[cDAT2_H][4];									//D2 IS REAL DATE?


		if(aV[cADLT_H] + aV[cCHLD_H] > 9) aE[cADLT_H][0] += aE[cADLT_H][2];						//PASSENGERS <= 9
	}

	for(var i=1; i<5;i++)																		//HIDE ERROR MARKERS
	{
		sTE+="GE(\""+aT[2]+i+"\")"+aT[10];
		sTE+="GE(\""+aT[3]+i+"\")"+aT[10];
	}

	var bE = false

	for(var i=0,j=1;i<aE.length;i++)
	{
		if(aE[i]==null||aE[i][0]=='') continue;

		if(j==1)GE(aE[i][1].name).focus();

		sR+="<B>"+j+":</B> "+aE[i][0]+"<BR><BR>";
		sTE+="GE(\""+aT[2]+j+"\").style.top="+(aE[i][1].offsetTop - 9)+';\n';
		sTE+="GE(\""+aT[2]+j+"\").style.left="+(aE[i][1].offsetLeft - 23)+';\n';

		sTE+="GE(\""+aT[2]+j+"\")"+aT[6]+aT[7];
		sTE+="GE('imgErr"+aT[0]+"_"+j+"').src='/images/err.gif';\n";
		sTE+="GE('imgErr"+aT[0]+"_"+j+"').alt='" + aE[i][0] + "';\n";
		bE = true;
		j++;
	}

	sTE+="GE(\""+aT[4]+"\")"+aT[((bE)?9:10)];																	//SHOWHIDE ACTIVE ERROR MSG BOX
	sTE+="GE(\""+aT[5]+"\")"+aT[10];																			//HIDE HIDDEN ERROR MSG BOX

	sTE+="GE(\""+aT[11]+"\").innerHTML='"+sR.replace(/<BR>$/g,'')+"';\n";

	eval(sTE);

	if(sR=='')
	{
		if(aT[0]==1)
		{
			//SAVE client-side cookie values;
			var l_oDD = GE('INPDEST1A').options
				l_oDD = l_oDD[l_oDD.selectedIndex];

			UDC(l_oDD.text , l_oDD.value);
            UCC(GE("Class").value);
		}
		GE("frmSearch").submit();
	}

	return;

}


//Get_Invaliddate_Msg(sDate)
function GIM(sD){var d,m,y,s,x,aD=DA(sD),aM = "January|February|March|April|May|June|July|August|September|October|November|December".split("|");m = aD[0]-1;d = aD[1];y = aD[2];x = rgMC[m];if(m==1){if(IsLeapYear(y)) x++;s = aM[m] + " has only " + x + " days in " + y + ".";}else s = "There are only " + x + " days in " + aM[m] + ".";return s;}
//Invalid_Date_Val(sDate)
function IDV(sD){var aD=DA(sD),d,m,y,x;m = aD[0]-1;d = aD[1];y = aD[2];x = rgMC[m];if(m==1 && IsLeapYear(y)) x++;return (d > x);}
//Date_Array(sDate)
function DA(d){return ((d+"/-1/-2")).split("/");}
//Validate_Date_Range(sDate1,sDate2,iMinDiff)
function VDR(sD1,sD2,iM){var oD1,oD2,sTmp;if(isNaN(iM)) iM=1;oD1=BuildDate(sD1);sTmp=oD1.getTime();oD1.setDate(oD1.getDate()+iM);oD2 = BuildDate(sD2);return(oD2.getTime() > oD1.getTime());}
//Validate_Date_Range(sDate1,sDate2,iMaxDiff)
function VDR2(sD1,sD2,iM){var oD1,oD2,sTmp;if(isNaN(iM)) iM=1;oD1=BuildDate(sD1);sTmp=oD1.getTime();oD1.setDate(oD1.getDate()+iM);oD2 = BuildDate(sD2);return(oD2.getTime() < oD1.getTime());}

//Match_Pattern(sToSearch,sPattern)
function MCP(sT,sP)
{
var re;
	switch(sP.toUpperCase())
	{
		case "TLA":
			re = /^[A-Z]{3}$/gi;
		break;
		case "0-9":
			re = /^\d$/g;
		break;
		case "01-99":
			re = /^\d\d$/g;
		break;
		case "Y||N":
			re = /^[Y|N]$/g;
		break;
		default:
			re = /.*/;
		break;
	}
	return re.test(sT);
}

//Update_Class_Cookie(sClass)
function UCC(sC)
{
    var oD = new Date;
    oD.setTime(oD.getTime() + (330*1000*60*60*24));
    document.cookie="originalclass="+sC+"; expires="+oD+"; path=/";
}

//Update_Departure_City(sName,sAircode)
function UDC(sNm,sA)
{

if(sA == -1 || sA.length != 3){return null;}

	var sC		= sNm+"="+sA;

	var l_sCk	= unescape(document.cookie);
	var oD		= new Date;
	oD.setTime(oD.getTime() + (330*1000*60*60*24));

	if(l_sCk.indexOf("depcityr3") != -1)
	{
		l_sCk = l_sCk.replace(/.*depcityr3[=]*/g,'');						//EXTRACT depcityr3 cookie info
        l_sCk = l_sCk.replace(/\n/g,'');
		l_sCk = l_sCk.replace(/\;.*/g,'');								//	 "				"

		l_sCk = l_sCk.replace(sC,"");									//REMOVE instance of current city

		if(l_sCk.indexOf("~")!=-1) l_sCk = l_sCk.replace(/~+/g,"~");	//REMOVE dup tildas
		else l_sCk += "~";

		var l_aCk = l_sCk.split("~");

		for(var i=0,j=0; i < l_aCk.length && j < 2; i++)
		{
			if(l_aCk[i]=="" || l_aCk[i].indexOf("=") == -1) continue;
			sC+= "~" + l_aCk[i];
			j++;
		}

	}
	document.cookie="depcityr3="+sC+"; expires="+oD+"; path=/";
}

//\\\FIXES IE floating drop-down bug when scrolling/resizing/////
var bScroll=false;
if(!bNS)
{

	document.body.onscroll=HSCRL;

	try
	{
		window.onresize=HSIZE;
	}
	catch(e)
	{
		//empty
	}
}

function HSCRL(){if(!bScroll){bScroll=true;setTimeout("FXWZ(1)",500);}}
function HSIZE(){if(!bScroll){bScroll=true;setTimeout("FXWZ(0)",10);}}

function FXWZ(iB)
{
	GE("frmWiz").style.display = 'none';
	GE("frmWiz").style.display = 'block';
	GE("frmWiz").style.top = 0;
	GE("frmWiz").style.left = 0;
	if(iB!=null)bScroll = false;
}
//1.0.2.8
