function openWindow(url, name, rs, w, h){
	var resize = "";
	 if (rs){
	 resize = "resizable,";
	 }
	popupWin = window.open(url, name, 'scrollbars,' + resize + 'width=' + w + ',height=' + h);
	window.name = 'opener';
	if(popupWin != null) 
		popupWin.focus();
	else 
		alert ("A Pop-up Blocker is blocking this information.", "Priceline");
}
function rentalCarChkbx(selOpt,objectId){
	var element	= document.getElementById(objectId);
	if(element.type == "checkbox"){
		if(selOpt == 2) {
			element.checked = false;
			element.disabled = false;
		}
		else if(selOpt == 3) {
			element.checked = true;
			element.disabled = true;
		}
	}
}
function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) 
		return document.getElementById(objectId).style;
    else if (document.all && document.all(objectId))
		return document.all(objectId).style;
    else if (document.layers && document.layers[objectId])
		return document.layers[objectId];
	else
		return false;
}
function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
		styleObject.visibility = newVisibility;
		return true;
    } else
		return false;
}
function moveObject(objectId, newXCoordinate, newYCoordinate) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
		styleObject.left = newXCoordinate;
		styleObject.top = newYCoordinate;
		return true;
    } else
		return false;
}
function makeBoldFont(formIdx,selOpt) {
	for (var i=1; i<4; ++i){
		var oElem = getStyleObject("selOpt_"+formIdx+"_"+i);
		if (i == selOpt)
			oElem.fontWeight = 700;
		else
			oElem.fontWeight = 400;
	}
}
function showObject(ObjectId) {
	var styleObject = getStyleObject(ObjectId);
    if(styleObject) {
		styleObject.visibility = 'visible';
		styleObject.display = 'block';
		return true;
    } 
	else
		return false;
}
function hideObject(ObjectId) {
	var styleObject = getStyleObject(ObjectId);
    if (styleObject) {
		styleObject.visibility = 'hidden';
		styleObject.display = 'none';
		return true;
    }
	else
		return false;
}
function hideShowSearch(selOpt,formIdx) {
	makeBoldFont(formIdx,selOpt);
	if(selOpt == 1) {
		showObject('TabAir_'+formIdx);
		hideObject('TabVac_'+formIdx);	
	}else{
		hideObject('TabAir_'+formIdx);
		showObject('TabVac_'+formIdx);
		rentalCarChkbx(selOpt,'Add_a_Rental_Car'+formIdx);
	} 
}
function lpad(n, len, ch) {
	var s = new String(n);
	while (s.length < len) 
		s = ch + s;
	return s;
}
function checkTravelYear(vYear) {
	var intYear = parseInt("0" + String(vYear),10);
	if(intYear < 100) {intYear += 2000;}
	return(intYear);
}
var strProduct;
function postTo(strProduct){
	var oForm = document.forms["QuickPick"+strProduct];	
	if(strProduct == 'AirVac_1' || strProduct == 'AirVac_2') {
		oForm["Navigation/Vacations/@Add_RC"].disabled = false;
		/*var strDate = new String(oForm["vacation_date_departure_CTL"].value);
		 if (strDate != "" && strDate != "undefined" && strDate != "null") {
			 var arrDate = strDate.split("/");
			 oForm["DepartureMonth"].value = (lpad(String(arrDate[0]),1,"0")-1);
			 oForm["DepartureDay"].value = String(arrDate[1]);
			 oForm["DepartureYear"].value = String(checkTravelYear(arrDate[2]));
		 }
		 var strDate = new String(oForm["vacation_date_return_CTL"].value);
		 if(strDate != "" && strDate != "undefined" && strDate != "null") {
			 var arrDate = strDate.split("/");
			 oForm["ReturnMonth"].value = (lpad(String(arrDate[0]),1,"0")-1);
			 oForm["ReturnDay"].value = String(arrDate[1]);
			 oForm["ReturnYear"].value = String(checkTravelYear(arrDate[2]));
		 }*/
	}
	else{
		var strDate = new String(oForm["airlines_date_departure_CTL"].value);
		if (strDate != "" && strDate != "undefined" && strDate != "null") {
			var arrDate = strDate.split("/");
			oForm["DepartureMonth"].value = (lpad(String(arrDate[0]),1,"0")-1);
			oForm["DepartureDay"].value = String(arrDate[1]);
			oForm["DepartureYear"].value = String(checkTravelYear(arrDate[2]));
		}
		var strDate = new String(oForm["airlines_date_return_CTL"].value);
		if(strDate != "" && strDate != "undefined" && strDate != "null") {
			var arrDate = strDate.split("/");
			oForm["ReturnMonth"].value = (lpad(String(arrDate[0]),1,"0")-1);
			oForm["ReturnDay"].value = String(arrDate[1]);
			oForm["ReturnYear"].value = String(checkTravelYear(arrDate[2]));
		}
	}
	oForm.submit();
 }
 function createForm(arrCity,depCity,elementNum) {
	var months=new Array("Jan", "Feb", "Mar", "Apr", "May","Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
	var thisyear = new String(new Date().getFullYear());
	var nextyear = new String(new Date().getFullYear()+1);
	var tempStr = "";
	var strTickForm = "";	
	strTickForm="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"inlinebookingform\">";
	strTickForm=strTickForm+"<input type=\"hidden\" name=\"SEARCH_REQ_REFERRAL_ID\" value=\"AIRNEWFAREDEAL\"/>";
	strTickForm=strTickForm+"<input type=\"hidden\" name=\"SEARCH_REQ_REFERRAL_SOURCE_ID\" value=\"FD\"/>";
	strTickForm=strTickForm+"<input type=\"hidden\" name=\"OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/NAME\" id=\"Airlines_Departure_City\" value=\""+depCity+"\">";
	strTickForm=strTickForm+"<input type=\"hidden\" name=\"OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/NAME\" id=\"Airlines_Arrival_City\" value=\""+arrCity+"\">";
	strTickForm=strTickForm+"<tr>";
	strTickForm=strTickForm+"<td><label for=\"airlines_date_departure_CTL\"><nobr>Departure Date:</nobr></label><input type=\"hidden\" name=\"airlines_date_departure_CTL\"></td>";
	strTickForm=strTickForm+"<td><label for=\"airlines_date_return_CTL\"><nobr>Return Date:</nobr></label><input type=\"hidden\" name=\"airlines_date_return_CTL\"></td>";
	strTickForm=strTickForm+"<td><label for=\"Number_of_Airline_Tickets\"><nobr>Tickets:</nobr></label></td>";
	strTickForm=strTickForm+"</tr><tr>";
	strTickForm=strTickForm+"<td><SELECT NAME=\"DepartureMonth\" ID=\"DepartureMonth\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>mm</OPTION>";
	for(var i=0; i<months.length; ++i){								
		strTickForm=strTickForm+"<OPTION VALUE=\""+i+"\">"+months[i]+"</OPTION>";
	}		
	strTickForm=strTickForm+"</SELECT>&nbsp;<SELECT NAME=\"DepartureDay\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>dd</OPTION>";
	for(var i=1; i<32; ++i){
		if(i>=1 && i<10) tempStr = "0"+i; else tempStr = ""+i;
		strTickForm=strTickForm+"<OPTION VALUE=\""+tempStr+"\">"+tempStr+"</OPTION>";
	}		
	strTickForm=strTickForm+"</SELECT>&nbsp;<SELECT NAME=\"DepartureYear\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>yy</OPTION>";
	strTickForm=strTickForm+"<OPTION VALUE=\""+thisyear+"\">"+thisyear.substring(2,4)+"</OPTION>";
	strTickForm=strTickForm+"<OPTION VALUE=\""+nextyear+"\">"+nextyear.substring(2,4)+"</OPTION>";
	strTickForm=strTickForm+"</SELECT></td>";
	strTickForm=strTickForm+"<td><SELECT NAME=\"ReturnMonth\" ID=\"ReturnMonth\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>mm</OPTION>";
	for(var i=0; i<months.length; ++i){								
		strTickForm=strTickForm+"<OPTION VALUE=\""+i+"\">"+months[i]+"</OPTION>";
	}		
	strTickForm=strTickForm+"</SELECT>&nbsp;<SELECT NAME=\"ReturnDay\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>dd</OPTION>";
	for(var i=1; i<32; ++i){
		if(i>=1 && i<10) tempStr = "0"+i; else tempStr = ""+i;
		strTickForm=strTickForm+"<OPTION VALUE=\""+tempStr+"\">"+tempStr+"</OPTION>";
	}		
	strTickForm=strTickForm+"</SELECT>&nbsp;<SELECT NAME=\"ReturnYear\">";
	strTickForm=strTickForm+"<OPTION VALUE=\"\" selected>yy</OPTION>";
	strTickForm=strTickForm+"<OPTION VALUE=\""+thisyear+"\">"+thisyear.substring(2,4)+"</OPTION>";
	strTickForm=strTickForm+"<OPTION VALUE=\""+nextyear+"\">"+nextyear.substring(2,4)+"</OPTION>";	
	strTickForm=strTickForm+"</SELECT></td>";	
	strTickForm=strTickForm+"<td><SELECT NAME=\"OFFER/AIRLINE_TICKET/NUM_TICKETS\" ID=\"Number_of_Airline_Tickets\">";
	for(var i=1; i<9; ++i){								
		strTickForm=strTickForm+"<OPTION VALUE=\""+i+"\">"+i+"</OPTION>";
	}		
	strTickForm=strTickForm+"</SELECT></td>";
	strTickForm=strTickForm+"<td><input type=\"image\" ID=\"search_3\" name=\"search_3\" onclick=\"postTo('Air_3');return(false);\" src=\"/deals/content/graphics/buttons/b_go_sm.gif\" alt=\"GO\" border=\"0\"/></td>";

	

	strTickForm=strTickForm+"</tr>";
	strTickForm=strTickForm+"</table>";
	return(strTickForm);	
}
function hideform() {
	for (var i=0; i<hideform.arguments.length; i++) {
		var element = document.getElementById(hideform.arguments[i]);
		element.style.display = "none";
	}
}
function getSelectedRadio(buttonGroupName) {
   if (buttonGroupName[0]) {
      for(var i=0; i<buttonGroupName.length; i++) {
         if(buttonGroupName[i].checked) {
            return i
         }
      }
   }else {
      if(buttonGroupName.checked) { 
		  return 0; 
	  } 
   }
   return -1;
}
function showform(depCity, arrCity, elementNum) {
	if(elementNum != "" && elementNum != "undefined" && elementNum != "null") {
		var strHolderNum = document.getElementById("HolderNum").value;	
		if (document.getElementById("HolderNum").value > -1){	
			document.getElementById("FormHolder" + strHolderNum).style.display = "none";
			if (document.getElementById("PriceHolder" + strHolderNum).className == "alt selected") {
				document.getElementById("PriceHolder" + strHolderNum).className = "alt";
			}
			else{
				document.getElementById("PriceHolder" + strHolderNum).className = "";
			}
			document.getElementById("FormHolder" + strHolderNum).innerHTML = "";
		}	
		document.getElementById("HolderNum").value = elementNum;
		document.getElementById("FormHolder" + elementNum).style.display = "block";
		if (document.getElementById("PriceHolder" + elementNum).className == "alt") {
			document.getElementById("PriceHolder" + elementNum).className = "alt selected";
		}
		else{
			document.getElementById("PriceHolder" + elementNum).className = "selected";
		}
		document.getElementById("FormHolder" + elementNum).innerHTML = createForm(arrCity,depCity,elementNum);

		
		var oFormAir1 = document.QuickPickAirlines;	
		oFormAir1["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/NAME"].value=depCity;
		oFormAir1["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/NAME"].value=arrCity;

		var oFormAirVac1 = document.QuickPickAirVac_1;
		oFormAirVac1["Navigation/Vacations/Departure_City"].value=depCity;
		oFormAirVac1["Navigation/Vacations/Destination_City"].value=arrCity;
	

		var oFormAir2 = document.QuickPickAir_2;	
		oFormAir2["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/NAME"].value=depCity;
		oFormAir2["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/NAME"].value=arrCity;

		var oFormAirVac2 = document.QuickPickAirVac_2;
		oFormAirVac2["Navigation/Vacations/Departure_City"].value=depCity;
		oFormAirVac2["Navigation/Vacations/Destination_City"].value=arrCity;
	}
}
function goToSelectedCity() {
	var oForm = eval("document.CityForm");
	var selectedCity = oForm.jumpflight.options[oForm.jumpflight.selectedIndex].value;
	location.href="#"+selectedCity;
}
function seeAllDeals(){
	var selectedUrl = document.allCityFrm.seeallflights.options[document.allCityFrm.seeallflights.selectedIndex].value;	
	if(selectedUrl == "/deals") {
		alert ("Please Select another City, Right now No deal exist for this City");
	}else if(selectedUrl == "" || selectedUrl == "undefined" || selectedUrl == "null") {
		alert ("Please Select a City");		
	}else{
		document.allCityFrm.action=selectedUrl;
		document.allCityFrm.submit();		
	}
}
function submitFlightsData(frmName){
	var oForm = document.forms[frmName];	
	oForm["DepCity"].value = document.getElementById("offer/airline_ticket/location[0]/city/@name").value;
	oForm["ArrCity"].value = document.getElementById("offer/airline_ticket/location[1]/city/@name").value;
	oForm["NumTickets"].value = document.getElementById("offer/airline_ticket/@num_Tickets").value;	
	oForm["DepartureDate"].value = document.getElementById("AIRDHTML_DEPARTUREDATE").value;
	oForm["DepTime"].value = document.getElementById("navigation/required/departure_time").value;
	oForm["ReturnDate"].value = document.getElementById("AIRDHTML_RETURNDATE").value;
	oForm["RetTime"].value = document.getElementById("navigation/required/return_time").value;	
	oForm["CabinClass"].value = document.getElementById("navigation/required/cabin_class").value;
	oForm.submit();
}
function postToParent(frmAction){
	if(window.opener && !window.opener.closed){
		copyValues("POPUP");
		var parentForm;
		if (window.opener.document.airItinRT) {
			parentForm = window.opener.document.airItinRT;
		} else {
			parentForm = window.opener.document.QuickPickAirlines;
		}		
		parentForm["DepCity"].value = document.getElementById("offer/airline_ticket/location[0]/city/@name").value;
		parentForm["ArrCity"].value = document.getElementById("offer/airline_ticket/location[1]/city/@name").value;
		parentForm["NumTickets"].value = document.getElementById("offer/airline_ticket/@num_Tickets").value;
		parentForm["DepartureDate"].value = document.getElementById("AIRDHTML_DEPARTUREDATE").value;
		parentForm["ReturnDate"].value = document.getElementById("AIRDHTML_RETURNDATE").value;

		parentForm.action=frmAction;		
		parentForm.submit();
		self.close();		
	}	
}
// This version is using the AJAX Toolbox (http://www.ajaxtoolbox.com/)
// We'll do this quick check just in case so the user doesn't get javascript errors
// Ideally ajax detection should have been done by now
var supportsXHR = false;
if (window.XMLHttpRequest) {
	supportsXHR = true;
} else if (window.ActiveXObject) {
	supportsXHR = true;
}
function writeToEmailBoxKP(strResponse,impPath) {
	var EmailSuccess_img = "<img src='http://www.priceline.com/images/hp/emailUs.gif' alt='' border='0'>";
	var EmailSuccess_txt = "<b><span style='color:#009;'> THANK YOU FOR SIGNING UP!</span></b><br /><span style='font-size: 11px;'>You'll start receiving our deal alerts very soon.</span>";	
	var EmailFailure_img = "<img src='http://www.priceline.com/images/hp/emailUs_error.gif' alt='' border='0'>";
	var EmailFailure_txt = "<b><span style='color:#f00;'> PLEASE TRY AGAIN!</span></b><br /><span style='font-size: 11px;'>Your email address was not valid.</span>";
	var EmailBlank_img = "<img src='http://www.priceline.com/images/hp/emailUs_error.gif' alt='' border='0'>";
	var EmailBlank_txt = "<b><span style='color:#f00;'> PLEASE TRY AGAIN!</span></b><br /><span style='font-size: 11px;'>Please enter your email address.</span>";	
	var EmailUnavail_img = "<img src='http://www.priceline.com/images/hp/emailUs_error.gif' alt='' border='0'>";
	var EmailUnavail_txt = "<b><span style='color:#f00;'> PLEASE TRY AGAIN LATER</span></b><br /><span style='font-size: 11px;'>We could not process your request at this time.</span>";	
	switch(strResponse) {
		case "success" :
			document.getElementById("Email_img").innerHTML = EmailSuccess_img;
			document.getElementById("Email_txt").innerHTML = EmailSuccess_txt;
			document.getElementById("Email_ctl").innerHTML = "";
			break;
		case "failure" :
			document.getElementById("Email_img").innerHTML = EmailFailure_img;
			document.getElementById("Email_txt").innerHTML = EmailFailure_txt;
			break;
		case "blank" :
			document.getElementById("Email_img").innerHTML = EmailBlank_img;
			document.getElementById("Email_txt").innerHTML = EmailBlank_txt;
			break;
		case "unavailable" :
			document.getElementById("Email_img").innerHTML = EmailUnavail_img;
			document.getElementById("Email_txt").innerHTML = EmailUnavail_txt;
			document.getElementById("Email_ctl").innerHTML = "";
			break;
	}
}
var testEmail
function checkEmail(emailAddress){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(emailAddress))
		testEmail=true
	else{
		testEmail=false
	}
	return (testEmail)
}
function isValidEmail(emailAddress){
	if (document.layers||document.getElementById||document.all)
		return checkEmail(emailAddress)
	else
		return true
}
var xmlHttp
function GetXmlHttpObject(){ 
	var objXMLHttp = null;
	if(window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
function stateChangedEmail(){ 
	if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
		document.getElementById("emailSignupBox").innerHTML = xmlHttp.responseText;	
		if(document.getElementById("emailSignupBox").innerHTML == "No Data Found"){
			document.theEmailSignup.submit();
		}else{
		}		
	} 
} 
function signupForEmail(appContext){	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp != null){
		var emailAddress = String(document.forms['theEmailSignup'].elements['Email_Address'].value).toUpperCase();
		var productName = String(document.forms['theEmailSignup'].elements['Product_Name'].value).toUpperCase();
		if(emailAddress != "") {
			if(isValidEmail(emailAddress)){				
				var signupURL = appContext+"/common/emailSignup.jsp?email="+emailAddress+"&product="+productName;
				AjaxRequest.get(
				  {
					'url':signupURL
					,'onSuccess':function(req){
						var theResponse = String(req.responseText);
						if (theResponse.indexOf("**Y**")>-1) {
							writeToEmailBoxKP('success');
						} else {
							if (theResponse.indexOf("**N**")>-1) {
								writeToEmailBoxKP('failure');
							} else {
								writeToEmailBoxKP('unavailable');
							}
						}
					}
					,'onError':function(req){ writeToEmailBoxKP('unavailable'); }
				  }
				);
			}else{
				writeToEmailBoxKP('failure');
			}
		}else {
			writeToEmailBoxKP('blank');
		}		
	}else {
		writeToEmailBoxKP('unavailable');
	}
}
function QSinfo(link, strIDs, MoreQS) {
	var strHREF = "";
	if (strIDs && strIDs != "")	strHREF = strIDs;	
	if (MoreQS && MoreQS != ""){ //append additional strings if any
		strHREF = (strHREF!="")? strHREF + "&" + MoreQS : MoreQS;
	}	
	if (strHREF != ""){
		if (link.href.indexOf("?") < 0) link.href += "?" + strHREF;
	   	else link.href += "&" + strHREF;
	}
	return(0);
}
function hideNYOPLink(sFormName) {
  var blnHideNYOPLinks = false;	
  if (document.forms[sFormName].elements["navigation/required/cabin_class"].value == "BUS" || document.forms[sFormName].elements["navigation/required/cabin_class"].value == "FST") {	
	  document.getElementById('divNYOPRTLink').style.display='none';
	  document.getElementById('divNYOPRTImage').style.display='none';
	  blnHideNYOPLinks = true;
  }	else {
	  document.getElementById('divNYOPRTLink').style.display='block';
	  document.getElementById('divNYOPRTImage').style.display='block';
  }
  return (blnHideNYOPLinks)
}
function isValidDate(dt1) {
	var imm, idd, iyyyy;
	var dt = new Date(dt1);
	imm = parseInt(dt.getMonth()) + 1;
	idd = dt.getDate();
	iyyyy = dt.getFullYear();
	var mm = parseInt(imm, 10), dd = parseInt(idd, 10), yyyy = parseInt(iyyyy, 10);
	if ((isNaN(mm)) || (isNaN(dd)) || (isNaN(yyyy)) || (yyyy < 1000)) return false;
	if ( ((mm < 1) || (mm > 12) || (dd < 1) || (dd > 31)) ||
	     ((mm == 2) && ((yyyy % 4) != 0) && (dd > 28)) ||
		 ((mm == 2) && ((yyyy % 4) == 0) && (dd > 29)) ||
		 (((mm == 4) || (mm == 6) || (mm == 9) || (mm == 11)) && (dd > 30)) )
		return false;
	else return true;
}
function isValidDate2( iyyyy,imm, idd) {
	var mm = parseInt(imm, 10), dd = parseInt(idd, 10), yyyy = parseInt(iyyyy, 10);
	mm = mm + 1; // Subscript statrs from 0!!!
	if ((isNaN(mm)) || (isNaN(dd)) || (isNaN(yyyy)) || (yyyy < 1000)) return false;
	if ( ((mm < 1) || (mm > 12) || (dd < 1) || (dd > 31)) ||
	     ((mm == 2) && ((yyyy % 4) != 0) && (dd > 28)) ||
		 ((mm == 2) && ((yyyy % 4) == 0) && (dd > 29)) ||
		 (((mm == 4) || (mm == 6) || (mm == 9) || (mm == 11)) && (dd > 30)) )
		return false;
	else return true;
}

function checkTravelYear1(vYear){
  var intYear = parseInt("0" + String(vYear),10);
  if(intYear < 100) {
	intYear += 2000;
  }
   return(intYear);
}

function lpad1(n, len, ch) {
	var s = new String(n);
	while (s.length < len) s = ch + s;
	return s;
}
function openNYOPPopUpOrPost(sFormName,blnDHTML,blnFromHomePage,sItinTypeCode,sItinLink,popUpUrl){
	var blnPostToItin = false;
	if (String(blnFromHomePage) == "N") {
		if (sItinTypeCode== "RT") {		   
			if (document.forms[sFormName].elements["offer/airline_ticket/location[0]/city/@name"].value != "" && document.forms[sFormName].elements["offer/airline_ticket/location[0]/city/@name"].value != "undefined") {
				blnPostToItin = true;			 
			} else {
				blnPostToItin = false;
			}
		} else if (sItinTypeCode== "OW") {
			if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/@NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/@NAME"].value != "undefined") {
				blnPostToItin = true;	
			} else {
				blnPostToItin = false;	
			}
		} else {
			if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/@NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/@NAME"].value != "undefined") {
				blnPostToItin = true;	
			} else {
				blnPostToItin = false;	
			}
		}
	} else {
		if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[0]/CITY/NAME"].value != "undefined") {
			blnPostToItin = true;	
		} else {
			blnPostToItin = false;
		} 	
	}	
	if (blnPostToItin == true) {
		if (String(blnFromHomePage) == "N") {
			if (sItinTypeCode== "RT") {
				if (document.forms[sFormName].elements["offer/airline_ticket/location[1]/city/@name"].value != "" && document.forms[sFormName].elements["offer/airline_ticket/location[1]/city/@name"].value != "undefined") {
					blnPostToItin = true;	
				} else {
					blnPostToItin = false;
				}
			} else if (sItinTypeCode== "OW") {
				if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/@NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/@NAME"].value != "undefined") {
					blnPostToItin = true;	
				} else {
					blnPostToItin = false;	
				}
			} else {
				if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/@NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/@NAME"].value != "undefined") {
					blnPostToItin = true;	
				} else {
					blnPostToItin = false;	
				}
			} 
		} else {
			if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/NAME"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/LOCATION[1]/CITY/NAME"].value != "undefined") {
				blnPostToItin = true;	
			} else {
				blnPostToItin = false;
			}	 	
		}	
	}
	if (blnPostToItin == true) {
		if (String(blnDHTML) == "Y") {	
			if (String(blnFromHomePage) == "N") {
				if (sItinTypeCode== "RT") {	
					if (isValidDate(document.forms[sFormName].elements["AIRDHTML_DEPARTUREDATE"].value)) {
						blnPostToItin = true;
					} else {
						blnPostToItin = false;				
					}
				} else if (sItinTypeCode== "OW") {
					if (isValidDate(document.forms[sFormName].elements["AIRDHTML_DEPARTUREDATE_OW"].value)) {
						blnPostToItin = true;
					} else {
						blnPostToItin = false;
					}
				} else {
					if (isValidDate(document.forms[sFormName].elements["AIRDHTML_DEPARTUREDATE_MD1"].value)) {
						blnPostToItin = true;	
					} else {
						blnPostToItin = false;		
					}
				}	
			} else {
				if (isValidDate(document.forms[sFormName].elements["airlines_date_departure_CTL"].value)) {
					blnPostToItin = true;
				} else {
					blnPostToItin = false;
				}
			}	
		} else {
			if (isValidDate2(document.forms[sFormName].elements["DepartureYear"].value,document.forms[sFormName].elements["DepartureMonth"].value,document.forms[sFormName].elements["DepartureDay"].value)) {
				blnPostToItin = true;
			} else {
				blnPostToItin = false;
			}
		}		
	}
	if (blnPostToItin == true) {
		if (String(blnDHTML) == "Y") {	
			if (String(blnFromHomePage) == "N") {
				if (sItinTypeCode== "RT") {	
					if (isValidDate(document.forms[sFormName].elements["AIRDHTML_RETURNDATE"].value)) {
						blnPostToItin = true;
					} else {
						blnPostToItin = false;
					}	 
				}
			} else {
				if (isValidDate(document.forms[sFormName].elements["airlines_date_return_CTL"].value)) {
					blnPostToItin = true;
				} else {
					blnPostToItin = false;
				}
			}	
		} else {
			if (isValidDate2(document.forms[sFormName].elements["ReturnYear"].value,document.forms[sFormName].elements["ReturnMonth"].value,document.forms[sFormName].elements["ReturnDay"].value)) {
				blnPostToItin = true;
			} else {
				blnPostToItin = false;
			}
		}	
	}	
	if (blnPostToItin == true) {	
		if (String(blnFromHomePage) == "N") {	
			if (document.forms[sFormName].elements["offer/airline_ticket/@num_Tickets"].value != "" && document.forms[sFormName].elements["offer/airline_ticket/@num_Tickets"].value != "undefined" ) {	
				blnPostToItin = true;
			} else {
				blnPostToItin = false;
			}	
		} else {
			if (document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/NUM_TICKETS"].value != "" && document.forms[sFormName].elements["OFFER/AIRLINE_TICKET/NUM_TICKETS"].value != "undefined" ) {	
				blnPostToItin = true;
			} else {
				blnPostToItin = false;
			}	
		}
	}
	if (blnPostToItin == true) {
		if (String(sItinTypeCode) == "OW" || String(sItinTypeCode) == "MD") {	
			document.location.href = "javascript:openWindow('/flights/NYOP_PopUp.asp?irefid=HPAIRNYOPPOP&irefclickid=NYOPPOP','Win',true,390,550)";	
			return;
		}
		var formAction = sItinLink;
		if (String(blnDHTML) == "Y") {
			if (String(blnFromHomePage) == "Y") {
				var sDeparturedate = new Date(document.forms[sFormName].elements["airlines_date_departure_CTL"].value);
				var strDate = new String(document.forms[sFormName].elements["airlines_date_departure_CTL"].value);
			    var arrDate = strDate.split("/");
			    document.forms[sFormName].elements["DepartureMonth"].value = (lpad1(String(arrDate[0]),1,"0")-1);
			    document.forms[sFormName].elements["DepartureDay"].value = String(arrDate[1]);
			    document.forms[sFormName].elements["DepartureYear"].value = String(checkTravelYear1(arrDate[2]));
				var strDate = new String(document.forms[sFormName].elements["airlines_date_return_CTL"].value);
			    var arrDate = strDate.split("/");
			    document.forms[sFormName].elements["ReturnMonth"].value = (lpad1(String(arrDate[0]),1,"0")-1);
			    document.forms[sFormName].elements["ReturnDay"].value = String(arrDate[1]);
			    document.forms[sFormName].elements["ReturnYear"].value = String(checkTravelYear1(arrDate[2]));
			} 
		} 
		document.forms[sFormName].elements["SEARCH_REQ_REFERRAL_ID"].value = "AIRNYOPPOP";
		document.forms[sFormName].elements["SEARCH_REQ_REFERRAL_SOURCE_ID"].value = "HP";
		document.forms[sFormName].elements["SEARCH_REQ_TYPE"].value = "AIRNYOP";
		var parentForm = window.document.forms[sFormName];
		parentForm["DepCity"].value = document.getElementById("offer/airline_ticket/location[0]/city/@name").value;
		parentForm["ArrCity"].value = document.getElementById("offer/airline_ticket/location[1]/city/@name").value;
		parentForm["NumTickets"].value = document.getElementById("offer/airline_ticket/@num_Tickets").value;
		parentForm["DepartureDate"].value = document.getElementById("AIRDHTML_DEPARTUREDATE").value;
		parentForm["ReturnDate"].value = document.getElementById("AIRDHTML_RETURNDATE").value;
		parentForm.action=formAction;
		parentForm.submit();
	} else {
		openWindow(popUpUrl,'Win',true,390,550);
	}	
}