<!--
var visibleLayer="disagree";

if(isNaN(window.trip)){
window.trip=0;
} //set up globals

if(isNaN(window.occup)){
window.occup=0;
} //set up globals

function checkselections(thisbutton){

thevalue=thisbutton.value;
thename=thisbutton.name;

thecode=thevalue.substring(0,1);

if (thename=="trip"){
window.trip=thecode;
theothercode=window.occup;
}
else{
window.occup=thecode;
theothercode=window.trip
}

//	alert (window.trip);
//	alert (window.occup);

if(window.trip!=window.occup && window.trip!=0 && window.occup!=0){
alert('That is an invalid selection! \n \n The hotel/occupancy you select must match the departure city/date!');

if (thename!="trip"){
thisbutton.checked=false;
}
}


} //checkselections

function layerToggle(layerName){
	//note that the layer name must be unique for any object on the page (you cannot
	//even have a button or field and a layer with the same name) 
	if (layerName == visibleLayer) return; //else continue execution
	if (document.layers) { //netscape 4
		l1 = eval("document.layers." + visibleLayer);
		l2 = eval("document.layers." + layerName);
		}
	else { //IE4 & up & Mozilla 5 & up
		l1 = eval("document.getElementById('" + visibleLayer + "')");
		l2 = eval("document.getElementById('" + layerName + "')");
		}
	l1.style.visibility = "hidden";
	l2.style.visibility = "visible";
	visibleLayer = layerName;
	
}//layerToggle


function newwin(path, height, width){
window.open(path,"Add","Height="+height+",Width="+width+", scrollbars=yes");
}

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);

function newaction(path, height, width,ID){
if(confirm("Are you sure you want to delete ID "+ID+"?")){
		window.open(path,"Delete","Height="+height+",Width="+width);
	}
else{
	alert ("No action was taken.");
	}
}


function popAction(path, height, width,ID,actiontype){
if(confirm("Are you sure you want to "+actiontype+" ID "+ID+"?")){
		window.open(path,"Delete","Height="+height+",Width="+width);
	}
else{
	alert ("No action was taken.");
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function doPic(imgName) {
if (ns3up || ie4up) {
imgOn = ("images/rollingteaser-" + imgName + ".jpg");

document.header.src = imgOn;
}
}

function openpopup(path, height, width){

window.open(path,"Add","Height="+height+",Width="+width);

}

function openPopupScrolling(path, height, width){

window.open(path,"Add","scrollbars=yes,Height="+height+",Width="+width);

}


function preloadImages() {
	var doc=document;
	if(doc.images){
		if(!doc.p)
			doc.p=new Array();
		var count,j=doc.p.length,a=preloadImages.arguments;
		for(count=0; count<a.length; count++)
			if (a[count].indexOf("#")!=0){
				doc.p[j]=new Image;
				doc.p[j++].src=a[count];
			}
	}
}

function checkOptionals(form){

if (form.insurance.checked){
form.temptripprice.value=66.95;
}
else{
form.temptripprice.value=50;
}

}

/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}
// end rounding


//===========================
// Show/Hide functions for non-pointer layer/objects

var citizen_mode;
 
function show_option(id) {

	if (id == 'OutsideUS')
	{ 

		document.all['id_province'].style.display = "";
	
	}

	if (id == 'Passport')
	{ 
		//document.OrderForm.usemail[0].checked = 0;
		//document.OrderForm.usemail[1].checked = 0;  
		document.all['id_passport'].style.display = "";
		document.all['id_document1'].style.display = "";
		document.all['id_document2'].style.display = "";
		citizen_mode = 'Passport'; 
	}

	else if (id == 'BirthCertificate')
	{ 
		//document.OrderForm.usemail[0].checked = 0;
		//document.OrderForm.usemail[1].checked = 0;
		document.all['id_document1'].style.display = "";
		document.all['id_document2'].style.display = "";
		document.all['id_passport'].style.display = "none";
		citizen_mode = 'BirthCertificate'; 
	} 
	else if (id == 'Other')
	{ 
		//document.OrderForm.usemail[0].checked = 0;
		//document.OrderForm.usemail[1].checked = 0;
		document.all['id_document1'].style.display = "none";
		document.all['id_document2'].style.display = "none";
		document.all['id_passport'].style.display = "none";
		citizen_mode = 'Other'; 
	} 
	else if (id == '0')
	{  
		document.all['id_roommate1f'].style.display = "none";
		document.all['id_roommate1l'].style.display = "none"; 
		document.all['id_roommate2f'].style.display = "none";
		document.all['id_roommate2l'].style.display = "none";  
		document.all['id_roommate3f'].style.display = "none";
		document.all['id_roommate3l'].style.display = "none";  
	} 
	else if (id == '1')
	{  
		document.all['id_roommate1f'].style.display = "";
		document.all['id_roommate1l'].style.display = ""; 
		document.all['id_roommate2f'].style.display = "none";
		document.all['id_roommate2l'].style.display = "none";  
		document.all['id_roommate3f'].style.display = "none";
		document.all['id_roommate3l'].style.display = "none";  
	} 

	else if (id == '2')
	{  
		document.all['id_roommate1f'].style.display = "";
		document.all['id_roommate1l'].style.display = ""; 
		document.all['id_roommate2f'].style.display = "";
		document.all['id_roommate2l'].style.display = "";  
		document.all['id_roommate3f'].style.display = "none";
		document.all['id_roommate3l'].style.display = "none"; 
	} 
	else if (id == '3')
	{  
		document.all['id_roommate1f'].style.display = "";
		document.all['id_roommate1l'].style.display = ""; 
		document.all['id_roommate2f'].style.display = "";
		document.all['id_roommate2l'].style.display = "";  
		document.all['id_roommate3f'].style.display = "";
		document.all['id_roommate3l'].style.display = ""; 
	} 
	
	
	
	if (id == 'CustomEngine')
	{  
 		document.all['tripOccupancy'].style.display = "none";
		document.all['tripGroup'].style.display = "none";
		document.all['tripHotel'].style.display = "none";
		document.all['tripDates'].style.display = "none";
		document.all['tripCity'].style.display = "none";
		document.all['tripPrice'].style.display = "none";
		document.all['tripDivider'].style.display = "none";
		document.all['tripPriceLabel'].style.display = "none";
		document.all['enginetab'].style.display = "none";
		document.all['enginego'].style.display = "none";

		document.all['customAirport'].style.display = "";
		document.all['customDate'].style.display = "";
		document.all['customLength'].style.display = "";
		document.all['customTravelers'].style.display = "";
		document.all['enginetabCustom'].style.display = "";
		document.all['enginegoCustom'].style.display = "";
		
		skipengine=1;
		createcals();

	}
	
	if (id == 'TripEngine')
	{  
		document.all['extrastab'].style.display = "none";
		document.all['extrastab2'].style.display = "";
		
		document.all['enginetab'].style.display = "none";
		document.all['enginetabCustom'].style.display = "";
		
		
		document.all['extras_category'].style.display = "none";
		document.all['extras_item'].style.display = "none";
		
 		document.all['tripOccupancy'].style.display = "";
		document.all['tripGroup'].style.display = "";
		document.all['tripHotel'].style.display = "";
		document.all['tripDates'].style.display = "";
		document.all['tripCity'].style.display = "";
		document.all['tripPrice'].style.display = "";
		document.all['tripPriceLabel'].style.display = "";
		document.all['tripDivider'].style.display = "";
		//document.all['enginetab'].style.display = "";
		document.all['enginego'].style.display = "";
		
		document.all['customAirport'].style.display = "none";
		document.all['customDate'].style.display = "none";
		document.all['customLength'].style.display = "none";
		document.all['customTravelers'].style.display = "none";
		//document.all['enginetabCustom'].style.display = "none";
		document.all['enginegoCustom'].style.display = "none";

		skipengine=0;
		document.OrderForm.totalprice.value = 0 ;
		var newaction = $j('#OrderForm').attr('action').replace('indiv_addextras','indiv_info'); 
		$j('#OrderForm').attr('action',newaction );
		
	}
	
	if (id == 'extrastab')
	{  
		document.all['extrastab'].style.display = "";
		document.all['extrastab2'].style.display = "none";
		
		document.all['enginetab'].style.display = "";
		document.all['enginetabCustom'].style.display = "none";
		
		
		document.all['extras_category'].style.display = "";
		document.all['extras_item'].style.display = "";
		
 		document.all['tripOccupancy'].style.display = "none";
		document.all['tripGroup'].style.display = "none";
		document.all['tripHotel'].style.display = "none";
		document.all['tripDates'].style.display = "none";
		document.all['tripCity'].style.display = "none";
		//document.all['tripPrice'].style.display = "none";
		//document.all['tripPriceLabel'].style.display = "none";
		//document.all['tripDivider'].style.display = "none";
		//document.all['enginetab'].style.display = "";
		//document.all['enginego'].style.display = "none";
		
		//document.all['customAirport'].style.display = "";
		//document.all['customDate'].style.display = "";
		//document.all['customLength'].style.display = "";
		//document.all['customTravelers'].style.display = "";
		//document.all['enginetabCustom'].style.display = "none";
		//document.all['enginegoCustom'].style.display = "";
		
		skipengine=0;
		document.OrderForm.totalprice.value = 0 ;
		var newaction = $j('#OrderForm').attr('action').replace('indiv_info','indiv_addextras'); 
		$j('#OrderForm').attr('action',newaction );
	}
}

//---------------------------------------------------------

function popFIT(customID)
{
	//newwin('http://www.airdepartment.com/specials.cfm?special=288&track=3668&logo=cabocustom-gateway.gif', 600, 820);
	//alert("Check back soon for the 2007 custom trip builder.");
	//document.location="content_custominterstitial2.php";
	if(customID=="Baja Insider - Pimp 'n Ho") 
		newwin('http://www.airdepartment.com/specials_tca.cfm', 760, 820);

	else //document.location="content_groups.php";
		show_option("CustomEngine");
}

//-->


/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr = 'tab_content_vip';	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
	

}

function flustTabs()
{
		bluetab1.className='bluetab';
		bluetabtext1.className='tab_nav';

		bluetab2.className='bluetab';
		bluetabtext2.className='tab_nav';

		bluetab3.className='bluetab';
		bluetabtext3.className='tab_nav';

		bluetab4.className='bluetab';
		bluetabtext4.className='tab_nav'; 	
}
/*

 
// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var EnableRightClick = 0;
if(isNS) 
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
  if(EnableRightClick==1){ return true; }
  else {return false; }
}
function mousehandler(e){
  if(EnableRightClick==1){ return true; }
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3)) return false;
}
function keyhandler(e) {
  var myevent = (isNS) ? e : window.event;
  if (myevent.keyCode==96)
    EnableRightClick = 1;
  return;
}
document.oncontextmenu = mischandler;
document.onkeypress = keyhandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
// end clear right mb
// ***********************************************

*/

// ======= CUSTOM INTEGER FUNCTIONS ===============
   function isInteger (s)
   {
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }

   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }
   
   
   function openParentThenClose(gotoURL)
{
	window.opener.document.location=gotoURL;
	window.close();
}


   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }
// END ======= CUSTOM INTEGER FUNCTIONS ===============


function addnewline(id,name){
	var tddateid = "tddate"+id;
	var tddate = document.getElementById(tddateid);
	var tdqty = document.getElementById("tdqty"+id);
	//get index
	var numberid = 'number'+id;
	var inputnumber = document.getElementById(numberid);
	var index = inputnumber.value;

	var template_month = document.getElementById('hiddenmmselector');
	template_month = template_month.innerHTML;
	var template_day = document.getElementById('hiddenddselector');
	template_day = template_day.innerHTML;
	var template_year = document.getElementById('hiddenyyselector');
	template_year = template_year.innerHTML;
	
	var newtddatecontent = template_month.replace(/<select>/,"<select name=mm"+index+"["+id+"]>");
	newtddatecontent += template_day.replace(/<select>/,"<select name=dd"+index+"["+id+"]>");
	newtddatecontent += template_year.replace(/<select>/,"<select name=yy"+index+"["+id+"]>");
	
	//get time
	var template_time = document.getElementById('timetemplate'+id);
	if(template_time){
		template_time = template_time.innerHTML;
		template_time = "<select name=time"+index+"["+id+"]>" + template_time +"</select>";
		newtddatecontent += template_time;
	}
	
	var newindex = parseInt(index) + 1;
	newtddatecontent += "<br/><span id='linkaddnew"+id+newindex+"'><a href='#' onclick='return addnewline(\""+id+"\",\""+name+"\")'>add another date</a></span>";
	//display none all add link
	for( var i=1;i<newindex;i++){
		var addlinkid = "linkaddnew" +id + i;
		document.getElementById(addlinkid).style.display = "none";
	}
	
	
	newtddatecontent = "<tr><td>" + newtddatecontent+"</td></tr>";
	var row = tddate.insertRow(-1);//insert one row 
	//row.style.backgroundColor = "#CFCFCF";
	var cell = row.insertCell(-1);
	cell.innerHTML = newtddatecontent;
	
	//get qty
	var template_qty = document.getElementById('qty'+id);
	template_qty = template_qty.innerHTML;
	template_qty = "<select name=qty"+index+"["+id+"]>" + template_qty +"</select>";
	row = tdqty.insertRow(-1);//insert one row 
	//row.style.backgroundColor = "#AFAFAF";
	cell = row.insertCell(-1);
	cell.innerHTML = template_qty;
	
	document.getElementById(numberid).value = parseInt(index) + 1;
	return false;
}


function onchangearriveairlinelist( val,hiddeninputid ){
	if( val=="Other"  ){
		document.getElementById(hiddeninputid).style.display = "";
	}else{
		document.getElementById(hiddeninputid).style.display = "none";
	}
}

var from_tr_array = new Array("flightinfodeparturedatemm","flightinfoairlinenumber","flightinfoarrivaltime");
var to_tr_array = new Array("flightinfoteturndatemm","flightinforeturnairlinenumber","flightinforeturndeparturetime");

function showfrompart(id){
	for(var i=0;i<to_tr_array.length;i++ ){ 
		var objid=  'tr'+id + to_tr_array[i];
        document.getElementById(objid).style.display = "none";
    } 
	
	for(var i=0;i<from_tr_array.length;i++ ){ 
		var objid=  'tr'+id + from_tr_array[i];
        document.getElementById(objid).style.display = "";
    } 
}

function showtopart(id){
	for(var i=0;i<from_tr_array.length;i++ ){ 
		var objid=  'tr'+id + from_tr_array[i];
        document.getElementById(objid).style.display = "none";
    } 
	
	for(var i=0;i<to_tr_array.length;i++ ){ 
		var objid=  'tr'+id + to_tr_array[i];
        document.getElementById(objid).style.display = "";
    }
}

function showfromandtopart(id){
	for(var i=0;i<from_tr_array.length;i++ ){ 
		var objid=  'tr'+id + from_tr_array[i];
        document.getElementById(objid).style.display = "";
    } 
	
	for(var i=0;i<to_tr_array.length;i++ ){ 
		var objid=  'tr'+id + to_tr_array[i];
        document.getElementById(objid).style.display = "";
    }
}


function startLoadingLayer()

{
	var ldiv = document.getElementById('LoadingDiv');
	ldiv.style.display='block';
}