/**********************************************************************************************************
* Miscellaneous Scripts
***********************************************************************************************************/

//The following line supports the email popup option to get emails from our visitors
/*
Please check CQDB00002465

*/

/*if (typeof __loaded == "undefined"){
   var thisContext = "";
   if (location.pathname ){
  
	   var intIndex = location.pathname.length > 1 ?location.pathname.indexOf("/",1):1;
	   thisContext = location.pathname.substr(0,intIndex != -1?intIndex:1);
   }
   if (thisContext != "" )
   
	   //document.write("<SCRIPT type='text/javascript' src='"+(thisContext != "/"?thisContext:"")+"/emailPopup.do?command=showEmailScript' language='JavaScript'> </SCRIPT>");	   
   else
   	   //document.write("<script language='javascript'>function doEmailPopup() {} function triggerPopup(bValue){}</script>");
   	 
}
*/
var __loaded ="val";

// Return the last 4 (2 for IE and 2 for Netscape) parameters to open the popup on the middle of the screen
function getXYPopUpParams(width, height) {
	var screenX = 0, screenY = 0;
	if (parseInt(navigator.appVersion)>3) {
	  screenX = (screen.width-width)/2;
	  screenY = (screen.height-height)/2-10;
	} else if (navigator.appName == "Netscape"
			&& parseInt(navigator.appVersion)==3
			&& navigator.javaEnabled())
	{
	  var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	  var jScreenSize = jToolkit.getScreenSize();
	  screenX = (jScreenSize.width-width)/2;
	  screenY = (jScreenSize.height-height)/2-10;
	}
	return 'left='+screenX+',top='+screenY + ',screenX='+screenX+',screenY='+screenY;
}

// popup window (full) - all window elements are enabled
function popUpFull(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=' + width + ',height=' + height + ','+getXYPopUpParams(width, height));
	wndHndl.focus();
}

// popup window (limited) - only scrollbars and window resizing are enabled
function popUpLimited(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height + ','+getXYPopUpParams(width, height));
	wndHndl.focus();
}

// popup window (modal) - all window elements are disabled
function popUpModal(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ','+getXYPopUpParams(width, height));
	wndHndl.focus();
}

// popup message box
var str_message
function popUpMessage(message, width, height, context) {
	// save message - it will be retrieved by the child popup window
	str_message = message;
	// open modal popup window
	popUpModal(context + "/site/common/message_box.jsp", width, height);
}

// popup apple ratings key
function popUpAppleRatings(context) {
	popUpLimited(context + "/site/common/apple_ratings.jsp", 400, 400);
}


/**********************************************************************************************************
* Calendar Popup
***********************************************************************************************************/

function cal_popup2 (context, str_datetime) {
	if (document.getElementById("date_return_mm")[document.getElementById("date_return_mm").selectedIndex].value == '') {
		document.getElementById("date_return_mm").selectedIndex = document.getElementById("date_depart_mm").selectedIndex;
	}
	if (document.getElementById("date_return_dd")[document.getElementById("date_return_dd").selectedIndex].value == '') {
		document.getElementById("date_return_dd").selectedIndex = document.getElementById("date_depart_dd").selectedIndex;
	}
	if (document.getElementById("date_return_yy")[document.getElementById("date_return_yy").selectedIndex].value == '') {
		document.getElementById("date_return_yy").selectedIndex = document.getElementById("date_depart_yy").selectedIndex;
	}

	this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.compose_date());
	if (!this.dt_current) return;

	var obj_calwindow = window.open(
		context + '/site/common/calendar.jsp?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
		'Calendar', 'width=200,height='+(this.time_comp ? 215 : 190)+
		',status=no,resizable=no,top=150,left=350,dependent=yes,alwaysRaised=yes'
	);
	obj_calwindow.opener = window;
	obj_calwindow.focus();
}
//Added by Srilakshmi for CQ5426-RentalCar
function cal_popup3(context,str_datetime) {
        if (document.getElementById("dropOffDate").value == '') {
			document.getElementById("dropOffDate").value = document.getElementById("pickUpDate").value;
		}
		
		this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
		if (!this.dt_current) return;
	    var obj_calwindow = window.open(
		context + '/site/search/calendar.jsp?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
		'Calendar', 'width=200,height='+(this.time_comp ? 215 : 190)+
		',status=no,resizable=no,top=150,left=350,dependent=yes,alwaysRaised=yes'
	    );
	    obj_calwindow.opener = window;
		obj_calwindow.focus();
	}
    


function point(top, left) {
	this.top = top;
	this.left = left;
}

// if two digit year input dates after this year considered 20 century.
var NUM_CENTYEAR = 30;
// is time input control required by default
var BUL_TIMECOMPONENT = false;
// are year scrolling buttons required by default
var BUL_YEARSCROLL = true;


var calendars = typeof calendars == "undefined"?[]:calendars;
var RE_NUM = /^\-?\d+$/;
//Added by Srilakshmi for CQ5426-RentalCar
function calendar3(obj_target, point, ind) {



	// assing methods
	this.gen_date = cal_gen_date2;
	this.gen_time = cal_gen_time2;
	this.gen_tsmp = cal_gen_tsmp2;
	this.prs_date = cal_prs_date2;
	this.prs_time = cal_prs_time2;
	this.prs_tsmp = cal_prs_tsmp2;
	this.popup    = cal_popup3;
	this.top = point.top;
	this.left = point.left;
    this.flag = ind;
    
	//this.depdate = dmonth+"/"+dday+"/"+dyear;
	//this.retdate = rmonth+"/"+rday+"/"+ryear;
	// validate input parameters
	if (!obj_target)
		return cal_error("Error calling the calendar: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the calendar: parameter specified is not valid tardet control");
	this.target = obj_target;
	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}

function calendar2(obj_target_mm, obj_target_dd, obj_target_yy, point) {

	// assing methods
	this.gen_date = cal_gen_date2;
	this.gen_time = cal_gen_time2;
	this.gen_tsmp = cal_gen_tsmp2;
	this.prs_date = cal_prs_date2;
	this.prs_time = cal_prs_time2;
	this.prs_tsmp = cal_prs_tsmp2;
	this.popup    = cal_popup2;
	this.compose_date    = compose_date;
	this.top = point.top;
	this.left = point.left;

	// validate input parameters
	if (!obj_target_mm || !obj_target_dd || !obj_target_yy)
		return cal_error("Error calling the calendar: no target control specified");

	if (obj_target_mm.selectedIndex == null || obj_target_dd.selectedIndex == null || obj_target_yy.selectedIndex == null)
		return cal_error("Error calling the calendar: parameter specified is not valid target control");

	this.target_mm = obj_target_mm;
	this.target_dd = obj_target_dd;
	this.target_yy = obj_target_yy;

	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}

// timestamp generating function
function cal_gen_tsmp2 (dt_datetime) {
	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
}

// date generating function
function cal_gen_date2 (dt_datetime) {
	return (
		(dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "/"
		+ (dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "/"
		+ dt_datetime.getFullYear()
	);
}
// time generating function
function cal_gen_time2 (dt_datetime) {
	return (
		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"
		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":"
		+ (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds())
	);
}

// timestamp parsing function
function cal_prs_tsmp2 (str_datetime) {
	// if no parameter specified return current timestamp
	if (!str_datetime)
		return (new Date());

	// if positive integer treat as milliseconds from epoch
	if (RE_NUM.exec(str_datetime))
		return new Date(str_datetime);
		
	// else treat as date in string format
	var arr_datetime = str_datetime.split(' ');
	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));
}

// get date string from date triad
function compose_date () {
	
	if (this.target_mm.selectedIndex == 0 || this.target_dd.selectedIndex == 0 || this.target_yy.selectedIndex == 0) return("");
	else return(this.target_mm[this.target_mm.selectedIndex].value + "/" + this.target_dd[this.target_dd.selectedIndex].value + "/" +  this.target_yy[this.target_yy.selectedIndex].value);

}

// date parsing function
function cal_prs_date2 (str_date) {

	var arr_date = str_date.split('/');

	if (arr_date.length == 2) {
		// user forgot to type year - provide today's year
		dtToday = new Date();
		str_date_corrected = str_date + "/" + dtToday.getYear();
		arr_date = str_date_corrected.split('/');	
	}
	if (arr_date.length != 3) return alert ("Invalid date format: '" + str_date + "'.\nFormat accepted is dd-mm-yyyy.");
	if (!arr_date[1]) return alert ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");
	if (!RE_NUM.exec(arr_date[1])) return alert ("Invalid day of month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[0]) return alert ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");
	if (!RE_NUM.exec(arr_date[0])) return alert ("Invalid month value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[2]) return alert ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");
	if (!RE_NUM.exec(arr_date[2])) return alert ("Invalid year value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");

	var dt_date = new Date();
	dt_date.setDate(1);

	if (arr_date[0] < 1 || arr_date[0] > 12) return alert ("Invalid month value: '" + arr_date[0] + "'.\nAllowed range is 01-12.");
	dt_date.setMonth(arr_date[0]-1);
	 
	if (arr_date[2] < 100) arr_date[2] = Number(arr_date[2]) + (arr_date[2] < NUM_CENTYEAR ? 2000 : 1900);
	dt_date.setFullYear(arr_date[2]);

	var dt_numdays = new Date(arr_date[2], arr_date[0], 0);
	dt_date.setDate(arr_date[1]);
	if (dt_date.getMonth() != (arr_date[0]-1)) return alert ("Invalid day of month value: '" + arr_date[1] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");

	return (dt_date)
}

// time parsing function
function cal_prs_time2 (str_time, dt_date) {

	if (!dt_date) return null;
	var arr_time = String(str_time ? str_time : '').split(':');

	if (!arr_time[0]) dt_date.setHours(0);
	else if (RE_NUM.exec(arr_time[0])) 
		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);
		else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23.");
	else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers.");
	
	if (!arr_time[1]) dt_date.setMinutes(0);
	else if (RE_NUM.exec(arr_time[1]))
		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
		else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");

	if (!arr_time[2]) dt_date.setSeconds(0);
	else if (RE_NUM.exec(arr_time[2]))
		if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]);
		else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers.");

	dt_date.setMilliseconds(0);
	return dt_date;
}

function cal_error (str_message) {
	alert (str_message);
	return null;
}

/**********************************************************************************************************
* Dropdown menu system
***********************************************************************************************************/

ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 250
ypSlideOutMenu.hideDelay = 500
ypSlideOutMenu.minCPUResolution = 10
// constructor

function menuHover(cell, hover) {
	if (hover == true) {
		bgcolor = "#C8DFF2";
		color="#286DB2"
	} else {
		bgcolor = "";
		color="#000000";
	}
	cell.style.backgroundColor = bgcolor;
	cell.style.color = color;
	prev = cell.previousSibling;
	while (prev != null) {
		prev.style.backgroundColor = bgcolor;
		prev.style.color = color;
		prev = prev.previousSibling;
	}
	next = cell.nextSibling;
	while (next != null) {
		next.style.backgroundColor = bgcolor;
		next.style.color = color;
		next = next.nextSibling;
	}
}

function ypSlideOutMenu(id, dir, left, top, width, height)
{
this.ie = document.all ? 1 : 0
this.ns4 = document.layers ? 1 : 0
this.dom = document.getElementById ? 1 : 0
if (this.ie || this.ns4 || this.dom) {
this.id = id
this.dir = dir
this.orientation = dir == "left" || dir == "right" ? "h" : "v"
this.dirType = dir == "right" || dir == "down" ? "-" : "+"
this.dim = this.orientation == "h" ? width : height
this.hideTimer = false
this.aniTimer = false
this.open = false
this.over = false
this.startTime = 0
this.gRef = "ypSlideOutMenu_"+id
eval(this.gRef+"=this")
ypSlideOutMenu.Registry[id] = this
var d = document
var strCSS = "";
strCSS += '#' + this.id + 'Container { visibility:hidden; '
strCSS += 'left:' + (left) + 'px; '
strCSS += 'top:' + (top - 5) + 'px; '
strCSS += 'overflow:hidden; z-index:10000; }'
strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
strCSS += 'width:' + width + 'px; '
strCSS += 'height:' + height + 'px; '
strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
strCSS += '}'
this.css = strCSS;
this.load()
}
}
ypSlideOutMenu.writeCSS = function() {
document.writeln('<style type="text/css">');
for (var id in ypSlideOutMenu.Registry) {
document.writeln(ypSlideOutMenu.Registry[id].css);
}
document.writeln('</style>');
}
ypSlideOutMenu.prototype.load = function() {
var d = document
var lyrId1 = this.id + "Container"
var lyrId2 = this.id + "Content"
var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
var temp
if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
else {
this.container = obj1
this.menu = obj2
this.style = this.ns4 ? this.menu : this.menu.style
this.homePos = eval("0" + this.dirType + this.dim)
this.outPos = 0
this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
// set event handlers.
if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
//set initial state
this.endSlide()
}
}
var DELAY_START = 100;
var pending = null;
ypSlideOutMenu.showMenu = function(id)
{
pending = id;
var reg = ypSlideOutMenu.Registry
var obj = ypSlideOutMenu.Registry[id]
if (obj.container) {
obj.over = true
for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu)
if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
}
window.setTimeout("ypSlideOutMenu.showMenuStart('" + id + "')", DELAY_START);
}
ypSlideOutMenu.showMenuStart = function(id)
{
if (pending == id) {
var reg = ypSlideOutMenu.Registry
var obj = ypSlideOutMenu.Registry[id]
if (obj.container) {
if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
}
hideSelects(true);
}
}
ypSlideOutMenu.hideMenu = function(id)
{
pending = null;
var obj = ypSlideOutMenu.Registry[id]
if (obj.container) {
if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
}
}
ypSlideOutMenu.hideAll = function()
{
var reg = ypSlideOutMenu.Registry
for (menu in reg) {
ypSlideOutMenu.hide(menu);
if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
}
}
ypSlideOutMenu.hide = function(id)
{
var obj = ypSlideOutMenu.Registry[id]
obj.over = false
if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
obj.hideTimer = 0
if (obj.open && !obj.aniTimer) obj.startSlide(false)
hideSelects(false);
}
ypSlideOutMenu.prototype.startSlide = function(open) {
this[open ? "onactivate" : "ondeactivate"]()
this.open = open
if (open) this.setVisibility(true)
this.startTime = (new Date()).getTime() 
this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}
ypSlideOutMenu.prototype.slide = function() {
var elapsed = (new Date()).getTime() - this.startTime
if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
else {
var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
if (this.open && this.dirType == "-") d = -d
else if (this.open && this.dirType == "+") d = -d
else if (!this.open && this.dirType == "-") d = -this.dim + d
else d = this.dim + d
this.moveTo(d)
}
}
ypSlideOutMenu.prototype.endSlide = function() {
this.aniTimer = window.clearTimeout(this.aniTimer)
this.moveTo(this.open ? this.outPos : this.homePos)
if (!this.open) this.setVisibility(false)
if ((this.open && !this.over) || (!this.open && this.over)) {
this.startSlide(this.over)
}
}
ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
var s = this.ns4 ? this.container : this.container.style
s.visibility = bShow ? "visible" : "hidden"
}
ypSlideOutMenu.prototype.moveTo = function(p) { 
this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
ypSlideOutMenu.prototype.getPos = function(c) {
return parseInt(this.style[c])
}
ypSlideOutMenu.prototype.onactivate = function() { }
ypSlideOutMenu.prototype.ondeactivate = function() { }

function hideSelects(show) {
	if(!(isDHTML||is_ie||is_nav4up)) return true;

	if(is_nav4up) return true;

	var ElementsToToggle = [];
	ElementsToToggle = (isDHTML) ? document.getElementsByTagName("select") : document.all.tags("select");

	for(var j=0; j<ElementsToToggle.length; j++) {
		var theElement = ElementsToToggle[j];
		if(!theElement) continue;
		if(isDHTML||is_ie) {
			// hide only dropdowns with class of "hideDropdown"
			elementClass = theElement.className;
			if (elementClass.indexOf("hideDropdown") != -1) {
				theElement.style.visibility = show ? "hidden" : "inherit";
			}
		}
	}
	return true;
}




/**********************************************************************************************************
* Browser client sniff variables
***********************************************************************************************************/

var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
var is_nav5 = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));

var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);

var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);

var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);

// *** PLATFORM ***
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
var is_win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) );  

var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1));

var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
var is_win32 = (is_win95 || is_winnt || is_win98 || ((is_major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

var is_os2   = ((agt.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1));

var is_mac    = (agt.indexOf("mac")!=-1);
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1)));

var is_sun   = (agt.indexOf("sunos")!=-1);
var is_sun4  = (agt.indexOf("sunos 4")!=-1);
var is_sun5  = (agt.indexOf("sunos 5")!=-1);
var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
var is_irix5 = (agt.indexOf("irix 5") !=-1);
var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
var is_hpux  = (agt.indexOf("hp-ux")!=-1);
var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
var is_aix1  = (agt.indexOf("aix 1") !=-1);    
var is_aix2  = (agt.indexOf("aix 2") !=-1);    
var is_aix3  = (agt.indexOf("aix 3") !=-1);    
var is_aix4  = (agt.indexOf("aix 4") !=-1);    
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
var is_mpras    = (agt.indexOf("ncr")!=-1); 
var is_reliant  = (agt.indexOf("reliantunix")!=-1);
var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || is_sco ||is_unixware || is_mpras || is_reliant || is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

var isDHTML = (is_nav4up  || is_ie4up) ? 1 : 0;

// if we want to redirect users if they do not have DHTML, do it below
// if (!isDHTML) top.document.location.href = "#upgradebrowserhtmlhere";


/**********************************************************************************************************
* Search related js
***********************************************************************************************************/

function doDisplayWaitMessage()
{
	// hide the main content area
	divContent = document.getElementById("div_content");
	if (divContent != null) {
		divContent.style.display = "none";
	}
	// display the please wait message
	divWait = document.getElementById("div_wait");
	if (divWait != null) {
		divWait.style.display = "inline";
	}
}

function doDisplayDoNotResubmitMessage()
{
	// hide the main content area
	divContent = document.getElementById("div_content");
	if (divContent != null) {
		divContent.style.display = "none";
	}
	// display the do not resubmit message within the div_wait block
	divWait = document.getElementById("div_donotresubmit");
	if (divWait != null) {
		divWait.style.display = "inline";
	}
}

function expressCheckOut()
{
	if (typeof triggerPopup == "function")
       triggerPopup(false);
	document.searchRequestForm.elements["command"].value="handleExpressCheckout";
	document.searchRequestForm.submit();
}

function submitSearchForm()
{

    doDisplayWaitMessage();
	if (typeof triggerPopup == "function")
	   triggerPopup(false);

	
	for(var i =0;i<document.searchRequestForm.searchType.length;i++)
	{
		if(document.searchRequestForm.searchType[i].checked)
		{
			var value = document.searchRequestForm.searchType[i].value;
			document.searchRequestForm.elements["command"].value="handleAppleVacationPackageSearch";
		}
	}
	document.searchRequestForm.submit();
}



function doShowHide(index) {

	arrow = document.getElementById("area" + index + "arrow");
	content = document.getElementById("area" + index + "content");
	if (content.style.display == "none") {
		arrow.innerHTML = "&uarr;";
		content.style.display = "inline";
	} else {
		arrow.innerHTML = "&darr;";
		content.style.display = "none";
	}
}

function doSearchOptionsOnLoad() {
	// if the children dropdown is not 0, display the child hidden divs accordingly
	children = document.getElementById("childrenDropdown").selectedIndex;
	
	if (children > 0) {
		doChildren(children);
		// adjust the child lap questions accordingly based upon age
		for (i = 1; i <= children; i++)
		{
			childDropdown = document.getElementById("childDropdown" + i);
			if (childDropdown != null)
			{
				childAge = childDropdown.selectedIndex;
				if (childAge > 0)
				{
					doChildAge(i, childDropdown);
				}
			}
		}
	}
	// determine if any checkboxes are checked in hidden divs, expand if necessary
	if (isSectionChecked("interestsCollection")) {
		doShowHide(1);
	}
	if (isSectionChecked("hotelCollection")) {
		doShowHide(2);
	}
}

function isSectionChecked(collectionName) {
	elems = document.getElementsByTagName("input")
    for (i = 0; i < elems.length; i++) {
        if (elems[i].className.indexOf(collectionName) != -1) {
            if (elems[i].checked == true) {
				return true;
			}
		}
	}
	return false;
}
<!-- Modified for 6711-->
function doChildren(index) {

	
	for (i = 1; i <= 4; i++) {
		content = document.getElementById("child" + i);
		if (i <= index) {
			content.style.display = "inline";
			age = document.getElementById("childDropdown" + i);
			lapNo = document.getElementById("child" + i + "RadioNo");
			lapYes = document.getElementById("child" + i + "RadioYes");
			if (age.selectedIndex == 0 && lapNo.checked != true)
			{
				lapYes.checked=true;
			}
		} else {
			content.style.display = "none";
		}
	}
	
	
	showWarnInLaps();
	
	
}
<!-- Modified for 6711-->
function doChildAge(child, ageIndex) {

	
	content = document.getElementById("child" + child);
	if (content.style.display != "none") {
		lapContent = document.getElementById("child" + child + "lap");
		lapYesNoContent = document.getElementById("child" + child + "lapyesno");
		lapYes = document.getElementById("child" + child + "RadioYes");
		if (ageIndex == 1) {
			lapContent.style.visibility = "visible";
			lapYesNoContent.style.visibility = "visible";
			lapYes.checked=true;
		} else {
			lapContent.style.visibility = "hidden";
			lapYesNoContent.style.visibility = "hidden";
		}
		showWarnInLaps();
	}
}

<!-- Added for 6711-->
function showWarnInLaps(){
	
	warnLapChildContent = document.getElementById("warnLapChild");
	warnLapChildContent.style.display = "none";
	
	
    var flag=false;
	for (i = 1; i <= 4; i++) 
	{
			childContent = document.getElementById("child" + i);
			lapContent = document.getElementById("child" + i + "lapyesno");
			age = document.getElementById("childDropdown" + i);
			lapYes = document.getElementById("child" + i + "RadioYes");
				if (childContent.style.display != "none")
				{
					if(lapContent.style.visibility != "hidden")
					{
						if (age.value==1 && lapYes.checked)
						{
						flag=true;
						}
					}
				}
	}    
	    if(flag==true){
			warnLapChildContent = document.getElementById("warnLapChild");
			warnLapChildContent.style.display = "block";
	    }
	}

<!-- End of Changes for 6711-->


function sortHotel(property)
{
	if (typeof triggerPopup == "function")
	   triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleSort";
    document.searchRequestForm.elements["hotelSortKey"].value =property;
    document.searchRequestForm.submit();
}
function sortFlight(property)
{
	if (typeof triggerPopup == "function")
	   triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleSort";
    document.searchRequestForm.elements["flightSortKey"].value =property;
    document.searchRequestForm.submit();
}

function showMoreHotels()
{
	if (typeof triggerPopup == "function")
        triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleShowMoreHotels";
    document.searchRequestForm.submit();
}
function showMoreFlights()
{
	if (typeof triggerPopup == "function")
	    triggerPopup(false);
	doDisplayWaitMessage();
    document.searchRequestForm.elements["command"].value="handleShowMoreFlights";
    document.searchRequestForm.submit();
}

function sortMoreFlightsForSelectedAirline(airlineKey, property)
{
	if (typeof triggerPopup == "function")
	    triggerPopup(false);
	doDisplayWaitMessage();
	document.searchRequestForm.elements["command"].value="handleShowMoreFlightsForSelectedAirline";
    document.searchRequestForm.elements["flightSortKey"].value=property;
    document.searchRequestForm.elements["selectedAirlineKey"].value=airlineKey;
   	document.searchRequestForm.submit();
}

function showMoreFlightsForSelectedAirline(airlineKey)
{
	if (typeof triggerPopup == "function")
	    triggerPopup(false);
	doDisplayWaitMessage();
	document.searchRequestForm.elements["command"].value="handleShowMoreFlightsForSelectedAirline";
    document.searchRequestForm.elements["selectedAirlineKey"].value=airlineKey;
   	document.searchRequestForm.submit();
}

function sortAllAvailableFlights(property)
{
	if (typeof triggerPopup == "function")
	   triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleShowAllAvailableFlights";
    document.searchRequestForm.elements["flightSortKey"].value =property;
    document.searchRequestForm.submit();
}

function showAllAvailableFlights()
{
	if (typeof triggerPopup == "function")
	    triggerPopup(false);
	doDisplayWaitMessage();
    document.searchRequestForm.elements["command"].value="handleShowAllAvailableFlights";
    document.searchRequestForm.submit();
}
function showRoomTypes(hotelId)
{
	if (typeof triggerPopup == "function")
       triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleShowRoomTypes";
	document.searchRequestForm.elements["selectedHotelId"].value=hotelId;
    document.searchRequestForm.submit();
}
function submitSearchForm(fromHotelId)
	{
		if (typeof triggerPopup == "function") 
		   triggerPopup(false);
		doDisplayWaitMessage();
		//doEmailPopup();

		for(var i =0;i<document.searchRequestForm.searchType.length;i++)
		{
			if(document.searchRequestForm.searchType[i].checked)
			{
				var value = document.searchRequestForm.searchType[i].value;
				if (document.searchRequestForm.elements["showMoreOptions"].value!="true")
					document.searchRequestForm.elements["command"].value="handleAppleVacationPackageSearch";
				else
					document.searchRequestForm.elements["command"].value="displayFullSearchEngine";
			}
		}
		document.searchRequestForm.elements["selectedHotelId"].value=fromHotelId;
			
		document.searchRequestForm.submit();
	}

function submitCurrentSearchForm(fromHotelId)
	{
		if (typeof triggerPopup == "function")
  	        triggerPopup(false);
		for(var i =0;i<document.searchRequestForm.searchType.length;i++)
		{
			if(document.searchRequestForm.searchType[i].checked)
			{
				var value = document.searchRequestForm.searchType[i].value;
				document.searchRequestForm.elements["command"].value="displayFullSearchEngine";
			}
		}
		document.searchRequestForm.elements["selectedHotelId"].value=fromHotelId;
		document.searchRequestForm.submit();
	}

	

function selectFlight(flightId)
{
	if (typeof triggerPopup == "function")
    	triggerPopup(false);
	doDisplayWaitMessage();
    document.searchRequestForm.elements["command"].value="handleAppleVacationSelectFlight";
	document.searchRequestForm.elements["selectedFlightId"].value=flightId;
    document.searchRequestForm.submit();
}
/*For CQ4856*/
function selectNewFlight(flightId)
{
	doDisplayWaitMessage();
    document.searchRequestForm.elements["command"].value="handleAppleVacationSelectNewFlight";
	document.searchRequestForm.elements["selectedFlightId"].value=flightId;
    document.searchRequestForm.submit();
}
/*End of CQ4856*/

function priceFlight()
{
		if (typeof triggerPopup == "function")
			triggerPopup(false);
		doDisplayWaitMessage();
		document.searchRequestForm.elements["command"].value="handlePricingFlightOnlyItinerary";
   		document.searchRequestForm.submit();

}

function showMoreRates()
{
	if (typeof triggerPopup == "function")
        triggerPopup(false);
    document.searchRequestForm.elements["command"].value="handleShowMoreRates";
    document.searchRequestForm.submit();
}

function showMoreOptions()
{
	if (typeof triggerPopup == "function")
        triggerPopup(false);
	document.searchRequestForm.elements["command"].value="displayFullSearchEngine";
	document.searchRequestForm.submit();
}

function doMoreOptions()
{
	document.searchRequestForm.elements["showMoreOptions"].value="true";
}

function selectRoomCategory(roomCategoryId)
{
			if (typeof triggerPopup == "function")
			   triggerPopup(false);
			doDisplayWaitMessage();

			var searchForm = document.getElementById("thisForm");
			var value = searchForm.searchType.value;
			if(value == 'applePackage')
			{
				searchForm.elements["command"].value="handlePricingApplePackageItinerary";
			}
			else
			if(value == 'flightOnly')
			{
				searchForm.elements["command"].value="handlePricingFlightOnlyItinerary";
			}
			else
			{
				searchForm.elements["command"].value="handlePricingHotelOnlyItinerary";
			}
			searchForm.elements["selectedRoomCategoryId"].value = roomCategoryId;
			searchForm.submit();
}

function selectOption(option)
{
			if (typeof triggerPopup == "function")
			    triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleAddOption";

			document.searchRequestForm.elements["selectedOptionCode"].value = option;
			document.searchRequestForm.submit();
}

function removeOption(option)
{
			if (typeof triggerPopup == "function")
			   triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleRemoveOption";

			document.searchRequestForm.elements["selectedOptionCode"].value = option;
			document.searchRequestForm.submit();
}
//Added by Srilakshmi for CQ5426-RentalCar
function selectRentalCar(rentalCar)
{
            if (typeof triggerPopup == "function")
			    triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleAddRentalCar";
			
			document.searchRequestForm.elements["selectedRentalCarCode"].value = rentalCar;
			document.searchRequestForm.submit();
}
//Added by Srilakshmi for CQ5426-RentalCar
function removeRentalCar(rentalCar)
{
            if (typeof triggerPopup == "function")
			   triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleRemoveRentalCar";

			document.searchRequestForm.elements["selectedRentalCarCode"].value = rentalCar;
			document.searchRequestForm.submit();
}
function checkpickUpDate()	
{
    var dday = document.searchRequestForm.departureDay.value;
    var dmonth = document.searchRequestForm.departureMonth.value;
	var dyear = document.searchRequestForm.departureYear.value;
	var rday = document.searchRequestForm.returnDay.value;
    var rmonth = document.searchRequestForm.returnMonth.value;
    var ryear = document.searchRequestForm.returnYear.value;
    depdate = dmonth+"/"+dday+"/"+dyear;
    retdate = rmonth+"/"+rday+"/"+ryear;
            var x= new Date(depdate);
             var mx = new Date(x.toGMTString());
              var y= new Date(retdate);
               var my = new Date(y.toGMTString());
			    var z= new Date(document.getElementById("pickUpDate").value);
			     var mz = new Date(z.toGMTString());
			      var a= new Date(document.getElementById("dropOffDate").value);
			       var ma= new Date(a.toGMTString());

	  		xyear = takeYear(mx);

                   function takeYear(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                xmonth = mx.getMonth();
				xday = mx.getDate();
				main1 = (Date.UTC(xyear,xmonth+1,xday,0,0,0))/86400000;
                
                yyear = takeYear(my);

                   function takeYear(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                ymonth = my.getMonth();
				yday = my.getDate();
				main2 = (Date.UTC(yyear,ymonth+1,yday,0,0,0))/86400000;
                
				zyear = takeYear1(mz);

                   function takeYear1(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                zmonth = mz.getMonth();
				zday = mz.getDate();
				main3 = (Date.UTC(zyear,zmonth+1,zday,0,0,0))/86400000;
                
               ayear = takeYear2(ma);
                   
                   function takeYear2(theDate)
                    {
                     var x = theDate.getYear();
                     var y = x % 100;
                     y += (y < 38) ? 2000 : 1900;
	                 return y;
                          }
               amonth = ma.getMonth();
               aday = ma.getDate();
               main4 = (Date.UTC(ayear,amonth+1,aday,0,0,0))/86400000;
                                 
				var diff,diff1;
				diff=main3-main1;
				diff1=main3-main2;
				diff2=main4-main3;
				if(diff2<0)
				{
				 document.getElementById("validateDate").innerHTML = "Pickupdate must be lessthan the dropoffdate";
				 return false;
				}
				if(diff<0 || diff1>0)
				{
				 document.getElementById("validatepickUpDate").innerHTML = "pickupdate must be within the travel dates";
				 return false;
				}
				else
				 return true;
						
}
function checkDropOffDate()	
{
            var dday = document.searchRequestForm.departureDay.value;
            var dmonth = document.searchRequestForm.departureMonth.value;
	        var dyear = document.searchRequestForm.departureYear.value;
	        var rday = document.searchRequestForm.returnDay.value;
            var rmonth = document.searchRequestForm.returnMonth.value;
            var ryear = document.searchRequestForm.returnYear.value;
            depdate = dmonth+"/"+dday+"/"+dyear;
            retdate = rmonth+"/"+rday+"/"+ryear;
            var x= new Date(depdate);
             var mx = new Date(x.toGMTString());
              var y= new Date(retdate);
               var my = new Date(y.toGMTString());
                 var z= new Date(document.getElementById("dropOffDate").value);
			       var mz = new Date(z.toGMTString());
                    var a= new Date(document.getElementById("pickUpDate").value);
			         var ma= new Date(a.toGMTString());
	  		xyear = takeYear(mx);

                   function takeYear(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                xmonth = mx.getMonth();
				xday = mx.getDate();
				main1 = (Date.UTC(xyear,xmonth+1,xday,0,0,0))/86400000;
				
               yyear = takeYear(my);

                   function takeYear(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                ymonth = my.getMonth();
				yday = my.getDate();
				main2 = (Date.UTC(yyear,ymonth+1,yday,0,0,0))/86400000;
                
				zyear = takeYear1(mz);

                   function takeYear1(theDate)
                         {
	                   var x = theDate.getYear();
	                   var y = x % 100;
	                   y += (y < 38) ? 2000 : 1900;
	                   return y;
                          }
                zmonth = mz.getMonth();
				zday = mz.getDate();
				main3 = (Date.UTC(zyear,zmonth+1,zday,0,0,0))/86400000;
				
				
				 ayear = takeYear2(ma);
                   
                   function takeYear2(theDate)
                    {
                     var x = theDate.getYear();
                     var y = x % 100;
                     y += (y < 38) ? 2000 : 1900;
	                 return y;
                          }
               amonth = ma.getMonth();
               aday = ma.getDate();
               main4 = (Date.UTC(ayear,amonth+1,aday,0,0,0))/86400000;
                      
				var diff,diff1;
				diff=main3-main1;
				diff1=main3-main2;
				diff2=main4-main3;
				if(diff2>0)
				     {
				     document.getElementById("validateDate").innerHTML = "dropOffDate must be greaterthan the pickupdate";
				     return false;
				     }
				if(diff<0 || diff1>0)
				     {
					 document.getElementById("validatedropOffDate").innerHTML = "dropoffdate must be within the travel dates";
					 return false;
					 }
				else
				     return true;

}
function check25hours() 
{
	var returnValue=true;
	diff  = new Date();
	date1 = new Date();	
	// PICKUP DATE
	date1tempString =(document.getElementById("pickUpDate").value +" "
	+document.getElementById("pickupTimeHr").value + ":" 
	+document.getElementById("pickupTimeMin").value + ":00");		
	if(document.searchRequestForm.elements("pickupTimeAMPM")[1].checked)
		date1tempString=date1tempString+document.searchRequestForm.elements("pickupTimeAMPM")[1].value;
		else
		date1tempString=date1tempString+document.searchRequestForm.elements("pickupTimeAMPM")[0].value;

		var date1temp=new Date(date1tempString);
		date1.setTime(date1temp.getTime());
    //DROP OF DATE
		date2 = new Date();
	    date2tempString = (document.getElementById("pickUpDate").value + " "+
		document.getElementById("dropOffTimeHr").value + ":" +
		document.getElementById("dropOffTimeMin").value + ":00");
        
	    if(document.searchRequestForm.elements("dropTimeAMPM")[1].checked){
	      date2tempString=date2tempString+document.searchRequestForm.elements("dropTimeAMPM")[1].value;}
		else{
		  date2tempString=date2tempString+document.searchRequestForm.elements("dropTimeAMPM")[0].value;}
        var date2temp=new Date(date2tempString);
		date2.setTime(date2temp.getTime());
		if(date2temp.getTime() - date1temp.getTime()<=0) {
		  return 0;
		}
		else{
	        diff.setTime(Math.abs(date2temp.getTime() - date1temp.getTime()));	
			timediff = diff.getTime();	
			minutes = Math.floor(timediff / (1000 * 60));
			
			if (minutes >= 10)
			  {
			    var rday = document.searchRequestForm.returnDay.value;
	      		var rmonth = document.searchRequestForm.returnMonth.value;
			    var ryear = document.searchRequestForm.returnYear.value;
			    retdate = rmonth+"/"+rday+"/"+ryear+" 00:00:00 AM";
		        var y= new Date(retdate);
		        
			    var z= new Date(document.getElementById("dropOffDate").value+" 00:00:00 AM");
			    var rddiff = z.getTime() - y.getTime();
			    var noOfDays = rddiff / (24*60*60*1000);
			    if(noOfDays == 1) {
		            document.getElementById("validateTime").innerHTML="";
			    	return 1;
			    }
			    if(rddiff == 0 || noOfDays > 1) {
		            document.getElementById("validateTime").innerHTML="You have entered times that exceed a 25 hour period.<br>You must change the return date.";
		            return 2;		    	
			    }
			}
			return 0;
		}
}
//Added by Srilakshmi for CQ5426-RentalCar

function handleRentalCarDate()
{   
	var status = check25hours();
    if(status==0)
    {
      if(checkDropOffDate()==false)
         return;
    } else if(status==2) {
    	return;
    }
      
	if((checkpickUpDate()==false))
	   return;

    document.searchRequestForm.elements["command"].value="handleRentalCarDate";
    document.searchRequestForm.submit();
}

function showBillingInfo()
{
			if (typeof triggerPopup == "function")
				triggerPopup(false);
			document.searchRequestForm.elements["command"].value="showBillingInfo";
			document.searchRequestForm.submit();
}

function isClickedBtnCompleteBooking()
{
		// determines if the back button was used to get to this page
		return(document.forms._back_button_detect._back_button_state.value == '1');
}

function setClickedBtnCompleteBooking()
{
			// sets the flags we need to track submit clicks
			document.forms._back_button_detect._back_button_state.value=1;
		   	document.forms._back_button_detect._back_button_state.defaultValue=1;			

			//disable submit button, not necessary
			//divSubmit = document.getElementById("btn_complete_booking");
			//if (divSubmit != null) {
			//	divSubmit.style.display = "none";
			//}			
}

function completeBooking()
{
			// see apple.js: doDisplayDoNotResubmitMessage is the 
			// same thing as doDisplayWaitMessage - it just
			// exposes a different "please wait" image to the user
			alert("Please wait a moment while we process your reservation and payment.  Please do not hit the back button or complete booking button again as doing so could result in multiple payment attempts. You will receive an on-screen confirmation of your vacation in a moment, followed by an E-mail confirmation");
			if (typeof triggerPopup == "function")
				triggerPopup(false);
			doDisplayDoNotResubmitMessage();

			document.searchRequestForm.elements["command"].value="handleBooking";
			document.searchRequestForm.submit();

}

function changeSelections()
{
			if (typeof triggerPopup == "function")
				triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleChangeFlightOrHotel";
			document.searchRequestForm.submit();
}

function updateInsurance()
{
			if (typeof triggerPopup == "function")
				triggerPopup(false);
			document.searchRequestForm.elements["command"].value="handleUpdateInsurance";
			document.searchRequestForm.submit();
}

function doSameAsBilling()
{
	// clear all shipping fields
	document.getElementById("first_name").value = "";
	document.getElementById("last_name").value = "";
	document.getElementById("address1").value = "";
	document.getElementById("address2").value = "";
	document.getElementById("city").value = "";
	document.getElementById("state").selectedIndex = 0;
	document.getElementById("zip").value = "";
}

/*
	Added by Hemanth on 30th Oct 2006 for the CQDB00004938 
*/
function hotelTabMouseOver(tab, activeTab) {
	img = document.getElementById("tab" + tab);
	if(img.src.indexOf('hotel_tab_' + tab + '_on.jpg')!=-1) {
		activeTab = tab;		
	} else {
		img.src = "/appleweb/images/hotel_tab_" + tab + "_over.jpg"
	}
	return activeTab;
}

function hotelTabMouseOut(tab, activeTab) {
	img = document.getElementById("tab" + tab);
	if(activeTab!=tab) {
		img.src = "/appleweb/images/hotel_tab_" + tab + "_off.jpg"
	}
}
/*
	Hemanth changes END
*/	
function menuHover(cell, hover) {
	if (hover == true) {
		cell.style.backgroundColor = "#C8DFF2";
		cell.style.color ="#286DB2"
	} else {
		cell.style.backgroundColor = "";
		cell.style.color ="#000000";
	}
}

var selectedFlightdId = "";
function setSelectedFlightID(id) {
	selectedFlightdId = id;
}

function accessCreditCardFields(option)
	{	
		if(option=="debit")
		{			
			document.getElementById("creditCardInfo").style.display = "none"; 	
			document.getElementById("svpInfo").style.display = ""; 	
		}
		else
		{			
			document.getElementById("creditCardInfo").style.display = ""; 	
			document.getElementById("svpInfo").style.display = "none"; 	
			}
	}	
