var objXML;
var hasXML = false;
var hasVB  = false;
var vax_currency_code = "";
try {
	objXML = new ActiveXObject("Msxml2.DOMDocument");
	objXML.validateOnParse = true;
	objXML.loadXML( "<xml><test>TEST</test></xml>" );
	if (objXML.parseError.errorCode == 0) {
		hasXML = true;
	}
} catch (xE) {
	hasXML = false;
}

// 09/19/06 STA < Start - This function pops open the airport code link window and allows
// us to avoid the length limitations of the Questions table's questionText field.  A 
// hidden textbox, named "idPrefix", is used for holding the container id which is used
// for naming the Registration controls.  This value is passed into function populateOD
// to avoid the need to hard-code textbox names.
function openAirportCodeLinkPopupUVT(){
    var idPrefix = FIND("idPrefix").value;
    var relativeURL = "../Avail/AirportCode.aspx?MarketType=O&PackageType=UAT|AH01&ProfileFlag=True&IDPrefix=" + idPrefix;
    var popupOptions = "toolbar=0,location=0,menubar=0,scrollbars=1,width=340,height=270";
    window.open(relativeURL,'',popupOptions);
}
// 09/19/06 STA < End

// 09/19/06 STA < Start - This function populates either the Origin or the Destination
// text box on the advanced search page with the airport code value which was selected
// from the airport codes popup window.  If the value of contentFlag is equal to true,
// then it means that the airport codes popup window was opened from a content page and
// that we need to look for different text field names.  If the value of profileFlag is 
// equal to true, then it means that the user clicked on the link on either login.aspx 
// or weeklyemailspecials.aspx.  Parameter controlID represents the unique control id 
// of the registration composite control.  It will only be used when contentFlag is 
// false, marketType is origin, and profileFlag is true.
function populateOD(airportCode, marketType, contentFlag, profileFlag, controlID){  
    var placeTextBox;
       
    // convert values of contentFlag & profileFlag to all lower-case, to prepare for string comparison
    contentFlag = contentFlag.toLowerCase(); 
    profileFlag = profileFlag.toLowerCase();
             
    switch(marketType){
        case "D": 
            if(contentFlag == "true"){
                placeTextBox = FIND("gsDestination");
            }
            else{
                placeTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtDestination");
            }
            break;
        case "O":
            if(contentFlag == "true"){
                placeTextBox = FIND("gsOrigin");
            }
            else{
                if(profileFlag == "true"){
                    placeTextBox = FIND(controlID);
                }
                else{
                    placeTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtOrigin");
                }
            }
            break;
        default:
            alert("An invalid market type was provided");
            break;
    }
		
	// the text box will equal [object HTMLInputElement] in Firefox & Netscape, but it
	// will equal [object] in IE.  Safari sees object as [object INPUT].	
	if(placeTextBox == "[object]" || placeTextBox == "[object HTMLInputElement]" || placeTextBox == "[object INPUT]"){
		placeTextBox.value = airportCode;
	}
	else{
		alert("The necessary text box could not be found");
	}
}
// 09/19/06 STA < End

// 07/13/05  JSJ > BEGIN: Added the trim function to remove whitespace at the beginning and end of a string 
function trim(sString) 
{
	// 10/21/05 JSJ > BEGIN: Added a check for null and return empty string if the value passed in was null
	if (sString != null) { 
		while (sString.substring(0,1) == ' ') 	{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ')	{
			sString = sString.substring(0,sString.length-1);
		}
		return sString;
	}
	else {
		return ""
	}
	// 10/21/05 JSJ > END
}
// 07/13/05 JSJ < END

function new_window(url) {
  link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=650,height=400,left=80,top=180");
}

function TackOnClientCapabilities( inHref ) {
	var l_href = inHref;
	if (l_href.indexOf("?") == -1) {
		l_href += "?hasXML=" + hasXML + "&hasVB=" + hasVB;
	} else {
		l_href += "&hasXML=" + hasXML + "&hasVB=" + hasVB;
	}
	document.location.href = l_href;
}
function FormAddClientCapabilities( inForm ) {
	//alert("FormAddClientCapabilities( " + inForm + " ) called.");
	inForm.hasXML.value = hasXML;
	inForm.hasVB.value = hasVB;
	inForm.submit();
}

function MM_findObj(n, d) { //v3.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); 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 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 toggleDebug(name, debugValue) {
//alert( "DebugValue is " + debugValue + "\ntoggleDebug(" + name + ") " + debugFlagAnchor.innerHTML + " goes to " + debugFlagAnchor.href);
  if (debugValue == "False") {
    setCookie( name, "1" );
    debugFlagAnchor.innerHTML = "Turn Debug OFF";
    debugValue = "1";
  } else {
    deleteCookie( name );
    debugFlagAnchor.innerHTML = "Turn Debug ON";
    debugValue = "0";
  }
//alert( "DebugValue is " + debugValue + "\ntoggleDebug(" + name + ") " + debugFlagAnchor.innerHTML + " goes to " + debugFlagAnchor.href);
}

// MPB 09/11/06 - Begin: ToggleDisplay isn't working in all browers because it uses
//                the FIND function which uses document.all for returning arrays.  The
//                document.all method is not supported by all browsers.  I am refactoring
//                ToggleDisplay and creating a new method with similar logic that looks
//                up elements by name rather than by id.
// 06/09/06 LDG < New function to deal with a group of tags with different IDs but same Name.
//                FIND won't work, so we need to use getElementsByTagName and iterate through list.
function ToggleDisplayGroup(tagType, idName) {
    var lObjs;
	if (document.getElementsByTagName) {
	    lObjs = document.getElementsByTagName(tagType);
	    if (lObjs.length > 0) {
	        for (var k=0; k < lObjs.length; k++) {
	            //if (lObjs[k].name == idName) {    // 08/30/06 LDG < Make cross-browser functional.
	            if (lObjs[k].getAttribute("name") == idName) {
	                ToggleDisplay(lObjs[k].id);
	            }
	        }
	    }
	} else {
	    return( false );
	}
}
function ToggleExpandyLinkTextGroup(inLink, textOpen, textClosed, dependsOnTagType, dependsOnName) {
    var lObjs;
	if (document.getElementsByTagName) {
	    lObjs = document.getElementsByTagName(dependsOnTagType);
	    if (lObjs.length > 0) {
	        for (var k=0; k < lObjs.length; k++) {
	            if (lObjs[k].name == dependsOnName) {
                    // This only needs to find the first one in order to supply the dependsOn argument to ToggleExpandyLinkText
	                ToggleExpandyLinkText( inLink, textOpen, textClosed, lObjs[k]);
	                k += lObjs.length;  // to exit.
	            }
	        }
	    }
	} else {
	    return( false );
	}
}
// 06/09/06 LDG < End

function ToggleDisplay(idName) {
	var lObj = FIND(idName);
	if(lObj != undefined) {
		if(lObj.length == null) {
            ChangeStyleDisplay(lObj);
		// BJS 04/21/04 - BEGIN	
		//	Added this logic to process arrays of objects.  This is useful for toggling a number of objects on the page that happen
		//	to have the same id. (Only works in IE - MPB 09/11/06)
		} else { // this object is an array
			var i = 0;
			for(i = 0; i <= lObj.length - 1; i++) {
                ChangeStyleDisplay(lObj[i]);
			}
		}	
		// BJS 04/21/04 - END
	}
	return( true );
}

function ToggleDisplayByName(idName) {
    var lObj = document.getElementsByName(idName);
    if(lObj != undefined) {
        for(i = 0; i <= lObj.length - 1; i++){
            ChangeStyleDisplay(lObj[i]);
        }
    }
}

function ChangeStyleDisplay(lObj) {
	if (lObj.style.display == "none") {
		lObj.style.display = "block";
	} else {
		lObj.style.display = "none";
	}    
}
// MPB 09/11/06 - End

// REG 06/01/05 - Start
// More Mozilla compatiblity issues.  GECKO has to use textContent rather than innerText.
// BJS 04/14/04 - BEGIN
// This function allows for the changing of text in a hyperlink that is used for toggling an expandy.
// For example:
//		You may want a link to say "Show" when the expandy that it toggles is closed and "Hide" when the 
//		expandy is open.
// To accomplish this, this function accepts the link (<a/> as an object, the text value of the expandy
// open state and the text value of the expandy closed state, both as strings, and the expandy object so 
// that the function knows which text state to display.
function ToggleExpandyLinkText(inLink, textOpen, textClosed, dependsOn) {
	if(dependsOn != undefined) {
	    if(IE4)
	    {
		    if(dependsOn.length == null) {
			    if(dependsOn.style.display == "block") {
				    inLink.innerText = textOpen;
			    } else {
				    inLink.innerText = textClosed;
			    }
		    // BJS 04/21/04 - BEGIN	
		    //	Added this logic to handle arrays of objects.  This is needed when the dependsOn object is an array of objects
		    //	on the page with the same name.
		    } else {
			    if(dependsOn[0].style.display == "block") {
				    inLink.innerText = textOpen;
			    } else {
				    inLink.innerText = textClosed;
			    }
		    }
		    // BJS 04/21/04 - END
		}
		else
		{
		    if(dependsOn.length == null) {
			    if(dependsOn.style.display == "block") {
				    inLink.textContent = textOpen;
			    } else {
				    inLink.textContent = textClosed;
			    }
		    // BJS 04/21/04 - BEGIN	
		    //	Added this logic to handle arrays of objects.  This is needed when the dependsOn object is an array of objects
		    //	on the page with the same name.
		    } else {
			    if(dependsOn[0].style.display == "block") {
				    inLink.textContent = textOpen;
			    } else {
				    inLink.textContent = textClosed;
			    }
		    }
		    // BJS 04/21/04 - END
		}		
	}
}
// BJS 04/14/04 - END
// REG 06/01/05 - End

// 08/13/04 REG - Start
// Adding in function to allow for expandy images and not just text
// Blatantly stealing code from ToggleExpandyLinkText
function ToggleExpandyLinkImage(inLink, imageOpen, imageClosed, dependsOn) {
    var image = FIND("expandyImage_" + inLink);
    //alert(image.src);
    if(dependsOn != undefined) {
		if(dependsOn.length == null) {
			if(dependsOn.style.display == "block") {
				image.src = imageOpen;
			} else {
				image.src = imageClosed;
			}
		// BJS 04/21/04 - BEGIN	
		//	Added this logic to handle arrays of objects.  This is needed when the dependsOn object is an array of objects
		//	on the page with the same name.
		} else {
			if(dependsOn[0].style.display == "block") {
				image.src = imageOpen;
			} else {
				image.src = imageClosed;
			}
		}
		// BJS 04/21/04 - END
	}
}
// BJS 04/14/04 - END
// 08/13/04 REG - End

function makeFavorite() {	// 08/11/02 LDG
	//alert("makeFavorite() \n" + navigator.appVersion + "\n" + navigator.appVersion.indexOf("MSIE") + "\n" + parseInt(navigator.appVersion, 10));
	if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion, 10) >= 4)) {
		var sText = "<a href=\"#\" ";
		sText += "onClick=\"window.external.AddFavorite(location.href,";
		sText += "document.title);\">Add VAX VacationAccess<br /> to your favorites</a>";
		document.write( sText );
	}
}


function GoToFROMMERS() {
	FrommersWin = window.open('', 'FrommersWin', 'width=800,height=500,resizable=1,status=1,scrollbars=1,toolbar=0'); 

	var confirmString = "POST to " + document.FROMMERSform.action + "\n=========================\n";
	// .NET adds the controlName:elementName to our form variable names, so remove it.
	for (var i=0; i < document.FROMMERSform.elements.length; i++)  {
		if (document.FROMMERSform.elements[i].name.indexOf(":") != -1) {
			document.FROMMERSform.elements[i].name = document.FROMMERSform.elements[i].name.substring(document.FROMMERSform.elements[i].name.indexOf(":")+1);
		}
	}
	for (var i=0; i < document.FROMMERSform.elements.length; i++)  confirmString += document.FROMMERSform.elements[i].name + "=" + document.FROMMERSform.elements[i].value + "\n";
	//if (confirm(confirmString) == true) {
		document.FROMMERSform.submit();
		FrommersWin.focus();
	//}
	return;
}

//02/13/04 mdd < Begin
function gotoPriceMatch() {
	PriceMatchWin = window.open('', 'PriceMatchWin', 'width=800,height=600,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,left=100,top=100'); 

	var confirmString = "POST to " + document.PriceMatchForm.action + "\n=========================\n";
	// .NET adds the controlName:elementName to our form variable names, so remove it.
	for (var i=0; i < document.PriceMatchForm.elements.length; i++)  {
		if (document.PriceMatchForm.elements[i].name.indexOf(":") != -1) {
			document.PriceMatchForm.elements[i].name = document.PriceMatchForm.elements[i].name.substring(document.PriceMatchForm.elements[i].name.indexOf(":")+1);
		}
	}
	for (var i=0; i < document.PriceMatchForm.elements.length; i++)  confirmString += document.PriceMatchForm.elements[i].name + "=" + document.PriceMatchForm.elements[i].value + "\n";
	//if (confirm(confirmString) == true) {
		document.PriceMatchForm.submit();
		PriceMatchWin.focus();
	//}
	return;
}

function gotoRefundRqst() {
	RefundRqstWin = window.open('', 'RefundRqstWin', 'width=800,height=600,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,left=100,top=100'); 

	var confirmString = "POST to " + document.RefundRqstForm.action + "\n=========================\n";
	// .NET adds the controlName:elementName to our form variable names, so remove it.
	for (var i=0; i < document.RefundRqstForm.elements.length; i++)  {
		if (document.RefundRqstForm.elements[i].name.indexOf(":") != -1) {
			document.RefundRqstForm.elements[i].name = document.RefundRqstForm.elements[i].name.substring(document.RefundRqstForm.elements[i].name.indexOf(":")+1);
		}
	}
	for (var i=0; i < document.RefundRqstForm.elements.length; i++)  confirmString += document.RefundRqstForm.elements[i].name + "=" + document.RefundRqstForm.elements[i].value + "\n";
	//if (confirm(confirmString) == true) {
		document.RefundRqstForm.submit();
		RefundRqstWin.focus();
	//}
	return;
}
//02/13/04 mdd < End

//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP( inURL, inMethodName, inVendor, inSite ) {
	var tempHTTP = null;
    if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
   
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");
	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	bod.appendChild( req );
	root.appendChild( bod );
	
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
    
    tempHTTP.setRequestHeader("Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
       
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }    
    }
	
    return(resultXML);
    tempXML = null;
}
//09/12/06 DODD > END

// 01/31/05 nsb start - Uber Calendar - Get origins supported by charter
//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP_WithDate( inURL, inMethodName, inVendor, inSite, inDate ) {
	var tempHTTP = null;
    if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
    
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;

	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");
	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("in_date");
	parm3.appendChild( tempXML.createTextNode( inDate ) );
	var parm4 = tempXML.createElement("in_market");
	parm4.appendChild( tempXML.createTextNode( "O" ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
    
    tempHTTP.setRequestHeader("Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
       
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }    
    }
    	
    return(resultXML);
    tempXML = null;
}
// 01/31/05 nsb end - Uber Calendar - Get origins supported by charter
//09/12/06 DODD > END

//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP_WithDPID( inURL, inMethodName, inVendor, inSite, inPLCode, inDPID ) {
   var tempHTTP = null;
   if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
   } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
   }
   
   var tempXML = null;
   if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
   } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
   }
   
   tempXML.async = false;
   tempXML.preserveWhiteSpace = true;
   
   var root = tempXML.createElement("soap:Envelope");
    root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
    root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
    var bod = tempXML.createElement("soap:Body");
    var req = tempXML.createElement(inMethodName);
    req.setAttribute("xmlns", "http://trisepttech.com/");

    var parm = tempXML.createElement("vendor");
    parm.appendChild( tempXML.createTextNode( inVendor ) );
    var parm2 = tempXML.createElement("site");
    parm2.appendChild( tempXML.createTextNode( inSite ) );
    var parm3 = tempXML.createElement("PrivateLabelCode");
    parm3.appendChild( tempXML.createTextNode( inPLCode ) );
    var parm4 = tempXML.createElement("DynamicPackageId");
    parm4.appendChild( tempXML.createTextNode( inDPID ) );

    req.appendChild( parm );
    req.appendChild( parm2 );
    req.appendChild( parm3 );
    req.appendChild( parm4 );
    bod.appendChild( req );
    root.appendChild( bod );

    tempHTTP.open("POST", inURL, false);
    var SOAPAction = "http://trisepttech.com/" + inMethodName;
    tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
    tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	
   var sendXML;
   if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
   } else {
         sendXML =  root.xml;
   }
   
   tempHTTP.setRequestHeader( "Content-Length", sendXML.length);
   tempHTTP.send( sendXML );
   
   var resultXML;
   if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
   } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }    
   }

   return(resultXML);
   tempXML = null;
}
//09/13/06 DODD > END

//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP_WithDPID_2( inURL, inMethodName, inVendor, inSite, inDest, inPLCode, inDPID ) {
	var tempHTTP = null;
    if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
    
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");
	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("dest");
	parm3.appendChild( tempXML.createTextNode( inDest ) );
	var parm4 = tempXML.createElement("PrivateLabelCode");
	parm4.appendChild( tempXML.createTextNode( inPLCode ) );
	var parm5 = tempXML.createElement("DynamicPackageId");
	parm5.appendChild( tempXML.createTextNode( inDPID ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	req.appendChild( parm5 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
   
    tempHTTP.setRequestHeader( "Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
   
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }    
    }

    return(resultXML);
    tempXML = null;
}
//09/13/06 DODD > END

//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP_WithDPID_3( inURL, inMethodName, inVendor, inSite, inDest, inType, inPLCode, inDPID ) {
	var tempHTTP = null;
    if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
    
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");
	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("dest");
	parm3.appendChild( tempXML.createTextNode( inDest ) );
	var parm4 = tempXML.createElement("type");
	parm4.appendChild( tempXML.createTextNode( inType ) );
	var parm5 = tempXML.createElement("PrivateLabelCode");
	parm5.appendChild( tempXML.createTextNode( inPLCode ) );
	var parm6 = tempXML.createElement("DynamicPackageId");
	parm6.appendChild( tempXML.createTextNode( inDPID ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	req.appendChild( parm5 );
	req.appendChild( parm6 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
   
    tempHTTP.setRequestHeader( "Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
   
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }    
    }

    return(resultXML);
    tempXML = null;
}
// 11/18/04 jbz end
//09/13/06 DODD > END

// 05/05/05 PS - BEGIN
//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
function JS_sendSOAP_CarLocations( inURL, inMethodName, inVendor, inSite, inDestination, inCarBrand, inPLCode, inDPID ) {
	var tempHTTP = null;
	if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
	
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");

	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("destination");
	parm3.appendChild( tempXML.createTextNode( inDestination ) );
	var parm4 = tempXML.createElement("carCompany");
	parm4.appendChild( tempXML.createTextNode( inCarBrand ) );
	var parm5 = tempXML.createElement("privateLabelCode");
	parm5.appendChild( tempXML.createTextNode( inPLCode ) );
	var parm6 = tempXML.createElement("dynamicPackageId");
	parm6.appendChild( tempXML.createTextNode( inDPID ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	req.appendChild( parm5 );
	req.appendChild( parm6 );
	bod.appendChild( req );
	root.appendChild( bod );
	
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
    
    tempHTTP.setRequestHeader( "Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
   
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }
    }
    
    return(resultXML);
    tempXML = null;
}
// 05/05/05 PS - END
//09/12/06 DODD > END

//09/12/06 DODD < START - This will work with Mozilla and IE Clients.
// 04/11/05 GHS - BEGIN
function JS_sendSOAP_WithDPID_HDID( inURL, inMethodName, inVendor, inSite, inPLCode, inDPID, inHDID ) {
	var tempHTTP = null;
    if (window.XMLHttpRequest) {
         tempHTTP = new XMLHttpRequest();
    } else if (window.ActiveXObject){
         tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
   
    var tempXML = null;
    if ((document.implementation) && (document.implementation.createDocument)) {
         tempXML = document.implementation.createDocument("","",null);
    } else if (window.ActiveXObject){
         tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
    }
    
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");
	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("PrivateLabelCode");
	parm3.appendChild( tempXML.createTextNode( inPLCode ) );
	var parm4 = tempXML.createElement("DynamicPackageId");
	parm4.appendChild( tempXML.createTextNode( inDPID ) );
	var parm5 = tempXML.createElement("HotDealID");
	parm5.appendChild( tempXML.createTextNode( inHDID ) );	

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	req.appendChild( parm5 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.open("POST", inURL, false);
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	//tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

    var sendXML;
    if ((document.implementation) && (document.implementation.createDocument)) {
         sendXML = new XMLSerializer().serializeToString(root);
    } else {
         sendXML =  root.xml;
    }
    
    tempHTTP.setRequestHeader( "Content-Length", sendXML.length);
    tempHTTP.send( sendXML );
   
    var resultXML;
    if (window.XMLHttpRequest) {
        resultXML = tempHTTP.responseXML;
    } else {
        if (window.ActiveXObject){
            if ((document.implementation) && (document.implementation.createDocument)) {
                resultXML = document.implementation.createDocument("","",null);
            } else {
                resultXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
            }
            resultXML.loadXML(tempHTTP.responseXML.xml);
        }
    }
    
    return(resultXML);
    tempXML = null;
}
// 04/11/05 GHS - END
// 09/12/06 DODD > END

function GetCarriers( inVendor, inSite ) {
	//alert("document.MainForm.hasXML is " + document.MainForm.hasXML.value + "\ndocument.MainForm.hasVB is " + document.MainForm.hasVB.value );
	var kount;
	var searchPat = "soap:Body/GetCarriersResponse/GetCarriersResult/diffgr:diffgram/GetCarriers/VendorAirlines";
	var carrierTR = FIND("trCarrierClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (carrierTR == "[object]") {
	if (carrierTR) {
		if (carrierTR.style.display == "none") {
			carrierTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetCarriers";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite );
			for (kount = (document.MainForm.selCarrierClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selCarrierClient.options[kount] = null;
			}
			
			var airlineNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                airlineNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetCarriersResponse").item(0).getElementsByTagName("GetCarriersResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("GetCarriers").item(0).getElementsByTagName("VendorAirlines");
            } else {
                airlineNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (airlineNL != null) {
                var text;
                var value;
                
                for (kount = 0; kount < airlineNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = airlineNL.item(kount).getElementsByTagName("Description").item(0).childNodes.item(0).nodeValue;
                        value = airlineNL.item(kount).getElementsByTagName("AirlineCode").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = airlineNL.item(kount).selectSingleNode("Description").text;
                        value = airlineNL.item(kount).selectSingleNode("AirlineCode").text;
                    }
				    document.MainForm.selCarrierClient.options[document.MainForm.selCarrierClient.options.length] = new Option(text, value);
                }
            }
		} else {
			carrierTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}

//05/03/05 JDZ Start
function GetCruiseRegions( inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetCruiseRegionsResponse/GetCruiseRegionsResult/diffgr:diffgram/GetCruiseRegions/VendorCruiseRegions";
	var regionTR = FIND("trRegionClient");
	if (regionTR == "[object]") {	
		if (regionTR.style.display == "none") {
			regionTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetCruiseRegions";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selRegionClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selRegionClient.options[kount] = null;
			}
			var regionNL = soapDOC.documentElement.selectNodes(searchPat);
			//alert( searchPat + "\nFound " + regionNL.length + " in\n" + soapDOC.xml );
			for (kount = 0; kount < regionNL.length; kount++) {
				var opt = new Option(regionNL.item(kount).selectSingleNode("RegionName").text, regionNL.item(kount).selectSingleNode("RegionCode").text);
				document.MainForm.selRegionClient.options[document.MainForm.selRegionClient.options.length] = opt;
			}
		} else {
			regionTR.style.display = "none";
			return (false);
		}
	}
}
function GetDeparturePorts( inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetDeparturePortsResponse/GetDeparturePortsResult/diffgr:diffgram/GetDeparturePorts/VendorDeparturePorts";
	var departureTR = FIND("trDepartureClient");
	if (departureTR == "[object]") {
		if (departureTR.style.display == "none") {
			departureTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetDeparturePorts";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selDeparturePortClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selDeparturePortClient.options[kount] = null;
			}
			var departureNL = soapDOC.documentElement.selectNodes(searchPat);
			//alert( searchPat + "\nFound " + departureNL.length + " in\n" + soapDOC.xml );
			for (kount = 0; kount < departureNL.length; kount++) {
				var opt = new Option(departureNL.item(kount).selectSingleNode("PortName").text, departureNL.item(kount).selectSingleNode("PortCode").text);
				document.MainForm.selDeparturePortClient.options[document.MainForm.selDeparturePortClient.options.length] = opt;
			}
		} else {
			departureTR.style.display = "none";
			return (false);
		}
	}
}
function GetCruiselines( inVendor, inSite ) {
	//alert("document.MainForm.hasXML is " + document.MainForm.hasXML.value + "\ndocument.MainForm.hasVB is " + document.MainForm.hasVB.value );
	var kount;
	var searchPat = "soap:Body/GetCruiselinesResponse/GetCruiselinesResult/diffgr:diffgram/GetCruiselines/VendorCruiseLines";
	var cruiselineTR = FIND("trCruiselineClient");
	if (cruiselineTR == "[object]") {
		if (cruiselineTR.style.display == "none") {
			cruiselineTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetCruiselines";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selCruiselineClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selCruiselineClient.options[kount] = null;
			}
			var cruiselineNL = soapDOC.documentElement.selectNodes(searchPat);
			
			//alert( searchPat + "\nFound " + cruiselineNL.length + " in\n" + soapDOC.xml );
			for (kount = 0; kount < cruiselineNL.length; kount++) {
				var opt = new Option(cruiselineNL.item(kount).selectSingleNode("CruiseLineName").text, cruiselineNL.item(kount).selectSingleNode("CruiselineCode").text);
				document.MainForm.selCruiselineClient.options[document.MainForm.selCruiselineClient.options.length] = opt;
			}
		} else {
			cruiselineTR.style.display = "none";
			return (false);
		}
	}
}
//05/03/05 JDZ End

function GetHotelBrands(inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetHotelBrandsResponse/GetHotelBrandsResult/diffgr:diffgram/GetHotelBrands/VendorHotelChains";
	var hotelBrandTR = FIND("trHotelBrandClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (hotelBrandTR == "[object]") {
	if (hotelBrandTR) {
	   if (hotelBrandTR.style.display == "none") {
			hotelBrandTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetHotelBrands";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite );
			for (kount = (document.MainForm.selHotelBrandClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selHotelBrandClient.options[kount] = null;
			}
			
			var hotelBrandNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                hotelBrandNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetHotelBrandsResponse").item(0).getElementsByTagName("GetHotelBrandsResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("GetHotelBrands").item(0).getElementsByTagName("VendorHotelChains");
            } else {
                hotelBrandNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (hotelBrandNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < hotelBrandNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = hotelBrandNL.item(kount).getElementsByTagName("ChainName").item(0).childNodes.item(0).nodeValue;
                        value = hotelBrandNL.item(kount).getElementsByTagName("IntChainCode").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = hotelBrandNL.item(kount).selectSingleNode("ChainName").text;
                        value = hotelBrandNL.item(kount).selectSingleNode("IntChainCode").text;
                    }
				    document.MainForm.selHotelBrandClient.options[document.MainForm.selHotelBrandClient.options.length] = new Option(text, value);
               }
            }
		} else {
			hotelBrandTR.style.display = "none";
			return (false);
		}
	}
}

function GetCarCompanies(inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetCarCompaniesResponse/GetCarCompaniesResult/diffgr:diffgram/GetCarCompanies/VendorCarCompanies";
	var carCompanyTR = FIND("trCarCompanyClient");
	// 08/16/05 FDR Start Fix multiple dropdown showing when a dropdown is showing, brand is invalid and then clicking on the search then cliking on the info brand icon.
	var carBrandTR = FIND("trCarCompanyBrand");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (carBrandTR == "[object]") 
	if (carBrandTR) {
		if (carBrandTR.style.display == "inline" && carBrandTR.innerText != "") {   
			carBrandTR.style.display = "none";
		} else {
		   //if (carCompanyTR == "[object]") {
	       if (carCompanyTR) {
				if (carCompanyTR.style.display == "none") {
					carCompanyTR.style.display = "block";
					var URL = g_BASE_SOAP_URL;
					var methodName = "GetCarCompanies";
					var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite );
					for (kount = (document.MainForm.selCarCompanyClient.options.length - 1); kount >= 0; kount--) {
						document.MainForm.selCarCompanyClient.options[kount] = null;
					}
					
					var carCompanyNL;
			        if ((document.implementation) && (document.implementation.createDocument)){
                        carCompanyNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetCarCompaniesResponse").item(0).getElementsByTagName("GetCarCompaniesResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("GetCarCompanies").item(0).getElementsByTagName("VendorCarCompanies");
                    } else {
                        carCompanyNL = soapDOC.documentElement.selectNodes(searchPat);
                    }
                    
                    if (carCompanyNL != null){
                        var text;
                        var value;
                        
                        for (kount = 0; kount < carCompanyNL.length; kount++) {
                            if ((document.implementation) && (document.implementation.createDocument)) {
                                text = carCompanyNL.item(kount).getElementsByTagName("CompanyName").item(0).childNodes.item(0).nodeValue;
                                value = carCompanyNL.item(kount).getElementsByTagName("InternalCarCompanyCode").item(0).childNodes.item(0).nodeValue;
                            } else {
                                text = carCompanyNL.item(kount).selectSingleNode("CompanyName").text;
                                value = carCompanyNL.item(kount).selectSingleNode("InternalCarCompanyCode").text;
                            }
				            document.MainForm.selCarCompanyClient.options[document.MainForm.selCarCompanyClient.options.length] = new Option(text, value);
                       }
                    }
				} else {
					carCompanyTR.style.display = "none";
					return (false);
				}
			}		
		}
	}
	// for regular search, trCarCompanyBrand row does not exist
	else {
	  //if (carCompanyTR == "[object]") {
	  if (carCompanyTR) {
		if (carCompanyTR.style.display == "none") {
			carCompanyTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetCarCompanies";
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selCarCompanyClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selCarCompanyClient.options[kount] = null;
			}
			
			var carCompanyNL;
	        if ((document.implementation) && (document.implementation.createDocument)){
                carCompanyNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetCarCompaniesResponse").item(0).getElementsByTagName("GetCarCompaniesResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("GetCarCompanies").item(0).getElementsByTagName("VendorCarCompanies");
            } else {
                carCompanyNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (carCompanyNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < carCompanyNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = carCompanyNL.item(kount).getElementsByTagName("CompanyName").item(0).childNodes.item(0).nodeValue;
                        value = carCompanyNL.item(kount).getElementsByTagName("InternalCarCompanyCode").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = carCompanyNL.item(kount).selectSingleNode("CompanyName").text;
                        value = carCompanyNL.item(kount).selectSingleNode("InternalCarCompanyCode").text;
                    }
		            document.MainForm.selCarCompanyClient.options[document.MainForm.selCarCompanyClient.options.length] = new Option(text, value);
               }
            }
		} else {
			carCompanyTR.style.display = "none";
			return (false);
		}
	  }
	}
	// 08/16/05 FDR End
   // 9/12/06 DODD > END
}

// 05/05/05 PS Start
// Purpose - Retrieve a list of car pickup/dropoff for a given vendor, destionation, carcompany combination
function GetVendorCarLocations(inVendor, inSite, inCarBrand, inParentControlName, inPLCode, inDPID) {
	var kount;
	var l_dest;
	var l_carBrand;
	var searchPat = "soap:Body/GetVendorCarLocationsResponse/GetVendorCarLocationsResult/diffgr:diffgram/GetVendorCarLocations/VendorCarLocations";
	var URL = g_BASE_SOAP_URL;
	var methodName = "GetVendorCarLocations";
	
	// get destination
	var DestTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtDestination");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (DestTextBox == "[object]") {
	if (DestTextBox) {
	  l_dest = DestTextBox.value;
	} else {
	    l_dest = FIND("RequestDes").value;
	}
		
	if ( l_dest.length <= 0) {
	    alert("Destination must be entered to get car locations") ;
	    return;
	}
	if ((inCarBrand.length <= 0 ) || (inCarBrand.toUpperCase().indexOf("ALL") >= 0) ){
		alert("Specific car brand must be selected to view car pickup/dropoff locations") ;
		return;
	}
	
	var soapDOC = JS_sendSOAP_CarLocations( URL, methodName, inVendor, inSite , l_dest, inCarBrand, inPLCode, inDPID);
	// clear out the combobox list
	
	//var pickCtrl = FIND(g_ControlContainerID + "CarSearch1_selPickUpLocationClient");
	//var dropCtrl = FIND(g_ControlContainerID + "CarSearch1_selDropOffLocationClient");
	var pickCtrl = FIND(g_ControlContainerID + inParentControlName + "_selPickUpLocationClient");
	var dropCtrl = FIND(g_ControlContainerID + inParentControlName+ "_selDropOffLocationClient");
	for (kount = pickCtrl.options.length; kount >=0; kount-- ) {
		pickCtrl.options[kount] = null;
		dropCtrl.options[kount] = null;
	}
	
	var carLocationNL;
	if ((document.implementation) && (document.implementation.createDocument)){
        carLocationNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetVendorCarLocationsResponse").item(0).getElementsByTagName("GetVendorCarLocationsResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("GetVendorCarLocations").item(0).getElementsByTagName("VendorCarLocations");
    } else {
        carLocationNL = soapDOC.documentElement.selectNodes(searchPat);
    }

	if (carLocationNL.length == 0 ){
	// 07/28/05 FDR Start Rearrange verbage of the warning.
	// alert("No '" +  inCarBrand  + "' pickup/dropoff locations found" + " in " +  l_dest )
	   alert("No pickup/dropoff locations found" + " in " +  l_dest.toUpperCase() + " for " +  inCarBrand + " brand")
    // 07/28/05 FDR End
	}
	    
    var defaultItemIdx = 0
    var code;
    var desc;
    var defaultInd;
    for (kount = 0; kount < carLocationNL.length; kount++) {
        if ((document.implementation) && (document.implementation.createDocument)) {
            code = carLocationNL.item(kount).getElementsByTagName("TriseptLocationCode").item(0).childNodes.item(0).nodeValue;
            desc = carLocationNL.item(kount).getElementsByTagName("ShortDescription").item(0).childNodes.item(0).nodeValue; 
            defaultInd = carLocationNL.item(kount).getElementsByTagName("DefaultLocationInd").item(0).childNodes.item(0).nodeValue;
        } else {
            code = carLocationNL.item(kount).selectSingleNode("TriseptLocationCode").text 
            desc = carLocationNL.item(kount).selectSingleNode("ShortDescription").text 
            defaultInd = carLocationNL.item(kount).selectSingleNode("DefaultLocationInd");
        }
        
        if ( defaultInd != null) {
		    if (defaultInd.text == 'Y' ) {
			    defaultItemIdx = kount
		    }
        }
	   	   
	    var optP = new Option(desc, code + "|" + desc);
	    var optD = new Option(desc,code + "|" + desc);
	    pickCtrl.options[pickCtrl.options.length] = optP;
	    dropCtrl.options[dropCtrl.options.length] = optD;
	}
	  
	// set default item
	pickCtrl.selectedIndex = defaultItemIdx
	dropCtrl.selectedIndex = defaultItemIdx
}
// 05/05/05 PS END

function GetOrigins(inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetOriginsResponse/GetOriginsResult/diffgr:diffgram/NewDataSet/Origins";
	var originTR = FIND("trOriginClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (originTR == "[object]") {
	if (originTR) {
		if (originTR.style.display == "none") {
			originTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetOrigins";
			if (inVendor == "ALL" ) {
				inVendor = "";
			}
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selOriginClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selOriginClient.options[kount] = null;
			}
			var originNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                originNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetOriginsResponse").item(0).getElementsByTagName("GetOriginsResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Origins");
            } else {
                originNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (originNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < originNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = originNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = originNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = originNL.item(kount).selectSingleNode("LongName").text;
                        value = originNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selOriginClient.options[document.MainForm.selOriginClient.options.length] = new Option(text, value);
               }
            }
		} else {
			originTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}

// 11/18/04 jbz start - markets by dynamic package type project added in a new function
// to call new VAX70Info web method
function GetOriginsByDynamicPackageType(inVendor, inSite, inPLCode, inDPID) {
	//alert(inVendor + " site: " + inSite + " plcode:" + inPLCode + " dpid:" + inDPID)
	var kount;
	var searchPat = "soap:Body/GetOriginsByDynamicPackageTypeResponse/GetOriginsByDynamicPackageTypeResult/diffgr:diffgram/NewDataSet/Origins";
	var originTR = FIND("trOriginClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (originTR == "[object]") {
	if (originTR) {
		if (originTR.style.display == "none") {
			originTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetOriginsByDynamicPackageType";
			var soapDOC = JS_sendSOAP_WithDPID( URL, methodName, inVendor, inSite, inPLCode, inDPID );
			for (kount = (document.MainForm.selOriginClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selOriginClient.options[kount] = null;
			}
			
			var originNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                originNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetOriginsByDynamicPackageTypeResponse").item(0).getElementsByTagName("GetOriginsByDynamicPackageTypeResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Origins");
            } else {
                originNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (originNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < originNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = originNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = originNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = originNL.item(kount).selectSingleNode("LongName").text;
                        value = originNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selOriginClient.options[document.MainForm.selOriginClient.options.length] = new Option(text, value);
                }
            }
		} else {
			originTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}
// 11/18/04 jbz end

// 01/31/05 nsb start - Uber Calendar - Get origins supported by charter
function GetOriginsForCharter(inVendor, inSite, inDate) {
	var kount;
	var searchPat = "soap:Body/GetMarketsForCharterResponse/GetMarketsForCharterResult/diffgr:diffgram/NewDataSet/Table";
	var originTR = FIND("trOriginClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (originTR == "[object]") {
	if (originTR) {
		if (originTR.style.display == "none") {
			originTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetMarketsForCharter";
			var soapDOC = JS_sendSOAP_WithDate( URL, methodName, inVendor, inSite, inDate )
			for (kount = (document.MainForm.selOriginClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selOriginClient.options[kount] = null;
			}
			
			var originNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                originNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetMarketsForCharterResponse").item(0).getElementsByTagName("GetMarketsForCharterResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Table");
            } else {
                originNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (originNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < originNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = originNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = originNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = originNL.item(kount).selectSingleNode("LongName").text;
                        value = originNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selOriginClient.options[document.MainForm.selOriginClient.options.length] = new Option(text, value);
                }
            }
		} else {
			originTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}
// 01/31/05 nsb end

// 04/11/05 GHS - BEGIN Markets by dynamic package type project added in a new function
// to call new VAX70Info web method
function GetOriginsByHotDeal(inVendor, inSite, inPLCode, inDPID, inHDID) {
	var kount;
	var searchPat = "soap:Body/GetOriginsByHotDealResponse/GetOriginsByHotDealResult/diffgr:diffgram/NewDataSet/Origins";
	var originTR = FIND("trOriginClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (originTR == "[object]") {
	if (originTR) {
		if (originTR.style.display == "none") {
			originTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetOriginsByHotDeal";
			var soapDOC = JS_sendSOAP_WithDPID_HDID( URL, methodName, inVendor, inSite, inPLCode, inDPID, inHDID )
			for (kount = (document.MainForm.selOriginClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selOriginClient.options[kount] = null;
			}
			
			var originNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                originNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetOriginsByHotDealResponse").item(0).getElementsByTagName("GetOriginsByHotDealResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Origins");
            } else {
                originNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
			if (originNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < originNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = originNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = originNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = originNL.item(kount).selectSingleNode("LongName").text;
                        value = originNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selOriginClient.options[document.MainForm.selOriginClient.options.length] = new Option(text, value);
                }
            }
		} else {
			originTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}
// 04/11/05 GHS - END

function GetDestinations(inVendor, inSite) {
	var kount;
	var searchPat = "soap:Body/GetDestinationsResponse/GetDestinationsResult/diffgr:diffgram/NewDataSet/Destinations";
	var DestinationTR = FIND("trDestinationClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (DestinationTR == "[object]") {
	if (DestinationTR) {
		if (DestinationTR.style.display == "none") {
			DestinationTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetDestinations";
			if (inVendor == "ALL" ) {
				inVendor = "";
			}			
			var soapDOC = JS_sendSOAP( URL, methodName, inVendor, inSite )
			for (kount = (document.MainForm.selDestinationClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selDestinationClient.options[kount] = null;
			}
			
			var DestinationTR;
			if ((document.implementation) && (document.implementation.createDocument)){
                DestinationTR = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetDestinationsResponse").item(0).getElementsByTagName("GetDestinationsResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Destinations");
            } else {
                DestinationTR = soapDOC.documentElement.selectNodes(searchPat);
            }
            
			if (DestinationTR != null){
                var text;
                var value;
                
                for (kount = 0; kount < DestinationTR.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = DestinationTR.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = DestinationTR.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = DestinationTR.item(kount).selectSingleNode("LongName").text;
                        value = DestinationTR.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				   document.MainForm.selDestinationClient.options[document.MainForm.selDestinationClient.options.length] = new Option(text, value);
                }
            }
		} else {
			DestinationTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}

//12/23/05 JDZ Start
function HideGenericCruise(objName) {
	var objectTR = FIND(objName);
	if (objectTR == "[object]") {
		objectTR.style.display = "none";
	}
}
//12/23/05 JDZ End

// 11/18/04 jbz start - markets by dynamic package type project added in a new function
// to call new VAX70Info web method
function GetDestinationsByDynamicPackageType(inVendor, inSite, inPLCode, inDPID) {
    var kount;
	var searchPat = "soap:Body/GetDestinationsByDynamicPackageTypeResponse/GetDestinationsByDynamicPackageTypeResult/diffgr:diffgram/NewDataSet/Destinations";
	var DestinationTR = FIND("trDestinationClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (DestinationTR == "[object]") {
	if (DestinationTR) {
		if (DestinationTR.style.display == "none") {
			DestinationTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetDestinationsByDynamicPackageType";
			var soapDOC = JS_sendSOAP_WithDPID( URL, methodName, inVendor, inSite, inPLCode, inDPID );
			for (kount = (document.MainForm.selDestinationClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selDestinationClient.options[kount] = null;
			}
			
			var DestinationNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                DestinationNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetDestinationsByDynamicPackageTypeResponse").item(0).getElementsByTagName("GetDestinationsByDynamicPackageTypeResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Destinations");
            } else {
                DestinationNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (DestinationNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < DestinationNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = DestinationNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = DestinationNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = DestinationNL.item(kount).selectSingleNode("LongName").text;
                        value = DestinationNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selDestinationClient.options[document.MainForm.selDestinationClient.options.length] = new Option(text, value);
                }
            }
		} else {
			DestinationTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}
// 11/18/04 jbz end

// 04/11/05 GHS - BEGIN Markets by hot deal project added in a new function
function GetDestinationsByHotDeal(inVendor, inSite, inPLCode, inDPID, inHDID) {
	var kount;
	var searchPat = "soap:Body/GetDestinationsByHotDealResponse/GetDestinationsByHotDealResult/diffgr:diffgram/NewDataSet/Destinations";
	var DestinationTR = FIND("trDestinationClient");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (DestinationTR == "[object]") {
	if (DestinationTR) {
		if (DestinationTR.style.display == "none") {
			DestinationTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetDestinationsByHotDeal";
			var soapDOC = JS_sendSOAP_WithDPID_HDID( URL, methodName, inVendor, inSite, inPLCode, inDPID, inHDID)
			for (kount = (document.MainForm.selDestinationClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selDestinationClient.options[kount] = null;
			}
			
			var DestinationNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                DestinationNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetDestinationsByHotDealResponse").item(0).getElementsByTagName("GetDestinationsByHotDealResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Destinations");
            } else {
                DestinationNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
            if (DestinationNL != null){
                var text;
                var value;
                
                for (kount = 0; kount < DestinationNL.length; kount++) {
                    if ((document.implementation) && (document.implementation.createDocument)) {
                        text = DestinationNL.item(kount).getElementsByTagName("LongName").item(0).childNodes.item(0).nodeValue;
                        value = DestinationNL.item(kount).getElementsByTagName("AssociatedAirport").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = DestinationNL.item(kount).selectSingleNode("LongName").text;
                        value = DestinationNL.item(kount).selectSingleNode("AssociatedAirport").text;
                    }
				    document.MainForm.selDestinationClient.options[document.MainForm.selDestinationClient.options.length] = new Option(text, value);
                }
             }
		} else {
			DestinationTR.style.display = "none";
			return (false);
		}
	}
}
// 04/11/05 GHS - END

// 11/18/04 jbz start - adding a couple of extra params to this function
function GetPointsOfInterestByDestination(inVendor, inSite, inType, inPLCode, inDPID) {
	//alert("GetPointsOfInterestByDestination('" + inVendor + "', '" + inSite + "', '" + inType + "') was called.");
	var kount;
	var l_dest;
	var searchPat = "soap:Body/GetPointsOfInterestByDestinationResponse/GetPointsOfInterestByDestinationResult/diffgr:diffgram/NewDataSet/Table1";
	// 02/07/05 TJK - Use global javascript variable to make this find work for the _ResTool.ascx as well.
	//var DestTextBox = FIND("GeneralSearch1:txtDestination");
	var DestTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtDestination");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (DestTextBox == "[object]") {
	if (DestTextBox) {
	  l_dest = DestTextBox.value;
	} else {
		// 03/04/05 TJK - Use the FIND function.
	    //l_dest = document.MainForm.RequestDes.value;
	    l_dest = FIND("RequestDes").value;
	}
	if (l_dest == "") {
			alert("You must first choose a destination.")
			var LandmarkListTR = FIND("trLandmarkListClient");
			LandmarkListTR.style.display = "none";
			return (false);					
	}
	
	// See if we have Pegasus results for this destination in the first place.
	var URL = g_BASE_SOAP_URL;
	var methodName = "POISupportedByDestination";
	
	// 11/18/04 jbz start - calling new js function
	//var soapDOC = JS_sendSOAP_3( URL, methodName, inVendor, inSite, l_dest);
	var soapDOC = JS_sendSOAP_WithDPID_2( URL, methodName, inVendor, inSite, l_dest, inPLCode, inDPID);
            
	if (soapDOC.xml.indexOf("true") <= 0) {
			var LandmarkListTR = FIND("trLandmarkListClient");
			LandmarkListTR.style.display = "none";
			alert("This destination does not support the Search by Landmark functionality.")
			//__ 10/07/04 TJK (START) - If the destination does not support the Search by Landmark functionality
			//							we must reset the Landmark drop down to the initial value.
			// 02/07/05 TJK - Use global javascript variable to make this find work for the _ResTool.ascx as well.
			//var cboLandmark = FIND("HotelSearch1:cboLandmark");
			var cboLandmark = FIND(g_ControlContainerID + "HotelSearch1_cboLandmark");
			//if (cboLandmark == "[object]") {
			if (cboLandmark) {
				cboLandmark.options.selectedIndex = 0;
			}
			//__ 10/07/04 TJK (STOP)
			return (false);				
	}
	
	var LandmarkListTR = FIND("trLandmarkListClient");
	//if (LandmarkListTR == "[object]") {
	if (LandmarkListTR) {
		//if (LandmarkListTR.style.display == "none") {
		if ((LandmarkListTR.style.display == "none")||(inType!="")) {
			LandmarkListTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetPointsOfInterestByDestination";
			// 11/18/04 jbz start - calling new js function
			//alert("JS_sendSOAP_WithDPID_3('" + URL + "', '" + methodName + "', '" + inVendor + "', '" + inSite + "', '" + l_dest + "', '" + inType + "', '" + inPLCode + "', '" + inDPID + "') was called.");
			var soapDOC = JS_sendSOAP_WithDPID_3( URL, methodName, inVendor, inSite, l_dest, inType, inPLCode, inDPID);
			for (kount = (document.MainForm.selLandmarkListClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selLandmarkListClient.options[kount] = null;
			}
			
			var LandmarkListNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                LandmarkListNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetPointsOfInterestByDestinationResponse").item(0).getElementsByTagName("GetPointsOfInterestByDestinationResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("Table1");
            } else {
                LandmarkListNL = soapDOC.documentElement.selectNodes(searchPat);
            }
            
			if(LandmarkListNL.length < 1) {
			    LandmarkListTR.style.display = "none";
			    alert("There are no landmarks of that type available for your destination.");
			    //__ 10/07/04 TJK (START) - If there are no landmarks of that type available for the destination
			    //							we must reset the Landmark drop down to the initial value.
			    // 02/07/05 TJK - Use global javascript variable to make this find work for the _ResTool.ascx as well.
			    //var cboLandmark = FIND("HotelSearch1:cboLandmark");
			    var cboLandmark = FIND(g_ControlContainerID + "HotelSearch1_cboLandmark");
			    //if (cboLandmark == "[object]") {
                if (cboLandmark) {
				    cboLandmark.options.selectedIndex = 0;
			    }
			    //__ 10/07/04 TJK (STOP)
			    return (false);				
			 } else {
			    //alert( searchPat + "\nFound " + LandmarkListNL.length + " in\n" + soapDOC.xml );
			    if (inType == "DWTN") {
		            var text;
		            var value;
		            if ((document.implementation) && (document.implementation.createDocument)) {
                        text = LandmarkListNL.item(0).getElementsByTagName("Name").item(0).childNodes.item(0).nodeValue;
                        value = LandmarkListNL.item(0).getElementsByTagName("LatitudeAndLongitude").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = LandmarkListNL.item(0).selectSingleNode("Name").text;
                        value = LandmarkListNL.item(0).selectSingleNode("LatitudeAndLongitude").text;
                    }
				    document.MainForm.selLandmarkListClient.options[document.MainForm.selLandmarkListClient.options.length] = new Option(text, value);			
			    } else {		
			        var text;
			        var value;
				    for (kount = 0; kount < LandmarkListNL.length; kount++) {
					    if ((document.implementation) && (document.implementation.createDocument)) {
                            text = LandmarkListNL.item(kount).getElementsByTagName("Name").item(0).childNodes.item(0).nodeValue;
                            value = LandmarkListNL.item(kount).getElementsByTagName("LatitudeAndLongitude").item(0).childNodes.item(0).nodeValue;
                        } else {
                            text = LandmarkListNL.item(kount).selectSingleNode("Name").text;
                            value = LandmarkListNL.item(kount).selectSingleNode("LatitudeAndLongitude").text;
                        }
					    document.MainForm.selLandmarkListClient.options[document.MainForm.selLandmarkListClient.options.length] = new Option(text, value);
				    }
			    }
			}
		} else {
			LandmarkListTR.style.display = "none";
			return (false);
		}
	}
	//09/12/06 DODD > END
}

// 11/18/04 jbz start - markets by dynamic package type project added in new params for this function
function GetFares(inVendor, inSite, inCabin, inPLCode, inDPID)
{
	var kount;
	var l_dest, l_org
	var searchPat = "soap:Body/GetFareTypesResponse/GetFareTypesResult/diffgr:diffgram/NewDataSet/VendorFarePreference";
	// 02/07/05 TJK - Use global javascript variable to make this find work for the _ResTool.ascx as well.
	//var OrgTextBox = FIND("GeneralSearch1:txtOrigin");
	var OrgTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtOrigin");
	//09/12/06 DODD < START - Updated to Work with Mozilla Clients
	//if (OrgTextBox == "[object]") {
	if (OrgTextBox) {
	  l_org = OrgTextBox.value;
	} else {
	  // 03/04/05 TJK - Use the FIND function.
	  //l_org = document.MainForm.RequestOrg.value;
	  l_org = FIND("RequestOrg").value;
	}
	if (l_org == "")
	{
			alert("You must first choose an origin.")
			trFareClient.style.display = "none";
			return (false);					
	}
	// 02/07/05 TJK - Use global javascript variable to make this find work for the _ResTool.ascx as well.
	//var DestTextBox = FIND("GeneralSearch1:txtDestination");
	var DestTextBox = FIND(g_ControlContainerID + "GeneralSearch1_txtDestination");
	//if (DestTextBox == "[object]") {
	if (DestTextBox) {
	  l_dest = DestTextBox.value;
	} else {
	  // 03/04/05 TJK - Use the FIND function.
	  //l_dest = document.MainForm.RequestDes.value;
	  l_dest = FIND("RequestDes").value;
	}
	if (l_dest == "")
	{
			alert("You must first choose a destination.")
			trFareClient.style.display = "none";
			return (false);					
	}
	// 12/16/04 SMP -- Need to pass this in instead of figuring it out here, otherwise it's undefined for the minisearch!
	//var CabinDropDown = FIND("AirSearch1:cboCabinPreference");
	//if (CabinDropDown == "[object]") {
	//  l_cabin = CabinDropDown.value;
	//}
	//if (l_cabin == "")
	if (inCabin == "")
	{
			alert("You must first choose a cabin type.")
			trFareClient.style.display = "none";
			return (false);					
	}
	var FareTR = FIND("trFareClient");
	//if (FareTR == "[object]") {
	if (FareTR) {
		if (FareTR.style.display == "none") {
			FareTR.style.display = "block";
			var URL = g_BASE_SOAP_URL;
			var methodName = "GetFareTypes";
			// No real reason to create a JS_sendSOAP_3 that takes seven arguments instead of 4 or 6 at the moment, so just squeeze org and des together
			var org_and_des = l_org + "|" + l_dest
			// 11/18/04 jbz start - calling new js function that takes in plcode and dynamic package type as params
			//var soapDOC = JS_sendSOAP_2( URL, methodName, inVendor, inSite, org_and_des, l_cabin )
			var soapDOC = JS_sendSOAP_WithDPID_3( URL, methodName, inVendor, inSite, org_and_des, inCabin, inPLCode, inDPID)
			for (kount = (document.MainForm.selFareClient.options.length - 1); kount >= 0; kount--) {
				document.MainForm.selFareClient.options[kount] = null;
			}
			
			var FareNL;
			if ((document.implementation) && (document.implementation.createDocument)){
                FareNL = soapDOC.documentElement.getElementsByTagName("Body").item(0).getElementsByTagName("GetFareTypesResponse").item(0).getElementsByTagName("GetFareTypesResult").item(0).getElementsByTagName("diffgram").item(0).getElementsByTagName("NewDataSet").item(0).getElementsByTagName("VendorFarePreference");
            } else {
                FareNL = soapDOC.documentElement.selectNodes(searchPat);
            }
			
			if(FareNL.length < 1) {
				FareTR.style.display = "none";
				alert("There are no fare types available for your choice of origin, destination, and cabin.")
				return (false);		
			} else {
			    var text;
			    var value;
				 for (kount = 0; kount < FareNL.length; kount++) {
					if ((document.implementation) && (document.implementation.createDocument)) {
                        text = FareNL.item(kount).getElementsByTagName("Description").item(0).childNodes.item(0).nodeValue;
                        value = FareNL.item(kount).getElementsByTagName("FarePreferenceCode").item(0).childNodes.item(0).nodeValue;
                    } else {
                        text = FareNL.item(kount).selectSingleNode("Description").text;
                        value = FareNL.item(kount).selectSingleNode("FarePreferenceCode").text;
                    } 
					document.MainForm.selFareClient.options[document.MainForm.selFareClient.options.length] = new Option(text, value);
				}
			}
		} else {
			FareTR.style.display = "none";
			return (false);
		}
	}
}

function JS_sendSOAP_2( inURL, inMethodName, inVendor, inSite , inDest, inType) {
	var tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	var tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");

	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("dest");
	parm3.appendChild( tempXML.createTextNode( inDest ) );
	var parm4 = tempXML.createElement("type");
	parm4.appendChild( tempXML.createTextNode( inType ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	req.appendChild( parm4 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.Open( "POST", inURL, false );
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

	//alert(root.xml);
	tempHTTP.Send( root.xml );
	tempXML.loadXML( tempHTTP.responseXML.xml );
	if (tempXML.parseError.errorCode == 0) {
		//alert( tempXML.xml );
	} else {
		alert( tempHTTP.responseText );
	}
	return (tempXML);
	tempXML = null;
}

function JS_sendSOAP_3( inURL, inMethodName, inVendor, inSite , inDest) {
	var tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	var tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");

	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://trisepttech.com/");

	var parm = tempXML.createElement("vendor");
	parm.appendChild( tempXML.createTextNode( inVendor ) );
	var parm2 = tempXML.createElement("site");
	parm2.appendChild( tempXML.createTextNode( inSite ) );
	var parm3 = tempXML.createElement("dest");
	parm3.appendChild( tempXML.createTextNode( inDest ) );

	req.appendChild( parm );
	req.appendChild( parm2 );
	req.appendChild( parm3 );
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.Open( "POST", inURL, false );
	var SOAPAction = "http://trisepttech.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

	tempHTTP.Send( root.xml );
	tempXML.loadXML( tempHTTP.responseXML.xml );
	if (tempXML.parseError.errorCode == 0) {
		//alert( tempXML.xml );
	} else {
		alert( tempHTTP.responseText );
	}
	return (tempXML);
	tempXML = null;
}

function DisplayItineraryEmail( inCartID ) {
	// 11/09/05 LDG < Switch to use new email tool.
	//var emailPath = "../Common/EmailItinerary.aspx?CartId=" + inCartID
	var emailPath = "../Common/EmailItinerary2.aspx?CartId=" + inCartID
	ItineraryEmailWin = window.open(emailPath, 'ItineraryEmailWin', 'width=800,height=500,resizable=1,status=1,scrollbars=1,toolbar=0');
	//alert("Chris will implement the DisplayCartEmail(\"" + inCartID + "\") function.");
	return;
}

// 04/12/05 FGD START >
function DisplayHotDealEmail( inHotDealID,inVendorID,inVendorLogoURL ) {
	var emailPath = "../Common/HotDealEmail.aspx?HotDealID=" + inHotDealID + "&Vendor=" + inVendorID + "&VendorLogoURL=" + inVendorLogoURL
	ItineraryEmailWin = window.open(emailPath, 'HotDealEmailWin', 'width=800,height=500,resizable=1,status=1,scrollbars=1,toolbar=0');
	return;
} // FGD < END

var g_BASE_SOAP_URL = "";	// This needs to be set inorder for any of the SOAP calls to work..
var g_PROFILES_SOAP_URL = "";	// This needs to be set inorder for any of the SOAP calls to work..
var g_REGISTRATIONS_SOAP_URL = ""; // This will allow us to connect to Registrations.asmx

//Caller ID Client Side Routines
var g_UserID = "";
var g_TourOp = "";
var g_SBU = "";
var g_VendorCode = "";
// BJS 12/02/03 - BEGIN
var g_SiteCodes = "";
// BJS 12/02/03 - END
var g_PrivateLabel = "";	// 05/19/05 LDG < Registrations needs private label.

function setCallerType(callerType) {
	var hidRadAgentClient = FIND("Header_hidRadAgentClient");
	//if (hidRadAgentClient == "[object]") {    // 08/09/06 LDG < make work for FireFox and Safari.
	if ((hidRadAgentClient == "[object]")||(hidRadAgentClient == "[object HTMLInputElement]")||(hidRadAgentClient == "[object INPUT]")) {
		hidRadAgentClient.value = callerType;
	} else {
		alert("Header_hidRadAgentClient Not Found - CallerIDAgencyLookup");
	}
	clearCallerID();
}

function FindControl(controlName) {
	var tempControl = FIND(controlName);
	if (tempControl != "[object]") {
		alert("ERROR - JS could not find " + controlName + " control");
	}	
	return tempControl;
}

function GetXMLNodeValue(XMLDOC, searchPat) {
	var XMLnodes = XMLDOC.documentElement.selectNodes(searchPat);
	//alert(XMLnodes.item(0).xml)
	if (!(XMLnodes.length)) {
		alert("ERROR - JS cound not find XML node " + searchPat);
	} else {
		return XMLnodes.item(0).text;
	}
}

// BJS 12/02/03 - BEGIN
function processProfileErrors(xmlReply)
{
	var errors;
	var severeErrors;
	var errorNode;

	errors = xmlReply.documentElement.selectNodes("//Error");

	// I need to get a count of only the severe errors, because if only a warning comes back, then I still
	//   want to raise the PasswordSent Event.
	
	severeErrors = errors.length;
	var i = 0;
	for(i = 0; i <= errors.count; i++)
	{
		if(errorNode.Attributes("Severity").Value = "1") // Warning
		{
			severeErrors = severeErrors--;
		}
	}
	
	return severeErrors;
}
// BJS 12/02/03 - END

var g_trSubscriptions = "";	// 01/24/06 LDG < Define variable.

function JS_sendProfilesSOAP( inURL, inMethodName, Email, Phone, VendorCode, UserID, Site, Name) {
	var tempXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
	tempXML.async = false;
	tempXML.preserveWhiteSpace = true;
	var tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	var root = tempXML.createElement("soap:Envelope");
	root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
	var bod = tempXML.createElement("soap:Body");

	var req = tempXML.createElement(inMethodName);
	req.setAttribute("xmlns", "http://triseptsolutions.com/");

	if (inMethodName == "getAllValues") {
		var parm = tempXML.createElement("cuid");
		parm.appendChild( tempXML.createTextNode( UserID ) );
			
		req.appendChild( parm );
	} else {
		if (inMethodName == "getCuid") {
			var parm = tempXML.createElement("email");
			parm.appendChild( tempXML.createTextNode( Email ) );
			var parm2 = tempXML.createElement("vendor");
			parm2.appendChild( tempXML.createTextNode( VendorCode ) );
			var parm3 = tempXML.createElement("phone");
			parm3.appendChild( tempXML.createTextNode( Phone ) );
			var parm4 = tempXML.createElement("site");
			parm4.appendChild( tempXML.createTextNode( Site ) );
							
			req.appendChild( parm );
			req.appendChild( parm2 );
			req.appendChild( parm3 );
			req.appendChild( parm4 );
		} else {
			if(inMethodName == "getValue")
			{
				var parm = tempXML.createElement("cuid");
				parm.appendChild( tempXML.createTextNode( UserID ) );
				var parm2 = tempXML.createElement("name");
				parm2.appendChild( tempXML.createTextNode( Name ) );
				var parm3 = tempXML.createElement("vendor");
				parm3.appendChild( tempXML.createTextNode( VendorCode ) );
					
				req.appendChild( parm );
				req.appendChild( parm2 );
				req.appendChild( parm3 );
			}
		}
	}
	bod.appendChild( req );
	root.appendChild( bod );
	tempHTTP.Open( "POST", inURL, false );
	var SOAPAction = "http://triseptsolutions.com/" + inMethodName;
	tempHTTP.setRequestHeader( "SOAPAction", SOAPAction);
	tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
	tempHTTP.setRequestHeader( "Content-Length", root.xml.length);

	//alert(root.xml);
	tempHTTP.Send( root.xml );
	tempXML.loadXML( tempHTTP.responseXML.xml );
	if (tempXML.parseError.errorCode == 0) {
		//alert( tempXML.xml );
	} else {
		alert( tempHTTP.responseText );
	}
	return (tempXML);
	tempXML = null;
}

function VerifyPhone(obj){
	fixNumber(obj);
	if (obj.value.length > 0) {
		if (obj.value.indexOf ('(', 0) != -1 || obj.value.indexOf (')', 0) != -1 || obj.value.indexOf ('-', 0) != -1) { 
			alert("Enter a valid phone number.  We do not accept any punctuation in the phone number."); 
			obj.focus();       
		} else { 
			// 11/29/04 GHS - support international phone numbers
			//if (obj.value.length != 10) { 
			if (obj.value.length < 10 || obj.value.length > 13) { 
				alert("Enter a valid phone number.  We are expecting a minimum of 10 and maximum of 13 characters for the area code and phone number."); 
				obj.focus(); 
			}
		} 
	}
} 

function fixNumber(l_obj){
   var objLen = l_obj.value.length;
   var j;
   for (j = objLen;  j >= 0; j--) {
      if (isNaN(parseInt(l_obj.value.substring(j, j+1)))) {
         l_obj.value = l_obj.value.substring(0,j) + l_obj.value.substring(j+1, objLen+1);
         objLen--;
      }
   }
}

function VerifyEmail(obj) {
	var str = obj.value;
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	
	if (lstr > 0) {
		if (str.indexOf(at)==-1) {
			alert("Please enter a valid email address.");
			obj.focus();
			return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}

		if (str.indexOf(at,(lat+1))!=-1) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}

		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}

		if (str.indexOf(dot,(lat+2))==-1) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}

		if (str.indexOf(" ")!=-1) {
			alert("Please enter a valid email address.");
			obj.focus(); 
			return false;
		}
	}
	return true;				
}

//=====================================================
// 12/06/04 LDG < New function for getting the hotel inclusions.
//function getHotelInclusions( inInclusionCodes, inHotelName, inRoomDesc ) {
//function getHotelInclusions( inInclusionCodes ) {		// 02/15/05 LDG < Add new argument.
function getHotelInclusions( inInclusionCodes, inAmpHotelCode ) {
	if (hasXML == false) {
		alert("Sorry, but this is only available when you are using a browser that supports XML.");
	} else {
		var ghiURL;	// this is the URL to the RESTful .aspx page that gives back the included features
		//ghiURL = "../Avail/HotelInclusions.aspx?Inclusion_codes=" + inInclusionCodes;
		ghiURL = "../Avail/HotelInclusions.aspx?Inclusion_codes=" + inInclusionCodes + "&Amp_hotel_code=" + inAmpHotelCode;
		//alert("getHotelInclusions('" + inInclusionCodes + "', '" + inHotelName + "', '" + inRoomDesc + "') called to call\n" + ghiURL );
		ghiXML = new ActiveXObject("Msxml2.DOMDocument");
		ghiXML.async = false;
		ghiXML.validateOnParse = true;
		ghiXML.load( ghiURL );
		if (ghiXML.parseError.errorCode == 0) {
			//alert( ghiXML.xml );
			var ghiSearch, ghiNL, ghiNode, ghiAlert, ghiLoop, ghiNameStr;
			var ghiPriceNL, ghiPrice, ghiTotPrice, ghiLoop2, pad;
			ghiPrice = 0.0;
			ghiTotPrice = 0.0;
			ghiSearch = "Availability/Results/Components/Component[@Type='F']/Features/Feature";
			ghiNL = ghiXML.documentElement.selectNodes( ghiSearch );
			if (ghiNL.length > 0) {
				//ghiAlert = inHotelName + "\n" + inRoomDesc + "\nincludes the following items:";
				ghiAlert = "This hotel includes the following items:";
				for (ghiLoop = 0; ghiLoop < ghiNL.length; ghiLoop++) {
					ghiPrice = 0.0;		// 07/22/05 LDG < Need to Initialize for each Feature.
					ghiNode = ghiNL.item(ghiLoop);
					ghiNameStr = ghiNode.getAttribute("Name");
					ghiAlert += "\n    * " + ghiNameStr;
					for (pad = ghiNameStr.length; pad < 60; pad++) {
						ghiAlert += " ";
					}
					ghiPriceNL = ghiNode.selectNodes("Price_rule/Price_info");
					for (ghiLoop2 = 0; ghiLoop2 < ghiPriceNL.length; ghiLoop2++) {
						ghiPrice += parseFloat( ghiPriceNL.item(ghiLoop2).getAttribute("Total") );
					}
					if (ghiNode.getAttribute("Included_in_pkg") == "N") {
						ghiTotPrice += ghiPrice;
						ghiAlert += "$ " + ghiPrice;
					}
					if (ghiNode.getAttribute("Inclusion_rule") == "M") {
						ghiAlert += "   (can be removed)";
					} else {
						if (ghiNode.getAttribute("Inclusion_rule") == "I") {
							//ghiAlert += "   (cannot be removed)";
						}
					}
				}
				ghiAlert
				alert( ghiAlert );
			} else {
				alert("There is nothing included with this hotel.")
			}
		} else {
			alert("Error: " + ghiXML.parseError.description )
		}
	}
	return false;
}

//=====================================================
// 05/11/05 CAL < Based on the getHotelInclusion function. Only difference is we display
//                the xml in a pop window using the HotelInclusions.xlst.
function getHotelInclusionsPop( inInclusionCodes, inAmpHotelCode ) {
	if (hasXML == false) {
		alert("Sorry, but this is only available when you are using a browser that supports XML.");
	} else {
		var ghiURL;	// this is the URL to the RESTful .aspx page that gives back the included features
		ghiURL = "../Avail/HotelInclusions.aspx?Inclusion_codes=" + inInclusionCodes + "&Amp_hotel_code=" + inAmpHotelCode;
		//alert("getHotelInclusions('" + inInclusionCodes + "', '" + inAmpHotelCode + "') called to call\n" + ghiURL );
		var ghiXML = new ActiveXObject("Msxml2.DOMDocument.3.0");
		ghiXML.async = false;
		ghiXML.validateOnParse = true;
		ghiXML.load( ghiURL );
		if (ghiXML.parseError.errorCode == 0) {
			//alert( ghiXML.xml );
			var ghiSearch, ghiNL;
			ghiSearch = "Availability/Results/Components/Component[@Type='F']/Features/Feature";
			ghiNL = ghiXML.documentElement.selectNodes( ghiSearch );
			var ghiXSL, hotelInclusion;
			ghiXSL = new ActiveXObject("Msxml2.DOMDocument.3.0");
			ghiXSL.async = false;
			ghiXSL.load("../Resource.aspx?Resource=HotelInclusions.xslt");
			if (ghiNL.length > 0) {
				//If we have features loade the HotelInclusions.xslt and display the data
				//in a pop window.
				//Declare the pop window.
				hotelInclusion = window.open("", "hotelInclusionWindow", "width=600,height=200,resizable=1,status=1,scrollbars=0,toolbar=0");
				//Open the window and write the xslt transform to it.
				hotelInclusion.document.open();
				hotelInclusion.document.write(ghiXML.transformNode(ghiXSL));
				hotelInclusion.document.close();
				hotelInclusion.focus();
			} else {
				//Create the error message XML.
				ghiXML.loadXML( "<TB><Errors><Error>There are no included values with this hotel room category.</Error></Errors></TB>" );
				//Show the error message in the pop window.
				//Declare the pop window.
				hotelInclusion = window.open("", "hotelInclusionWindow", "width=600,height=200,resizable=1,status=1,scrollbars=0,toolbar=0");
				//Open the window and write the xslt transform to it.
				hotelInclusion.document.open();
				hotelInclusion.document.write(ghiXML.transformNode(ghiXSL));
				hotelInclusion.document.close();
				hotelInclusion.focus();							
			}
		} else {
			//Show alert for parse error.
			alert("Error: " + ghiXML.parseError.description )
		}
	}
	return false;
}
// 05/11/05 CAL < End

// 07/21/05 Levon Amelyan - Begin. Function to pre-fill password fields onload.
var replyXML;
function PreFillPass(l_PassField, l_RetypePassField) {
	var g_PassField = l_PassField;
	var g_RetypePassField = l_RetypePassField;
	var bookingRestURL = "../Book/Booking.aspx?hidSkipWait=Y&preFillPass=Y";
	
	//alert("calling " + bookingRestURL);
	if (hasXML == false) 
	{
		//alert("this is netscape");
		replyXML = document.implementation.createDocument("","",null);
		if (window.XMLHttpRequest)
		{		
			var xmlhttp = new XMLHttpRequest();
			//xmlhttp.onreadystatechange = state_Change();
			//alert("calling : " + bookingRestURL);
			xmlhttp.open("GET",bookingRestURL,false);
			xmlhttp.send(null);
			replyXML = xmlhttp.responseXML;
			
			//alert("g_PassField:" + g_PassField + "\n" + "g_RetypePassField:" + g_RetypePassField + "\n" + "replyXML: " + replyXML);
			//alert("password: " + "|" + replyXML.documentElement.firstChild.nodeValue  + "|");
			if(g_PassField != null && g_PassField != "")
				document.all[g_PassField].value = replyXML.documentElement.firstChild.nodeValue;
			if(g_RetypePassField != null && g_RetypePassField != "")
				document.all[g_RetypePassField].value = replyXML.documentElement.firstChild.nodeValue;
			
			
		}
		replyXML = null;
		return (false);
	} 
	else 
	{
		replyXML = new ActiveXObject("Msxml2.DOMDocument");
		replyXML.async = false;
		replyXML.validateOnParse = true;
		var tempHTTP = new ActiveXObject("Microsoft.XMLHTTP");
		tempHTTP.Open( "GET", bookingRestURL, false );
		tempHTTP.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
		tempHTTP.setRequestHeader( "Content-Length", replyXML.xml.length);
		tempHTTP.setRequestHeader( "User-Language", "en-us");
		tempHTTP.Send( replyXML.xml );
		replyXML.loadXML( tempHTTP.responseXML.xml );
		if (replyXML.parseError.errorCode == 0) 
		{
		//	alert(replyXML.xml);
			if(replyXML.firstChild != null)
			{
				// 01/05/06 GHS < BEGIN make sure the web control is on the page
				/*
				if(g_PassField != null && g_PassField != "")
					document.getElementById(g_PassField).innerText = replyXML.firstChild.text;
				if(g_RetypePassField != null && g_RetypePassField != "")
					document.getElementById(g_RetypePassField).innerText = replyXML.firstChild.text;
				*/					
				if(g_PassField != null && g_PassField != "") {
					if (document.getElementById(g_PassField) != null)
						document.getElementById(g_PassField).innerText = replyXML.firstChild.text; 
				}
				if(g_RetypePassField != null && g_RetypePassField != "") {
					if (document.getElementById(g_RetypePassField) != null)
						document.getElementById(g_RetypePassField).innerText = replyXML.firstChild.text;	
				}				
				// 01/05/06 GHS < END
			}
			replyXML = null;		
		} 
		else 
		{}
		replyXML = null;
		return (false);
	}
}
// 07/21/05 Levon Amelyan - End.
// 12/06/04 LDG < End

// BJS 06/09/04 - BEGIN
// Now any page on the site can use expandy collapsy images.
expandCollapseImgs = new Array;
expandCollapseImgs[0]     = new Image();
expandCollapseImgs[0].src = "./images/box-expand.gif";
expandCollapseImgs[1]     = new Image();
expandCollapseImgs[1].src = "./images/box-collapse.gif";

function flipExpandCollapse(img)
{
	if(document.images[img].src == expandCollapseImgs[1].src) {
		document.images[img].src = expandCollapseImgs[0].src;
	} else { document.images[img].src = expandCollapseImgs[1].src; }
} 
// BJS 06/09/04 - END

// 03/29/06 JMB - Start
function SubmitRemoveTool() {
	//alert( "SubmitRemoveTool() was called.");
	if (window.name == "CompareWin") {
		document.suitcaseCompareForm.target = "_self";
	}
	document.suitcaseCompareForm.suitcaseList.value = "";
	var i;
	var searchPrefix = "SuitcaseCompareTool_";
	var totalChecked = 0
	for (i = 0; i < document.MainForm.elements.length; i++) {
		if (document.MainForm.elements[i].name.substring(0, searchPrefix.length) == searchPrefix) {
			if (document.MainForm.elements[i].checked) {
				totalChecked++;
				if (document.suitcaseCompareForm.suitcaseList.value.length) {
					document.suitcaseCompareForm.suitcaseList.value += "_|_";
				}
				document.suitcaseCompareForm.suitcaseList.value += document.MainForm.elements[i].value;
			}
		}
	}
	document.suitcaseCompareForm.actionType.value = "REMOVE";
	if (totalChecked > 0) {
		FormAddClientCapabilities(document.suitcaseCompareForm);
		// NOTE: This functionality is dependent upon a ItinHistoryDisplay user control being present on the page.
		// 04/14/05 LDG < Fix to not make us loose our ViewState variables for ShowAvail and ShowCart for JIFFy
		//timerEvent = setTimeout('FormAddClientCapabilities(document.goToHistoryForm)', 2000);
		timerEvent = setTimeout('FormAddClientCapabilities(document.MainForm)', 2000);
	} else {
		alert("You must choose which Saved Vacation to remove.");
	}
}

function SubmitCompareTool() {
	// BJS 02/26/04 - BEGIN
	// find the suitcaseCompareForm and the MainForm.  
	//	Replace all "document.suitcaseCompareForm" with just "suitcaseCompareForm"
	//	Replace all "document.MainForm" with just "MainForm"
	var suitcaseCompareForm;
	var MainForm;
	var formsToFind = 2;
	var formsFound = 0;
	for(i = 0; i < document.forms.length; i++) {
		if(document.forms[i].name == "suitcaseCompareForm") {
			suitcaseCompareForm = document.forms[i];
			formsFound++;
		}
		if(document.forms[i].name == "MainForm") {
			MainForm = document.forms[i];
			formsFound++;
		}			
		// exit for if all of the forms we are looking for are found
		if(formsFound == formsToFind) {
			break;
		}
	}
	// BJS 02/26/04 - END
	
	suitcaseCompareForm.suitcaseList.value = "";
	var i;
	var searchPrefix = "SuitcaseCompareTool_";
	var totalChecked = 0;
	for (i = 0; i < MainForm.elements.length; i++) {
		if (MainForm.elements[i].name.substring(0, searchPrefix.length) == searchPrefix) {
			if (MainForm.elements[i].checked) {
				totalChecked++;
				if (suitcaseCompareForm.suitcaseList.value.length) {
					suitcaseCompareForm.suitcaseList.value += "_|_";
				}
				suitcaseCompareForm.suitcaseList.value += MainForm.elements[i].value;
			}
		}
	}
	//if ((totalChecked > 3)||(totalChecked <= 0)) {
	if ((totalChecked > 3)||(totalChecked <= 1)) {
		if (totalChecked > 3) {
			alert( "You can side-by-side compare only 3 vacations at a time." );
		} else {
			//alert( "You must choose at least 1 item." );
			alert( "You must choose at least 2 items." );
		}
	} else {
		if (window.name == "CompareWin") {
			suitcaseCompareForm.target = "_self";
		// 03/08/04 LDG < START
		} else {
			var l_CompareWin;
			l_CompareWin = window.open("","CompareWin","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=775,height=600,left=80,top=180");
		// 03/08/04 LDG < END
		}
		//alert( document.suitcaseCompareForm.suitcaseList.value );
		suitcaseCompareForm.actionType.value = "COMPARE";
		FormAddClientCapabilities(suitcaseCompareForm);
	}	
}

var timerEvent;

function SubmitEmailCompareTool() {
	document.suitcaseCompareForm.actionType.value = "COMPAREandEMAIL";
	FormAddClientCapabilities(document.suitcaseCompareForm);
}

function GoAvailFromCompareTool( inCartID, inActivePackage ) {
	document.goToHistoryForm.CartID.value = inCartID;
	goToHistory( inActivePackage );
}

function DoCheckOutFromCompareSideBySide( inCartID, inActivePackage ) {
	//alert( "DoCheckOutFromCompareSideBySide( '" + inCartID + "', '" + inActivePackage + "') was called.");
	//alert( "window.opener.name is " + window.opener.name );
	//alert( "window.name is " + window.name );
    document.CheckOutFromCompareSideBySide.CartID.value = inCartID;
	document.CheckOutFromCompareSideBySide.ActivePkgSeq.value = inActivePackage;
	if (window.opener != null) {
        // 10/12/06 mdd < Begin - we can't set the name on a window we didn't open, which is sometimes
	    //                        the case in VAXWEB implementation.
	    //window.opener.name = "MainWin";
		//document.CheckOutFromCompareSideBySide.target = "MainWin";
	    if (window.opener.name == "") {
		    window.opener.name = "MainWin";
		}
		document.CheckOutFromCompareSideBySide.target = window.opener.name;
		// 10/12/06 mdd < End
	} else {
		if (window.name == "CompareWin") {
			document.CheckOutFromCompareSideBySide.target = "_parent";
		}
	}
	//alert( "target is " + document.CheckOutFromCompareSideBySide.target);
	FormAddClientCapabilities(document.CheckOutFromCompareSideBySide);
	document.CheckOutFromCompareSideBySide.submit();
	if (window.opener != null) {
		self.close();
	}
}
// 03/29/06 JMB - End

// 04/04/06 mdd < Begin
function Login_Opener_ButtonToClick( inButtonName ) {
	
	//alert("Login_Opener_ButtonToClick( '" + inButtonName + "' ) was called.");
	// Netscape does not work the IE way.
	var nav4 = window.Event ? true : false;
	
	if(!nav4) {
		var inputElements;
		var i;
			
		inputElements = document.getElementsByTagName("INPUT");
		for (i = 0; i < inputElements.length; i++) {
			eleName = inputElements[i].getAttribute("name");
			//alert( i + " of " + (inputElements.length - 1) + ": " + eleName );
			if (eleName.indexOf( inButtonName ) != -1) {
				inputElements[i].click();
				i += inputElements.length;	// to fall out of the FOR loop
			}
		}
	} else {
		var mainForm = FIND("MainForm");
		mainForm.submit();
	}
}
// 04/03/06 mdd < End

//07/20/06 DODD < START - Add a Passenger
//Change Party Tab Style
function changePartyTabStyle(TabId, cssClass) {
    if (document.getElementById(TabId)) {
	    document.getElementById(TabId).className = cssClass;
	}
}

//Activate Party Tab
function activatePartyTab(partyLinkId) {
    if (document.getElementById(partyLinkId)) {
        document.getElementById(partyLinkId).click();
    }
}
//07/20/06 > END 

// 08/11/06 SDA <START - Add popup message to let people know they are leaving the site

function leavingSite(){
    var conMsg = "Note: You are leaving VAX VacationAccess and entering a 3rd party website. \nPlease remember to return to VAX VacationAccess before making any reservations. \nThank you."
    if(confirm(conMsg)){
        return true;
    }else{
        return false;
    }
}

// 08/11/06 > END

//alert("Version 2.016 \nGenericFunctions.js loaded");

