﻿function  getRtn(rtn,id)
    {
        var cb1 = function (res){    
                document.getElementById('ctl00_ContentPlaceHolder1_txt_idcard1').value=res.value;
          } 
          AjaxProSample.jiemi(rtn.HkIdCard,cb1);
     }
         
function citycheck2() {  
debugger ;
var ff = '1';

    if (document.getElementById("StartCity2").value == "中文/拼音" || document.getElementById("StartCity2").value.length == 0) {
        alert("请选择城市!"); 
        document.getElementById("StartCity2").focus(); 
        return false;
    }
     else if (document.getElementById("Txb_Startdate").value == "yyyy-mm-dd") {
    alert("请选择您的入住日期 !"); document.getElementById("Txb_Startdate").focus(); return false;
    }
    else if (!isDateString(document.getElementById("Txb_Startdate").value)) {
    alert("入住日期不符合格式规范或无效的日期!"); document.getElementById("Txb_Startdate").focus(); return false;
    }
    else if (document.getElementById("Txb_Endingdate").value == "yyyy-mm-dd" ) {
   
         alert("请选择您的离店日期 !"); document.getElementById("Txb_Endingdate").focus(); return false;
    }
    else if (!isDateString(document.getElementById("Txb_Endingdate").value) ) {
    alert("离店日期不符合格式规范或无效的日期!"); document.getElementById("Txb_Endingdate").value.focus(); return false;
    }
    else if (stringToDate(document.getElementById("Txb_Endingdate").value, true) <=stringToDate(document.getElementById("Txb_Startdate").value, true) ) {
        alert("离店日期不能早于入住日期" + document.getElementById("Txb_Startdate").value + "!"); document.getElementById("Txb_Endingdate").focus(); return false;
    }
    return true;
  }

function citydate() {
    debugger;
    var ff = '1';

    if (document.getElementById("ctl00_ContentPlaceHolder1_StartCity").value == "中文/拼音") {
        alert("请选择城市!"); document.getElementById("ctl00_ContentPlaceHolder1_StartCity").focus(); return false;
    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").value == "yyyy-mm-dd") {
    alert("请选择您的入住日期 !"); document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").focus(); return false;
    }
    else if (!isDateString(document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").value)) {
    alert("入住日期不符合格式规范或无效的日期!"); document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").focus(); return false;
    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").value == "yyyy-mm-dd") {

    alert("请选择您的离店日期 !"); document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").focus(); return false;
    }
    else if (!isDateString(document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").value)) {
    alert("离店日期不符合格式规范或无效的日期!"); document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").value.focus(); return false;
    }
    else if (stringToDate(document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").value, true) <= stringToDate(document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").value, true)) {
    alert("离店日期不能早于入住日期" + document.getElementById("ctl00_ContentPlaceHolder1_Txb_Startdate").value + "!"); document.getElementById("ctl00_ContentPlaceHolder1_Txb_Endingdate").focus(); return false;
    }
    return true;
}



//---------日期输入检查---------------
function isDateString(sDate) {
    var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    var iaDate = new Array(3)
    var year, month, day

    if (arguments.length != 1) return false
    iaDate = sDate.toString().split("-")
    if (iaDate.length != 3) return false
    if (iaDate[1].length > 2 || iaDate[2].length > 2) return false

    year = parseFloat(iaDate[0])
    month = parseFloat(iaDate[1])
    day = parseFloat(iaDate[2])

    if (year < 1900 || year > 2100) return false
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1] = 29;
    if (month < 1 || month > 12) return false
    if (day < 1 || day > iaMonthDays[month - 1]) return false
    return true
}
//------日期转化函数 2005-10-9

function stringToDate(sDate, bIgnore) {
    var bValidDate, year, month, day
    var iaDate = new Array(3)

    if (bIgnore) bValidDate = true
    else bValidDate = isDateString(sDate)

    if (bValidDate) {
        iaDate = sDate.toString().split("-")
        year = parseFloat(iaDate[0])
        month = parseFloat(iaDate[1]) - 1
        day = parseFloat(iaDate[2])
        return (new Date(year, month, day))
    }
    else return (new Date(1900, 1, 1))
}
