var AutoFocus = new String
var CcValidation  = new String
var CcPreselect  = new String
var CcTotalValue 
var CcCurrency
var CssClass  = new Object
var SelectedDate = new Object

var Status = new Boolean(true)
var SingleFlight =  new Boolean(false)
var goToRow 
//var DateValid = 'M/d/y'
//var DateValidText = 'mm/dd/yyyy'
var DateValid = 'd/M/y'
var DateValidText = 'dd/mm/yyyy'

//var pl = 3
var pl = 0;
var rowheadnfoot = 1;
var rowPassengerList = 6;
var pt = new Boolean(true);
var ptv = new Boolean(false);

var eMsg = new Array();
eMsg[0]	= 'It is not possible to book more Infants than Adults!';
eMsg[1]	= 'Please check your Return Date! It has to be equal to or higher than the Departure Date.';
eMsg[2]	= 'Please supply a valid Passenger Name.';
eMsg[3]	= 'Please supply a valid date of birth ';
eMsg[4]	= 'Please supply a valid Passenger Name at line ';
eMsg[5]	= 'Please supply a valid Date of Birth at line ';
eMsg[6]	= 'Please supply a valid Phone Number.';
eMsg[7]	= 'Please supply a valid Email Address.';
eMsg[8]	= 'Please supply a valid Address.';
eMsg[9]	= 'Please accept Terms and Conditions.';
eMsg[10]= 'Please supply a valid Passport Number at line ';
eMsg[11]= 'Please supply a valid Issue Place at line ';
eMsg[12]= 'Please supply a valid date Expiry Date at line ';
eMsg[13]= 'Please supply a valid date Issue Date at line ';
eMsg[14]= 'Please supply a valid Email format';
eMsg[15]= 'Please check your Issue Date! It must be in the past at passenger ';
eMsg[16]= 'Please check your Expiry Date! It must be in the future at passenger ';
eMsg[17]= 'Please check your Date of Birth! It must be in the past at passenger ';
eMsg[18]= 'Please check your Date of Birth! It must be in the past';
//SetAutoFocus()

function dgItem_over(object){
	object.className = (object.className == "GridItems0_o" ? "GridItems0" : "GridItems0_o")
}

function dgItem_click(s){
	if (event.srcElement.tagName != 'A'){
		o = document.getElementById(s)
		o.checked = 'true'
	}
}

function ValidFlightSelection(o){
	Status = true;
	var d = GetSelectFlight('FlightAvailability0',2)
	if (LibDaysDiff(d,new Date()) < 0 ){
		alert('For Flights departing within 4 hours please contact Reservations.')
		Status =  false;
		return
	}
	if (document.getElementById('FlightAvailability1') != null) {
		var d = GetSelectFlight('FlightAvailability0',1)
		var r = GetSelectFlight('FlightAvailability1',0)
		if (r != undefined){
			if (LibDaysDiff(r,d) < 0){
				alert('Please check your Return Date! It has to be equal to or higher than the Departure Date.')
				Status =  false;
				return
			}
		}
	}	
}

function ShowCvvCode(o){
	if (document.getElementById(o + '_cbmFormOfPaymentSubtype') != null){
		var iA = document.getElementById(o + '_cbmFormOfPaymentSubtype').options[document.getElementById(o + '_cbmFormOfPaymentSubtype').selectedIndex].value.split('|')
		if (iA.length > 0 ){
			document.getElementById('CvvForm').style.visibility = (iA[2] == '1') ?  'visible' : 'hidden' ;
			document.getElementById('CvvLabel').style.visibility = (iA[2] == '1') ? 'visible' : 'hidden' ;
			document.getElementById('IssueDateForm').style.visibility = (iA[3] == '1') ?  'visible' : 'hidden' ;
			document.getElementById('IssueDateLabel').style.visibility = (iA[3] == '1') ? 'visible' : 'hidden' ;
			document.getElementById('IssueNumberForm').style.visibility = (iA[4] == '1') ?  'visible' : 'hidden' ;
			document.getElementById('IssueNumberLabel').style.visibility = (iA[4] == '1') ? 'visible' : 'hidden' ;
			document.getElementById('IssueRow').style.visibility = (iA[3] == '1' || iA[4] == '1') ? 'visible' : 'hidden' ;
        }
        /*
        if (document.getElementById(o + '_tboDocumentNumber') != null) {
        document.getElementById(o + '_tboDocumentNumber').value = "";
        }
        if (document.getElementById('CcMessage') != null) {
        document.getElementById('CcMessage').innerHTML = '';
        }
        var currency = getDynamicCurrency2();
        if (currency != "") {
        currency = currency + " ";
        }
        if (document.getElementById('bhCcCarges') != null) {
        document.getElementById('bhCcCarges').innerHTML = currency + '0.00' + '';
        }
        if (document.getElementById('bhSummary') != null) {
        document.getElementById('bhSummary').innerHTML = currency + '' + '';
        }
        */
	}
}

function isInteger(val){
	if( isNaN( parseFloat(val))) {
		return false;
	} else {
		return parseFloat(val);
	}
}

/* Somm cookie at aspx */

function clearCookie(name)
{                  
     expires = new Date();
     expires = expires.toGMTString()
     document.cookie = name + '=null' + '; expires=' + expires; 
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function getSubCookie(name,parent) {
  try {
	var dc = parent;
	var prefix = name + "=";
	var begin = dc.indexOf("&" + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 1;
	var end = parent.indexOf("&", begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
  }
  catch(e) {
	//window.location = 'InformationPage.asp?e=c'
  }
}

/*
if (getSubCookie('AddFlight',getCookie('tikAero')) == "Outprocess") {
	clearCookie('AddFlight');
	window.location = 'Default.aspx';
}
*/

var currentURL = document.URL
if ((getSubCookie('AddFlight',getCookie('tikAero')) == "Outprocess")&&(currentURL.indexOf('default.aspx') != -1))
{
	clearCookie('tikAero');
	window.location = 'Default.html'
}

/* End Somm Cookie */

function fillDestination(e,o){
	var i = 0
	var eD = document.getElementById(e)
	var oD = document.getElementById(o)
	var sOv = eD[eD.selectedIndex].value
	var sDv = oD[oD.selectedIndex].value
	oD.options.length = 0;
	for (ii=0;ii < Airports.length;ii++){
		var at = Airports[ii].split('|')
		if (at[0] == sOv){
			oD.options[i] = new Option(at[2],at[1] + "|" + at[3]);
			i++
		}
	}
	eD.focus()
}

function CheckCardType(CcNumber){
	var l = new Number(CcNumber.slice(0,6))
	var iA = document.getElementById(CcPreselect + '_cbmFormOfPaymentSubtype').options[document.getElementById(CcPreselect + '_cbmFormOfPaymentSubtype').selectedIndex].value.split('|')
	SelectedCardType = iA[0]
	if 	( 	(l >= 413733 && l <= 413737 ) || 
			(l >= 446200 && l <= 446299 ) || 
			(l >= 453978 && l <= 453979) || 
			(l == 454313 ) ||
			(l >= 454432 && l <= 446299 ) || 
			(l == 454742) ||
			(l >= 456725 && l <= 456745 ) || 
			(l >= 465830 && l <= 465879 ) ||
			(l >= 465901 && l <= 465950 ) ||
			(l >= 475110 && l <= 475159 ) ||
			(l >= 475710 && l <= 475759 ) ||
			(l >= 476220 && l <= 476269 ) ||
			(l >= 476340 && l <= 476389 ) ||
			(l >= 484409 && l <= 484410 ) ||
			(l >= 490960 && l <= 490979 ) ||
			(l >= 492181 && l <= 492182 ) ||
			(l == 498824)
		){
		CardType = "VISADRUK"
	}
	else if((l  == 424519) || (l >= 424962 && l <= 424963 ) || (l == 450875) || (l >= 484406 && l <= 484408 ) || (l >= 484411 && l <= 484455 ) || (l >= 491730 && l <= 491759 ) || (l == 491880))	{
		CardType = "VISAELUK"
	}
	else if((l >= 448400 && l <= 448699 ) || (l >= 471500 && l <= 471599 )){
		CardType = "VISAPU"
	}
	else if((l == 490303) ||	(l == 493698) || (l == 633311) || (l >= 675900 && l <= 675999)){
		CardType = "MAESTROUK"
	}
	else if(l >= 510000 && l <= 559999){
		CardType = "MC"
	}
	else if(l >= 557347 && l <= 557446){
		CardType = "MCDR"
	}	
	else if(l >= 676700 && l <= 676799){
		CardType = "SOLO"
	}
	else if((l >= 6180000 && l <= 180099) ||	(l >= 6213100 && l <= 213199)){
		CardType = "JCB"
	}
	else if(l >= 352800 && l <= 358999){
		if (SelectedCardType == "DC"){
			CardType = "DC"}
		else if (SelectedCardType == "AMEX"){
			CardType = "AMEX"}
		else{
			CardType = "JCB"
		}
	}
	else if(l >= 300000 && l <= 369999){
		if (SelectedCardType == "AMEX"){
			CardType =  "AMEX"}
		else{
			CardType = "DC"
		}
	}
	else if(l >= 340000 && l <= 379999){
		if (SelectedCardType == "AMEX"){
			CardType =  "AMEX"}
		else{
			CardType = "JCB"
		}
	}
	else if(l >= 300000 && l <= 399999){
		CardType =  "JCB"
	}
	else if((l >= 500000 && l <= 509999) || (l >= 560000 && l <= 589999) || (l >= 600000 && l <= 699999)){
		CardType = "MAESTRO"
	}
	else if(l >= 400000 && l <= 499999)	{
		CardType = "VISA"
	}
	else{
		CardType = ""
	}
	
	return CardType
}

function changeToDate(str){
	var dd
	var mm
	var yy
	switch(DateValidText){
		case "dd/mm/yyyy":
			dd = str.substr(0,2)
			mm = str.substr(3,2)
			yy = str.substr(6,4)
		  return new Date(mm+"/"+dd+"/"+yy)
		  break    
		case "mm/dd/yyyy":
			mm = str.substr(0,2)
			dd = str.substr(3,2)
			yy = str.substr(6,4)
		  return new Date(mm+"/"+dd+"/"+yy)
		  break
		default:		
	}
}

function dateDiff(p_Interval, p_Date1, p_Date2, p_firstdayofweek, p_firstweekofyear){
	if(!isDate(p_Date1)){return "invalid date: '" + p_Date1 + "'";}
	if(!isDate(p_Date2)){return "invalid date: '" + p_Date2 + "'";}
	var dt1 = new Date(p_Date1);
	var dt2 = new Date(p_Date2);

	// get ms between dates (UTC) and make into "difference" date
	var iDiffMS = dt2.valueOf() - dt1.valueOf();
	var dtDiff = new Date(iDiffMS);

	// calc various diffs
	var nYears  = dt2.getUTCFullYear() - dt1.getUTCFullYear();
	var nMonths = dt2.getUTCMonth() - dt1.getUTCMonth() + (nYears!=0 ? nYears*12 : 0);
	var nQuarters = parseInt(nMonths/3);	//<<-- different than VBScript, which watches rollover not completion
	
	var nMilliseconds = iDiffMS;
	var nSeconds = parseInt(iDiffMS/1000);
	var nMinutes = parseInt(nSeconds/60);
	var nHours = parseInt(nMinutes/60);
	var nDays  = parseInt(nHours/24);
	var nWeeks = parseInt(nDays/7);

	// return requested difference
	var iDiff = 0;
	switch(p_Interval.toLowerCase()){
		case "yyyy": return nYears;
		case "q": return nQuarters;
		case "m": return nMonths;
		case "y": 		// day of year
		case "d": return nDays;
		case "w": return nDays;
		case "ww":return nWeeks;		// week of year	// <-- inaccurate, WW should count calendar weeks (# of sundays) between
		case "h": return nHours;
		case "n": return nMinutes;
		case "s": return nSeconds;
		case "ms":return nMilliseconds;	// millisecond	// <-- extension for JS, NOT available in VBScript
		default: return "invalid interval: '" + p_Interval + "'";
	}
}

function isDate(p_Expression){
	return !isNaN(new Date(p_Expression));		// <<--- this needs checking
}

// Additional function for FOP Tab
function AdditionalPaymentTabChanged(o, p){
    ChangeImageBuyNow(o);
    ClearCreditCardForm(p);
    ClearVoucherForm(p);
    ResetPaymentValue();
    if (document.getElementById("ctrBooking_ctrPassengerInfosBase_cboConfirm") != null) {
        document.getElementById("ctrBooking_ctrPassengerInfosBase_cboConfirm").checked = false;
    }
    if (document.getElementById("ctrBooking_ctrPassengerInfosBase_ctlErrorContainer_ErrorContainer") != null) {
        document.getElementById("ctrBooking_ctrPassengerInfosBase_ctlErrorContainer_ErrorContainer").innerHTML = " ";
    }
}

function SetDefaultImagePaymentButton(){
	var objBuyNowBtn = document.getElementById("ctrBooking_ctrPassengerInfosBase_btmSubmitPayment");
	if (document.getElementsByName('PaymentTabs_Value') != null && document.getElementsByName('PaymentTabs_Value').length != 0){
        o = document.getElementsByName('PaymentTabs_Value')[0].value;
		if(objBuyNowBtn != null){
		    if (o == "NoPayment"){
                objBuyNowBtn.src = "Images/0/B/bmpm.gif";
                objBuyNowBtn.title = "Next";
            }
            else{
                objBuyNowBtn.src = "Images/0/B/bbo.gif";
                objBuyNowBtn.title = "Buy Now";
            }
		}
	}
}

// Start for new check date function
var dtCh= "/";
var minYear = 1900;
var maxYear = 2100;

function isInteger(s){
    var i;
    for (i = 0; i < s.length; i++){   
    // Check that current character is number.
    var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
    // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
    for (var i = 1; i <= n; i++) {
        this[i] = 31;
        if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
        if (i==2) {this[i] = 29}
    } 
    return this;
}

function isDateExist(dtStr){
      var daysInMonth = DaysArray(12);
      var pos1 = dtStr.indexOf(dtCh);
      var pos2 = dtStr.indexOf(dtCh, pos1 + 1);
      //var strMonth = dtStr.substring(0, pos1);
      var strDay = dtStr.substring(0, pos1);
      //var strDay = dtStr.substring(pos1 + 1, pos2);
      var strMonth = dtStr.substring(pos1 + 1, pos2);
      var strYear = dtStr.substring(pos2 + 1);
      strYr = strYear;
      if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1);
      if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1);
      for (var i = 1; i <= 3; i++) {
            if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1);
      }
      month = parseInt(strMonth);
      day = parseInt(strDay);
      year = parseInt(strYr);
      if (pos1 == -1 || pos2 == -1){
            //alert("The date format should be : mm/dd/yyyy");
            return false;
      }
      if (strMonth.length < 1 || month < 1 || month > 12){
            //alert("Please enter a valid month");
            return false;
      }
      if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year)) || day > daysInMonth[month]){
            //alert("Please enter a valid day");
            return false;
      }
      if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear){
            //alert("Please enter a valid 4 digit year between " + minYear + " and " + maxYear);
            return false;
      }
      if (dtStr.indexOf(dtCh, pos2 +1 ) != -1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
            //alert("Please enter a valid date");
            return false;
      }
    return true;
}
// End for new check date function

function getDynamicCurrency2() {
    var objSpanDynamicCurrency = document.getElementById("ctrBooking_ctrPassengerInfosBase_ctlBookingInfo_LabDynamicCurrency");
    var Currency = "";
    if (objSpanDynamicCurrency != null) {
        Currency = objSpanDynamicCurrency.innerHTML;
    }
    return Currency;
}

// pre load image
var paymentlogo1;
var paymentlogo2;

if (document.images) {
    paymentlogo1 = new Image();
    paymentlogo1.src = "Images/0/I/visa-master.gif";
    paymentlogo2 = new Image();
    paymentlogo2.src = "Images/0/I/bca-klik-logo.jpg";
}

// Additional function for Change Image Buynow button at 'Book now pay later'
function ChangeImageBuyNow(o) {
    var objBuyNowBtn = document.getElementById("ctrBooking_ctrPassengerInfosBase_btmSubmitPayment");
    if (objBuyNowBtn != null) {
        if (o == "NoPayment") {
            objBuyNowBtn.src = "Images/0/B/bmpm.gif";
            objBuyNowBtn.title = "Next";
        }
        else {
            objBuyNowBtn.src = "Images/0/B/bbo.gif";
            objBuyNowBtn.title = "Buy Now";
        }
    }
    
    // Chage Image payment logo
    /*
    var objBuyNowBtn = document.getElementById("ctrBooking_ctrPassengerInfosBase_btmSubmitPayment");
    var imgObj = document.getElementById("paymentlogo");
    if(objBuyNowBtn != null){
        if (o == "External") {
            if (imgObj != null) {
                imgObj.src = paymentlogo2.src;
            }
        }
        else {
            if (imgObj != null) {
                imgObj.src = paymentlogo1.src;
            }
        }
    }
    */
}

// Additional function for clear Credit Card Payment Form
function ClearCreditCardForm(p) {
    if (document.getElementById("formCC") != null) {
        if (document.getElementById(p + "_CtlPaymentCreditCard_cboFirstPassenger") != null) {
            if (document.getElementById(p + "_CtlPaymentCreditCard_cboFirstPassenger").checked == true) {
                document.getElementById(p + "_CtlPaymentCreditCard_cboFirstPassenger").click();
            }
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboNameOnCard") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboNameOnCard").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_cbmFormOfPaymentSubtype") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_cbmFormOfPaymentSubtype").selectedIndex = 0;
            var iA = document.getElementById(p + '_CtlPaymentCreditCard_cbmFormOfPaymentSubtype').options[0].value.split('|')
            if (iA.length > 0) {
                document.getElementById('CvvForm').style.visibility = (iA[2] == '1') ? 'visible' : 'hidden';
                document.getElementById('CvvLabel').style.visibility = (iA[2] == '1') ? 'visible' : 'hidden';
                document.getElementById('IssueDateForm').style.visibility = (iA[3] == '1') ? 'visible' : 'hidden';
                document.getElementById('IssueDateLabel').style.visibility = (iA[3] == '1') ? 'visible' : 'hidden';
                document.getElementById('IssueNumberForm').style.visibility = (iA[4] == '1') ? 'visible' : 'hidden';
                document.getElementById('IssueNumberLabel').style.visibility = (iA[4] == '1') ? 'visible' : 'hidden';
                document.getElementById('IssueRow').style.visibility = (iA[3] == '1' || iA[4] == '1') ? 'visible' : 'hidden';
            }
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboIssueNumber") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboIssueNumber").value = "";
            document.getElementById(p + "_CtlPaymentCreditCard_tboIssueNumber").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_dboIssueDate_cmbMonth") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_dboIssueDate_cmbMonth").selectedIndex = 0;
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_dboIssueDate_cmbYear") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_dboIssueDate_cmbYear").selectedIndex = 0;
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboDocumentNumber") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboDocumentNumber").value = "";
            document.getElementById(p + "_CtlPaymentCreditCard_tboDocumentNumber").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_dboCreditCardExpiryDate_cmbMonth") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_dboCreditCardExpiryDate_cmbMonth").selectedIndex = 0;
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_dboCreditCardExpiryDate_cmbYear") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_dboCreditCardExpiryDate_cmbYear").selectedIndex = 0;
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboCvvCode") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboCvvCode").value = "";
            document.getElementById(p + "_CtlPaymentCreditCard_tboCvvCode").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboStreet") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboStreet").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboStreet2") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboStreet2").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboCity") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboCity").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboState") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboState").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_tboZipCode") != null) {
            document.getElementById(p + "_CtlPaymentCreditCard_tboZipCode").className = "";
        }
        if (document.getElementById(p + "_CtlPaymentCreditCard_cmbCountryRcd") != null) {
            if (document.getElementById("hdCountry") != null) {
                var objCmbCountryRcd = document.getElementById(p + "_CtlPaymentCreditCard_cmbCountryRcd");
                for (var i = 0; i < objCmbCountryRcd.length; i++) {
                    if (objCmbCountryRcd.options[i].value == document.getElementById("hdCountry").value) {
                        objCmbCountryRcd.selectedIndex = i;
                        break;
                    }
                }
            }
        }
        if (document.getElementById("CcMessageSection") != null) {
            document.getElementById("CcMessageSection").style.display = "none";
        }
        if (document.getElementById("CcMessage") != null) {
            document.getElementById("CcMessage").innerHTML = "";
            document.getElementById("CcMessage").style.display = "none";
        }
    }
}

// Additional function for clear Voucher Payment Form
function ClearVoucherForm(p) {
    if (document.getElementById("formVoucher") != null) {
        if (document.getElementById(p + "_CtrPaymentVoucher_tboVoucherNumber") != null) {
            document.getElementById(p + "_CtrPaymentVoucher_tboVoucherNumber").value = "";
        }
        if (document.getElementById(p + "_CtrPaymentVoucher_tboVoucherPassword") != null) {
            document.getElementById(p + "_CtrPaymentVoucher_tboVoucherPassword").value = "";
        }
        if (document.getElementById(p + "_CtrPaymentVoucher_grdVoucherGrid") != null) {
            document.getElementById(p + "_CtrPaymentVoucher_grdVoucherGrid").style.display = "none";
        }
    }
}

// function Reset Payment
function ResetPaymentValue() {
    var objLblOtherCharge = document.getElementById("lblOtherCharge");
    if (objLblOtherCharge != null) {
        objLblOtherCharge.innerHTML = "0.00";
    }
    var objLabTotalPrice = document.getElementById("ctrBooking_ctrPassengerInfosBase_ctlBookingInfo_LabTotalPrice");
    if (objLabTotalPrice != null) {
        var objHdTotal = document.getElementById("hdTotal");
        if (objHdTotal != null) {
            objLabTotalPrice.innerHTML = objHdTotal.value;
        }
    }
}