//this page is used to set up general functions used through out the search boxes and WCT pages. 

//used to switch the class of elements on the fly.
function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

// used to hide and show elements. 
function show(idLayer) { document.getElementById(idLayer).style.display='block'; }
function showInline(idLayer) { document.getElementById(idLayer).style.display='inline'; }
function hide(idLayer) { document.getElementById(idLayer).style.display='none'; }

//Children selector.
function displayages(childobj)
{
if (childobj.options[0].selected){hide('children_box'); hide('minorAge1'); hide('minorAge2'); hide('minorAge3'); hide('minorAge4');}
if (childobj.options[1].selected){show('children_box'); showInline('minorAge1'); hide('minorAge2'); hide('minorAge3'); hide('minorAge4');}
if (childobj.options[2].selected){show('children_box'); showInline('minorAge1'); showInline('minorAge2'); hide('minorAge3'); hide('minorAge4');}
if (childobj.options[3].selected){show('children_box'); showInline('minorAge1'); showInline('minorAge2'); showInline('minorAge3'); hide('minorAge4');}
if (childobj.options[4].selected){ show('children_box'); showInline('minorAge1'); showInline('minorAge2'); showInline('minorAge3'); showInline('minorAge4');}
}


function verifyForm(strID)
{
	var blnPass = false;
	var objF = document.getElementById(strID);
	if(objF.chk_in.value=="mm/dd/yyyy"||objF.chk_in.value=="")
	{
		alert("Please select a check in date.");
		objF.chk_in.focus();
	}
	else if(objF.chk_out.value=="mm/dd/yyyy"||objF.chk_out.value=="")
	{
		alert("Please select a check out date.");
		objF.chk_out.focus();
	}
	else
	{
		if(strID=="airHotelSearch")
		{
			
			if(objF.leavingFrom.value=="")
			{
				alert("Please enter the city you are leaving from.");
				objF.leavingFrom.focus();
			}
			else if(objF.goingTo.value=="")
			{
				alert("Please enter the city you are going to.");
				objF.goingTo.focus();
			}
			else
			{
				objF.dateLeavingMonth.value = objF.doa_mm.value;
				objF.dateLeavingDay.value = objF.doa_dd.value;
				objF.dateReturningMonth.value = objF.dod_mm.value;
				objF.dateReturningDay.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else if(strID=="CarSearch")
		{
			if(objF.pucity.value=="")
			{
				alert("Please enter the pick-up city.");
				objF.pucity.focus();
			}
			else if(objF.docity.value=="")
			{
				alert("Please enter the drop-off city.");
				objF.docity.focus();
			}
			else
			{
				objF.pudate_mo.value = objF.doa_mm.value;
				objF.pudate_dy.value = objF.doa_dd.value;
				objF.dodate_mo.value = objF.dod_mm.value;
				objF.dodate_dy.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else
			blnPass = true;
	}
	return blnPass;
	
}