
function togglebookform() {
	if(document.getElementById('bookingform').style.display=='block') {
		document.getElementById('bookingform').style.display='none';
		document.getElementById('searchagainlink').className='searchagainlabelup';
	}
	else {
		document.getElementById('bookingform').style.display='block';
		document.getElementById('searchagainlink').className='searchagainlabeldown';
	}
}
	
function showdofields() {
				
	var displayval = 'table-row';
	
	//figure out if its IE6 or not and set display to block if it is
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 	if (ieversion>=6) {
	  		displayval = 'block';
		}
	}
	
	if (document.carform.diffdo.checked == true) {
		document.getElementById('doruleblock').style.display=displayval;
		document.getElementById('doctryblock').style.display=displayval;
		document.getElementById('docityblock').style.display=displayval;
	}
	else {
		document.getElementById('doruleblock').style.display='none';
		document.getElementById('doctryblock').style.display='none';
		document.getElementById('docityblock').style.display='none';
		
		//they've decided not to drop off in a different city, so set the dropoff fields back to the pickup values
		document.carform.docode.selectedIndex=document.carform.pucode.selectedIndex;
		ColdFusion.navigate('/car-citylist_cf.cfm?docode=' + document.carform.pucode.value + '&pucode=' + document.carform.pucode.value + '&docity=' + document.carform.pucity.value + '&listof=do','docity');
	}
	
}

function showtraveast() {
	
	var displayval = 'table';
	
	//figure out if its IE6 or not and set display to block if it is
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 	if (ieversion>=6) {
	  		displayval = 'block';
		}
	}
	
	if (document.getElementById('traveastnotes').style.display == 'none') {
		document.getElementById('traveastnotes').style.display=displayval;
	}
	else {
		document.getElementById('traveastnotes').style.display='none';
	}
	
}

function synccities () {
	if (document.carform.pucode.value == document.carform.docode.value) {
		var i=0;
		var len=document.carform.docity.length;
		while (i<=len) {
			if (document.carform.docity[i].value == document.carform.pucity.value) {
				document.carform.docity.selectedIndex=i;
				break;
			}
			i++;
		}
	}
}

function togglehours(hoursid) {
	
	label = hoursid + 'label';
	
	if (document.getElementById(hoursid).style.visibility!='visible') {
	
		document.getElementById(hoursid).style.visibility='visible';
		document.getElementById(hoursid).style.display='block';
		document.getElementById(label).className='bklochourslabeldown';
		
	}
	else {
	
		document.getElementById(hoursid).style.visibility='hidden';
		document.getElementById(hoursid).style.display='none';
		document.getElementById(label).className='bklochourslabelup';
	}
}


function clearpay(toClear) {
	if (toClear == 'debit') {
		// clear debit fields
		document.carformcheckout.ddname.value='';
		document.carformcheckout.ddaccount.value='';
		document.carformcheckout.ddbank.value='';
		}
	else {
		// clear credit fields
		document.carformcheckout.ccnum.value='';
		document.carformcheckout.cvc.value='';
		document.carformcheckout.ccholder.value='';
		}
	}


function showstate() {
	thisChoice = document.carformcheckout.billcountry.selectedIndex;
	
	if (document.carformcheckout.billcountry[thisChoice].value == 'US'|document.carformcheckout.billcountry[thisChoice].value == 'CA') {
		document.getElementById('eurostate').style.visibility='visible';
		document.getElementById('eurostate').style.height='45px';
		document.getElementById('eurostate').style.margin='11px 0px';
		}
	else {
		document.getElementById('eurostate').style.visibility='hidden';
		document.getElementById('eurostate').style.height='0px';
		document.getElementById('eurostate').style.margin='0';
		}
	}


function checklocs() {
	if	(document.carform.puloc & document.carform.doloc) {
		if (typeof(document.carform.puloc.length) == "undefined") document.carform.puloc.click(); // length attributed doesn't work if only 1 item in radio group
		if (typeof(document.carform.doloc.length) == "undefined") document.carform.doloc.click();
	}
}

//legacy pop-up handler
function openWindow(url, name) {
  popupWin = window.open(url, name, 'menubar,scrollbars,resizable,width=325,height=460,left=0,top=0')
}

//legacy pop-up handler
function openProdWindow(url, name, wide, high) {
  popupWin = window.open(url, name, 'menubar,scrollbars,resizable,width='+wide+',height='+high+',left=0,top=0')
}

//auto select drop-off location if possible
function seldoloc(dolocid) {
	if (document.getElementById(dolocid) != null) {
		document.getElementById(dolocid).checked = true;
	}
}

