<!--

function chkdiv(divid){
	var chkid=document.getElementById(divid);
	if(chkid != null){return true; }
	else {return false; }
}


// 自动最大化网页，以获得最佳浏览效果
if ( screen.availWidth > 1000 && document.documentElement.offsetWidth < 1010 )	{
	self.moveTo(-4,-4);
	self.resizeTo(screen.availWidth+7,screen.availHeight+8);
	document.body.style.cssText="overflow-x:hidden;";
}else if ( screen.availWidth < 1000 && document.documentElement.offsetWidth < 750 )	{
	self.moveTo(-3,-3);
	self.resizeTo(screen.availWidth+5,screen.availHeight+6);
}
//状态栏
function dzltext(){
   window.status="欢迎光临游易天下中国旅游网 www.cts2008.com"; 
   setTimeout("dzltext()",100)
}
dzltext()
//window.status="欢迎光临游易天下中国旅游网 www.cts2008.com"; 
// 容错代码
function killErrors() {
return true;
}
//window.onerror = killErrors;


function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
//coolie 写
function SetCookie (name, value) { 
	var exp1 = new Date(); 
	exp1.setTime(exp1.getTime() + (30*24*60*60*1000));
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : exp1;  
	var path = (argc > 3) ? argv[3] : '/';  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "; domain=.cts2008.com" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

//coolie 读
function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
	return getCookieVal (j);    
	i = document.cookie.indexOf(" ", i) + 1;    
	if (i == 0) break;   
	}  
	return null;
}

//coolie 删
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

//刷新及关闭窗口事件
//var s="close";
//function window.onunload(){
   
//   if(s=="fresh")
//      if(window.screenLeft>10000){
//		  alert('关闭');
//		  }
//	  else{
		  //alert('刷新');
//	      }
//   else
//      alert('关闭');
//}
//function window.onbeforeunload(){
//   s="fresh";
//}

// 收藏当前网页 限制机票火车目录
function favorite(url,title)	{
	if(window.location.href.search('train')>-1|window.location.href.search('Ticket')>-1){
		
	if ( typeof(url) == "undefined" )	{
		url = window.location.href;
		title = window.document.title;
	}
	
    if ((window.event.clientX>document.body.clientWidth && window.event.clientY<0)||window.event.altKey)
    {
	window.external.addFavorite(url,title);
    }
	
	return true;
	
		}
}

//初始
function sys(){
	my_pv			= GetCookie("my_pv");
	userid			= GetCookie("CtsHome");
	// 记录浏览页面数目
	if (top.location == self.location && userid == null) {
		if (my_pv == null)	{ my_pv = 0; }
		if ( my_pv > 10) {
			if ( confirm("您看到此提示窗口，是因为您已经浏览了"+my_pv+"个页面但却没有注册或登陆过。\n\n如果您希望此提示窗口不再出现，请登陆或免费注册！\n\n您希望现在就去注册页面吗？") )	{
				location.href = 'http://www.cts2008.com/user/reg.asp';
			}
		}
		my_pv++;
		//alert(my_pv);
		SetCookie("my_pv",my_pv);
		document.write('<body onbeforeunload="favorite();" oncontextmenu="return onRightClick();" onselectstart="return onRightClick();">');

	}
}
//浏览和鼠标事件
sys();

//非会员禁制复制
function onRightClick()	{
	userid = GetCookie("CtsHome");
	if ( userid == null || userid == '' )	{
		alert("对不起，由于您还不是本站的会员，无法右键点击网站或复制网页文字！\n\n请先免费注册成为网站的会员，谢谢！");
		window.open("http://www.cts2008.com/user/reg.asp");
		return false;
	}
	return true;
}


//取地址参数
function getFrameVars() 
{ 
    var fVars     = new Object();       // Create new fVars object
    var nameVal   = "";                 // Holds array for a single name-value pair
    var inString  = location.search;    // Get query string from URL
    var separator = ",";                // Character used to separate multiple values 

   // If URL contains query string 
	if (inString.charAt(0) == "?") 
    { 
        // Removes "?" character from query string. 
        inString = inString.substring(1, inString.length); 
        // Separates query string into name-value pairs. 
		keypairs = inString.split("&"); 
        // Loops through name-value pairs. 
        for (var i=0; i < keypairs.length; i++) 
		{ 
            // Splits name-value into array (nameVal[0]=name, nameVal[1]=value). 
            nameVal = keypairs[i].split("=");
            // Checks to see if name already exists 
			if (fVars[nameVal[0]]) 
            { 
			   fVars[nameVal[0]] += separator + nameVal[1]; 
            } 
            else 
            { 
               fVars[nameVal[0]] = nameVal[1]; 
            }
        } 
    } 
	return fVars; 
} 
FrameVars=getFrameVars();



//Mapbar地图

  function mapbariframe(){
	  
	  var url;
	  
	  
	  //洒店使用老地图
      if(top.location.href.indexOf('/Hotels/') > 0){
	     url="/Mapbar/api.asp?MType="+mtype+"&ID="+mapid+"&Mappoit="+mappoint+"&Mtitle="+mtitle;
	     document.getElementById("mapbox").innerHTML='<IFRAME border=0 name="mapbar" marginWidth=0 frameSpacing=0 marginHeight=0 src="'+url+'" frameBorder=0 noResize width="760" scrolling=no height="300" vspale="0"></IFRAME>'
	  }else{
	     //url="/Mapbar/api2.asp?MType="+mtype+"&city="+mapcityname+"&name="+mtitle+"&point="+mappoint;
         url="/Mapbar/api2.asp?MType="+mtype+"&ID="+mapid+"&point="+mappoint+"&name="+mtitle+"&city="+mapcityname;
	     document.getElementById("mapbox").innerHTML='<IFRAME border=0 name="mapbar" marginWidth=0 frameSpacing=0 marginHeight=0 src="'+url+'" frameBorder=0 noResize width="760" scrolling=no height="458" vspale="0"></IFRAME>'
	  };
	  


}

  function provmapbariframe(){
	  
	  var url;
	  
         url="/Mapbar/api2.asp?city="+mapcityname;
	     document.getElementById("mapbox").innerHTML='<IFRAME border=0 name="mapbar" marginWidth=0 frameSpacing=0 marginHeight=0 src="'+url+'" frameBorder=0 noResize width="685" scrolling=no height="500" vspale="0"></IFRAME>'
	  


}
//酒店报价，同程

   function loadhotelprice(){
   
       //$("hbjuser").innerHTML+="<a href=\"javascript:void(0)\">同程报价</a>"
	   
	   var url = "/ajload/17u.asp?HotelID="+hotelid+"&s="+Math.random();
	   var pars = "";
   
	   var myAjax = new Ajax.Updater("loadhotelzt",url,
		   {method:'get',
			parametes:pars,
			onLoading:$("loadhotelzt").innerHTML = "加载报价...",
			evalScripts: true
		   });
   }
 
   function provcityselect(pid,cid,pv,cv,form){
	   
	   
             var provobj1=document[form][pid]
             for (i=0;i<34;i++){
	              provobj1.options[provobj1.length] = new Option(proary[i][1], proary[i][0]);
             }
			 if(pv!=''&&pv!='0'&&pv!=0){
			    provobj1.value=	pv; 
			 }
             changearea(provobj1.options[provobj1.selectedIndex].value,document[form][cid]);
			 if(cv!=''&&cv!='0'&&cv!=0){
			    document[form][cid].value=	cv; 
			 }else{
			    document[form][cid].value=	''; 
			}
	   
	   
	   }
	   
   function dhclass(t,c){
	
	   var idn='dh_'+t;
	   if(chkdiv("topcd")){
		  document.getElementById("topcd").className=c;
	  }
	   if(chkdiv(idn)){
		  document.getElementById(idn).className='v';
	  };
   
   }
   
   function adddhclass(title,c){
	
	   var idn='topcd_dh';
	   if(chkdiv("topcd")){
		  document.getElementById("topcd").className=c;
	  }
	   document.getElementById(idn).innerHTML+='<li id="dh_100"><a href="#">'+title+'</a></li>';
	   if(chkdiv("dh_100")){
		  document.getElementById("dh_100").className='v';
	  };
   
   }
   
   
   //首页用户登陆
   function indexlogin(t){
   
		var Url;
		
		
	    if(t==1){
	        Url="/user/login.asp?ation=index&t=login&UserName="+document.getElementById('in_UserName').value+"&PassWord="+document.getElementById('in_password').value+"&CheckCode="+document.getElementById('in_CheckCode').value+"&s="+Math.random();
		    if(document.getElementById('in_UserName').value.length==0){
		       alert("用户名不能为空！")
		       document.getElementById('in_UserName').focus();
		       return false;
		    }
		    if(document.getElementById('in_password').value.length==0){
		       alert("密码不能为空！")
		       document.getElementById('in_password').focus();
		       return false;
		    }
		    if(document.getElementById('in_CheckCode').value.length==0){
		       alert("验证码不能为空！")
		       document.getElementById('in_CheckCode').focus();
		       return false;
		    }
		}else if(t==2){
	        Url="/user/login.asp?ation=index&t=logout&s="+Math.random();
		}else{
	        Url="/user/login.asp?ation=index&s="+Math.random();
		};
		
		var pars = "";
		var obj="indexloginInfo";
		var myAjax = new Ajax.Updater(obj,Url,
		    {method:'get',
			    parametes:pars,
			    evalScripts: true
		    });
		
	}
	
	function hotelyd(v){
		
		var refid='1209756';
		if(v != ''){
		   window.open('http://yd.17u.com/hotelinfo.aspx?id='+v+'&refid='+refid);
		};
		return false;
		
	};
	

-->
