                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
// used to swap images at top of orbot
function switchImage (imgName, imgSrc) {
	if (document.images) {
		if (imgSrc != "none") {
			document.images[imgName].src = imgSrc;
		}
	}
}

function changeViz (prop,id) {
	if (prop=="show") {
		if (document.layers) document.layers['morbot'].layers[''+id+''].visibility = "show"
		else if (document.all) document.all[''+id+''].style.visibility = "visible"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
	}
	if (prop=="hide") {
		if (document.layers) document.layers['morbot'].layers[''+id+''].visibility = "hide"
		else if (document.all) document.all[''+id+''].style.visibility = "hidden"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
	}
}

function submitFullSearchOption () {
	//if (document.layers){document.layers['morbot'].document.layers['air'].document.airOrbot.fullSearchOptionHidden.value}
	if (document.layers) {self.location='/App/ViewRoundTripSearch';} //netscape can't submit the form for some bizarre reason
	else {document.airOrbot.fullSearchOptionHidden.value='pressed';submitAir();}
		
}

function resetAll () {
	switchImage('morbot1','/d.gif');
	switchImage('morbot2','/img/global/nav/tab_flights_morbot.gif');
	switchImage('morbot3','/d.gif');
	switchImage('morbot4','/img/global/nav/tab_hotels_morbot.gif');
	switchImage('morbot5','/d.gif');
	switchImage('morbot6','/img/global/nav/tab_cars_morbot.gif');
	switchImage('morbot7','/d.gif');
	changeViz("hide","air");
	changeViz("hide","hotel");
	changeViz("hide","car");
	if(isDynamicPackage){changeViz("hide","dp_air_only");document.dpOrbot.flight_hotel.checked=true;document.dpOrbot.flight.checked=false;}
	}	

var areLayersPossible = ((is_ie4up && is_mac) || (is_nav4up && is_mac) || (is_ie4up && is_win) || (is_nav6 && is_mac) || (is_nav6 && is_win) || (is_ie5up && is_win));

function switchTab (n) {
	var divName, tabName, newLocation;
	switch (n) {
		case 1: divName="air";tabName="flight";break;
		case 2: divName=tabName="hotel";newLocation="/App/ViewHotelSearch";break;
		case 3: divName=tabName="car";newLocation="/App/DisplayCarSearch";break;
	}

	whichTab = n;
	if (areLayersPossible) {
		resetAll();
		changeViz("show",divName);
		switchImage('morbot'+((n*2)-1),'/img/global/nav/tab_on_left.gif');
		switchImage('morbot'+(n*2),'/img/global/nav/tab_'+tabName+'s_on.gif');
		switchImage('morbot'+((n*2)+1),'/img/global/nav/tab_on_right.gif');
		// maybe put something here to remove focus from tab image once it's clicked.
	} else if (n==2 || n==3) {
		self.location=newLocation;
	}
	setGlobals(n);
}

//what's this used for?
function clearFromTo (form) {
	form.elements["slice1:departCity"].value='';
	form.elements["slice1:arriveCity"].value='';
}

if (areLayersPossible) {
	document.onkeypress = tellKey;
}

var whichTab = 1;

function tellKey () {
	theKey = window.event.keyCode;
	if(theKey==13){
		if(whichTab==2){submitHotel();}
		if(whichTab==3){submitCar();}
	}
}

function submitAir () {
	if (document.layers) {
		document.layers['morbot'].document.layers['air'].document.airOrbot.submit();
	} else {
		document.airOrbot.submit();
	}
}

function submitHotel () {
	document.hotelOrbot.submit();
}

function submitCar () {
	document.carOrbot.submit();
}

//function resetSubmit(){airSubmit=0;hotelSubmit=0;carSubmit=0;}
//no longer needed

//BCL 6.20.02

/*
function leapYear(year) {
	if (year % 4 == 0) {return true}
	else {return false}
}

//use global array and variables.
var months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var now = new Date();
var day = now.getDate();
var month = now.getMonth();
var year  = now.getYear();
if(year<1000) {year+=1900;}
var endYear=year+=1;
var selectMonth=month;
var selectStartMonth=month;
var nextMonth=month;
var startDay=day+7;
var endDay=day+8;
var done=true;

if ((months[month]=="Apr")||(months[month]=="Jun")||(months[month]=="Sep")||(months[month]=="Nov")) {
	numDays=30;
} else {
	numDays=31;
}

if (months[month]=="Feb") {
	numDays=((leapYear(year)) ? 29 : 28)
}

if (startDay!=numDays){
	if (startDay>numDays){
		nextMonth=++month;
		selectMonth=nextMonth;
		startDay=(startDay-numDays);
		endDay=(endDay-numDays);
		selectStartMonth=++selectStartMonth;
		if (selectMonth == 12) { selectMonth = 0}
		done=0;
	}
	if (done){
		if (endDay>numDays){
			selectMonth=++selectMonth;
			selectStartMonth=nextMonth;
			endDay=(endDay-numDays);
		}
	}
} else {
	selectMonth=++selectMonth;
	endDay=(endDay-numDays);
}
*/
