function OpenUrl(Url,Width,Height,scrollbars){
 window.open(""+Url,"","Width="+Width+",Height="+Height+",top=100,left=100,status=no,scrollbars="+scrollbars)
}
function GP(n){
 var dight = n/10;
 var l = dight.toString().length - (dight.toString().indexOf('.') + 1);
 for(var i=l;i>=0;i--)
	dight = new Number(dight.toFixed(i));
 return dight*10; 
} 
function showTable(sel){
 var val = sel.value;
 var cur = document.form1.IsTrue.value;
 if(val == 0){
	document.getElementById("BackDateTab").style.display = "none";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	/*if(cur == 3){
		ACN(form1.StartCity,"SZX");
		ACN(form1.EndCity,"PVG");
		SV(form1.StartTime,"");	
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"SZX,深圳");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartTime,"");
		SV(form1.AirLine,"");}*/}
 else if(val == 1){
	document.getElementById("BackDateTab").style.display = "block";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	/*if(cur == 3){
		ACN(form1.StartCity,"SZX");
		ACN(form1.EndCity,"PVG");
		SV(form1.StartTime,"");	
		SV(form1.BackTime,"");	
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"SZX,深圳");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartTime,"");	
		SV(form1.BackTime,"");
		SV(form1.AirLine,"");}*/}
 else if(val == 2){
	document.getElementById("BackDateTab").style.display = "none";
	document.getElementById("sMultiCity").style.display = "block";
	document.getElementById("eMultiCity").style.display = "block";
	document.getElementById("MultiDate").style.display = "block";
	/*if(cur == 3){
		ACN(form1.StartCity,"SZX");
		ACN(form1.EndCity,"PVG");
		ACN(form1.StartCity2,"PVG");
		ACN(form1.EndCity2,"CAN");
		SV(form1.StartTime,"");
		SV(form1.StartTime2,"");
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"SZX,深圳");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartCity2,"PVG,上海浦东");
		SV(form1.EndCity2,"CAN,广州");
		SV(form1.StartTime,"");
		SV(form1.StartTime2,"");
		SV(form1.AirLine,"");}*/}
 else{
	document.getElementById("BackDateTab").style.display = "none";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	/*if(cur == 3){
		SV(form1.StartCity,"");
		SV(form1.EndCity,"");
		SV(form1.StartTime,"");
		SV(form1.AirLine,"");}
	else{
		AII(form1.StartCity);
		ACI(form1.EndCity);
		ST(form1.StartTime);
		AWI(form1.AirLine);}*/}
 document.form1.IsTrue.value = val;
}
function CheckDate(s){
 var Today = new Date();
 var y,m,d,t;
 y = Today.getFullYear();
 m = Today.getMonth() + 1;
 if(m<10) m = "0"+m;
 d = Today.getDate();
 if(d<10) d = "0"+d;
 t = y + "-" + m + "-" + d;
 return (t>s);
}
function Check(){
with(form1){
 var sel = Istrue.value;
 if(sel == 3){}
 else{
	if(EndCity.value == StartCity.value){
		alert("出发城市与到达城市不能相同！");
		EndCity.focus();
		return false;}
	if(CheckDate(StartDate.value)){
		alert("出发日期不能小于当前日期！");
		StartDate.focus();
		return false;}
	if(sel == 1){
		if(CheckDate(BackDate.value)){
			alert("回程日期不能小于当前日期！");
			BackDate.focus();
			return false;}
		if(BackDate.value < StartDate.value){
			alert("回程日期不能小于出发日期！");
			BackDate.focus();
			return false;}}
	if(sel == 2){
		if(EndCity2.value == StartCity2.value){
			alert("出发城市与到达城市不能相同！");
			EndCity2.focus();
			return false;}
		if(CheckDate(StartDate2.value)){
			alert("第二出发日期不能小于当前日期！");
			StartDate2.focus();
			return false;}
		if(StartDate2.value < StartDate.value){
			alert("第二出发日期不能小于第一出发日期！");
			StartDate2.focus();
			return false;}}
	}
 }
}

function cookies(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var items = document.cookie.split(';');
            for (var i = 0; i < items.length; i++) {
                var cookie = (items[i] || "").replace(/^\s+|\s+$/g, "");
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
}