﻿//去除两边空格
String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, "");}
//让IFREAM自动适应高度
function reSetIframe(iframe){
    try{
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height =  height;
    }catch (ex){}
}
function reSetIframe2()
{    
    reSetIframe(document.getElementById("iframepanel"));
}

//参团须知
function shownotice(id,obj)
{
    $(".cantuan_li_selected").attr("className","cantuan_li");
    obj.className="cantuan_li_selected";
    $(".c1").hide();
    var temp="#d"+id;
    $(temp).show();
}
//选择日期价格
function selectPrice(begiondate,price,priceid)
{
    $("#ctl00_ContentPlaceHolder1_txt_p_begiondate").val(begiondate);
    $("#ctl00_ContentPlaceHolder1_txt_p_begiondate").focus();    
    $("#txt_inDate").val(begiondate);    
    var day=$("#ctl00_ContentPlaceHolder1_hi_days").val();
    day=parseInt(day)-1;
    var newDate=getAddDay(begiondate,day);    
    $("#txt_outDate").val(newDate);
    $("#ctl00_ContentPlaceHolder1_txt_p_returnDate").val(newDate);     
    $("#xp_selectPrice").html(price);
    $("#ctl00_ContentPlaceHolder1_hi_price").val(price);
    $("#xp_selectPrice_msg").html("价格:￥");
    $("#ctl00_ContentPlaceHolder1_hi_priceid").val(priceid);
}
//根据日期增加天数
function getAddDay(dd,dadd)   
{   
    var newDates=dd.replace("-","/");
    newDates=newDates.replace("-","/");
    newDates=new Date(newDates);
    newDates = newDates.valueOf();
    newDates = newDates + dadd * 24 * 60 * 60 * 1000;
    newDates=new Date(newDates);
    var result=newDates.getFullYear() + "-" + (newDates.getMonth() + 1) + "-" + newDates.getDate();
    return result;
}
//下一步
function checkSelect()
{
    if($("#ctl00_ContentPlaceHolder1_txt_p_begiondate").val()=="")
    {
        alert("请选择出发日期");
        $("#ctl00_ContentPlaceHolder1_txt_p_begiondate").focus();
        return false;
    }
    else
    {
//        //成人
//        var adultCount=$("#adult").val();
//        //小孩
//        var childCount=$("#ddlChild").val();
//       $("#ctl00_ContentPlaceHolder1_hi_AdultCount").val(adultCount);
//       $("#ctl00_ContentPlaceHolder1_hi_ChildCount").val(childCount);
    }
}

