	/* Copyright Grovelawn 2002-2007 */
function jump( id ) {
	var ln=id.options[id.selectedIndex].value;
	if( ''!=ln ) window.location='http://www.airport-parking-deals.com/' + ln + 'airportparking.html';
}
var AP_USA=[
	'ALB>Albany (ALB)','ABQ>Albuquerque (ABQ)','ANC>Anchorage (ANC)','ATL>Atlanta (ATL)','AUS>Austin (AUS)',
	'BWI>Baltimore (BWI)','BHM>Birmingham (BHM)','BOS>Boston (BOS)','BUF>Buffalo (BUF)','BUR>Burbank (BUR)','BTV>Burlington (BTV)',
	'CHS>Charleston (CHS)','CLT>Charlotte (CLT)','CHA>Chattanooga (CHA)','ORD>Chicago (ORD)','MDW>Chicago-Midway (MDW)','CVG>Cincinnati (CVG)','CLE>Cleveland (CLE)','CLL>College Station (CLL)','CMH>Columbus (CMH)',
	'DFW>Dallas (DFW)','DAY>Dayton (DAY)','DEN>Denver (DEN)','DSM>Des Moines (DSM)','DTW>Detroit (DTW)',
	'ELP>El Paso (ELP)','FNT>Flint (FNT)','FLL>Fort Lauderdale (FLL)','RSW>Fort Myers (RSW)',
	'BDL>Hartford (BDL)','HNL>Honolulu (HNL)','IAH>Houston (IAH)','HOU>Houston Hobby (HOU)',
	'IND>Indianapolis (IND)','JAX>Jacksonville (JAX)','KCI>Kansas City (KCI)','TRI>Kingsport (TRI)',
	'LAS>Las Vegas (LAS)','ABE>Lehigh Valley (ABE)','LIT>Little Rock (LIT)','LAX>Los Angeles (LAX)','SDF>Louisville (SDF)',
	'MHT>Manchester (MHT)','MEM>Memphis (MEM)','MIA>Miami (MIA)','MKE>Milwaukee (MKE)','MSP>Minn. St. Paul (MSP)',
	'BNA>Nashville (BNA)','MSY>New Orleans (MSY)','LGA>New York (LGA)','JFK>New York (JFK)','EWR>Newark (EWR)','ORF>Norfolk (ORF)',
	'OAK>Oakland (OAK)','OKC>Oklahoma City (OKC)','OMA>Omaha (OMA)','ONT>Ontario (ONT)','SNA>Orange County (SNA)','MCO>Orlando (MCO)',
	'PHL>Philadelphia (PHL)','PHX>Phoenix (PHX)','PIT>Pittsburgh (PIT)','PDX>Portland (PDX)','PVD>Providence (PVD)',
	'RDU>Raleigh-Durham (RDU)','RNO>Reno (RNO)','RIC>Richmond (RIC)',
	'SMF>Sacramento (SMF)','SLC>Salt Lake City (SLC)','SAT>San Antonio (SAT)','SAN>San Diego (SAN)','SFO>San Francisco (SFO)','SJC>San Jose (SJC)','SEA>Seattle (SEA)','GEG>Spokane (GEG)',
	'SGF>Springfield (SGF)','STL>St. Louis (STL)','PIE>St. Petersburg (PIE)','SYR>Syracuse (SYR)',
	'TPA>Tampa (TPA)','TOL>Toledo (TOL)','YYZ>Toronto (YYZ/Canada)','TUS>Tucson (TUS)','TUL>Tulsa (TUL)',
	'YVR>Vancouver (YVR/Canada)','DCA>Washington DC (DCA)','IAD>Washington Dulles (IAD)'
];
var AP_UK=[
	'ABZ>Aberdeen (ABZ)','BFS>Belfast (BFS)','BHX>Birmingham (BHX)','BLK>Blackpool (BLK)','BRS>Bristol (BRS)',
	'CWL>Cardiff (CWL)','CVT>Coventry (CVT)','DSA>Doncaster / Robin Hood (DSA)','DOV>Dover Port (DOV)','MME>Durham Valley / Teesside (MME)',
	'EMA>East Midlands / Nottingham (EMA)','EDI>Edinburgh (EDI)','EXT>Exeter (EXT)','FOL>Folkestone / EuroTunnel (FOL)',
	'LGW>Gatwick / London (LGW)','GLA>Glasgow (GLA)','LHR>Heathrow / London (LHR)','HUY>Humberside / Kirmington (HUY)',
	'LBA>Leeds Bradford (LBA)','LPL>Liverpool / John Lennon (LPL)','LCY>London City (LCY)','LTN>Luton (LTN)',
	'MAN>Manchester (MAN)','NCL>Newcastle (NCL)','PIK>Prestwick / Glasgow (PIK)','SOU>Southampton (SOU)','STN>Stansted / London (STN)','WTU>Waterloo Station (London) (WTU)'
];
function generateAirports(a,l){
	var n; var x=''; for( n=0; n<l.length; ++n ) x += '<option value='+l[n];
	return '<select name=' + a + ' id=' + a + '>' + ( x.replace( '<option value=JFK>', '<option selected value=JFK>' ) ) + '</select>';
}
function generateTimeSelect(a,i){
	var n; var m; var t='';	for( m=0; m<60; m+=i )	t += '<option value=00' + ( 10>m ? '0'+m+'>12:0'+m+'am' : m+'am>12:'+m+'am' );
	for( n=1; n<10; ++n )	for( m=0; m<60; m+=i )	t += '<option value=0' + (n*100+m) + ( 10>m ? '>'+n+':0'+m+'am' : 'am>'+n+':'+m+'am' );
	for( n=10; n<12; ++n )	for( m=0; m<60; m+=i )	t += '<option value=' + (n*100+m) + ( 10>m ? 'am>'+n+':0'+m+'am' : 'am>'+n+':'+m+'am' );
	n=12;			for( m=0; m<60; m+=i )	t += ( 12==n&&0==m ? '<option selected value=' : '<option value=' ) + (n*100+m) + ( 10>m ? 'pm>'+n+':0'+m+'pm' : 'pm>'+n+':'+m+'pm' );
	for( n=1; n<12; ++n )	for( m=0; m<60; m+=i )	t += '<option value=' + ((12+n)*100+m) + ( 10>m ? '>'+n+':0'+m+'pm' : 'pm>'+n+':'+m+'pm' );
	return '<select name=' + a + ' id=' + a + '>' + t + '</select>';	
}
function generateDateSelect(a1,a2,a3){
	var d=new Date; var y=2000+d.getYear() % 100; var m=1+d.getMonth(); var n; var tm=''; var td=''; var mn=['','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
	for( n=1; n<13; ++n ) { tm += ( n==m ? '<option selected value='+n+'>' : '<option value='+n+'>' ) + mn[n]; }
	for( n=1; n<32; ++n ) { td += ( n==d.getDate() ? '<option selected value='+n+'>' : '<option value='+n+'>' ) + n; }
	return	'<select name=' + a2 + ' id=' + a2 + '>' + tm + '</select><select name=' + a1 + ' id=' + a1 + '>' + td + '</select><select name=' + a3 + ' id=' + a3 + '><option selected value=' + y + '>' + y + '<option value=' + (1+y) + '>' + (1+y) + '</select>';
}
function country(s,m){
	var l = ( 'uk'==m ? AP_UK : AP_USA ); var n; var x; s.options.length = 0;
	for( n=0; n<l.length; ++n ) { x = l[n].split('>'); s.options[s.length] = new Option( x[1], x[0] ); }
	return true;
}
function checkParking( f ) {
	var t=new Date; var e=''; var m=[0,31,29,31,30,31,30,31,31,30,31,30,31];
	var ct=t.getHours()*100+t.getMinutes(); var cd=t.getDate(); var cm=t.getMonth()+1; var cy=2000+(t.getYear()%100); var cx=cm+'/'+cd+'/'+cy+' '+(t.getHours())+':'+(t.getMinutes());
	var at=f.uat.options[f.uat.selectedIndex].value-0; var ad=f.uad.options[f.uad.selectedIndex].value-0; var am=f.uam.options[f.uam.selectedIndex].value-0; var ay=f.uay.options[f.uay.selectedIndex].value-0;
	var rt=f.urt.options[f.urt.selectedIndex].value-0; var rd=f.urd.options[f.urd.selectedIndex].value-0; var rm=f.urm.options[f.urm.selectedIndex].value-0; var ry=f.ury.options[f.ury.selectedIndex].value-0;
	if( cy==ay && cm==am && cd==ad && ct>at )				{ f.uat.focus(); e += '\nYour arrival time is is in the past.\n(Your computer\'s clock reports today is '+cx+'.)'; }
	else if( ( cy==ay && cm==am && cd>ad ) || ( cy==ay && cm>am ) || cy>ay ){ f.uat.focus(); e += '\nYour return date is before your arrival date.\n(Your computer\'s clock reports today is '+cx+'.)'; }
	else if( ay==ry && am==rm && ad==rd && at>rt )				{ f.uat.focus(); e += '\nYour return time is before your arrival time.'; }
	else if( ( ay==ry && am==rm && ad>rd ) || ( ay==ry && am>rm ) || ay>ry ){ f.uat.focus(); e += '\nYour return date is before your arrival date.'; }
	if( ''==f.uap.options[f.uap.selectedIndex].value ) { f.uap.focus(); e = e + '\nYou have not specified airport.'; }
	if( ''==e ) { return true; } else { alert( 'Sorry, there appears to be an error.\n' + e ); return false; }
}
function includeUSParkingForm( f ) {
	var x =	'<div class=line><label for=uap>Airport:</label>' + generateAirports('uap',AP_USA) + '<br></div>';
	x +=	'<div class=linec><input type=radio name=ucc checked id=ucca value=a onclick="country(this.form.uap,\'usa\')"><label for=ucca>USA &amp; Canada</label> <input type=radio name=ucc id=ucce value=e onclick="country(this.form.uap,\'uk\')"><label for=ucce>UK</label><br></div>';
	x +=	'<div class=line><label for=uad>Arrive:</label>' + generateDateSelect('uad','uam','uay') + ' at ' + generateTimeSelect('uat',15) + '<br></div>';
	x +=	'<div class=line><label for=urd>Return:</label>' + generateDateSelect('urd','urm','ury') + ' at ' + generateTimeSelect('urt',15) + '<br></div>';
	x +=	'<div class=linec><input type=submit id=ubk value="Book Airport Parking" onclick="return checkParking(this.form)"></div>';
	if( f ) f.innerHTML='<form action="/scripts/park.php">' + x + '</form>';
}
window.onload = function() {
	if( document.getElementById && document.getElementById('form') ) includeUSParkingForm( document.getElementById('form') );
	if( document.getElementById && document.getElementById('uap') ) document.getElementById('uap').focus();
}

