

//-----------关闭右键结束
function eventfalse()
{
	window.event.returnValue=false;
    alert("感谢您访问本站!\n—『旅游超市-TourMall』专业旅游软件家族成员");
}

//-------------右键显示
function RightClick()
{
	if (event.button == 2 | event.button == 3)
	{
		alert("感谢您访问本站!\n —『旅游超市-TourMall』专业旅游软件家族成员");
	}
}

//--------检查表单是否为空
function check_empty(text) {
        return text.length > 0; 
    }

//--------检查输入内容为空的函数，传递的参数为一个表单 
function CheckFormString(FildBox,HitStr)
{
 CheckFormStringOver = true; 
 if (document.forms[0].elements[FildBox].value.length <1) 
 {
    CheckFormStringOver = false; 
    alert("×," + HitStr + "！不能为空！请重新输入！\n\n所有带*号的项都必须准确填写！"); 
    document.forms[0].elements[FildBox].focus();
    return CheckFormStringOver; 
 } 
 else 
  { 
    return CheckFormStringOver; 
  } 
} 

//--------检查输入内容为空的函数，传递的参数为一个表单 
function CheckFormStringLength(FildBox,HitStr,intLength)
{
 CheckFormStringOver = true; 
 if (document.forms[0].elements[FildBox].value.length >intLength) 
 {
    CheckFormStringOver = false;
    alert("×," + HitStr + "!内容太长了,只需:" + intLength + "个字!");
    document.forms[0].elements[FildBox].focus();
    return CheckFormStringOver; 
 } 
 else 
  { 
    return CheckFormStringOver; 
  } 
} 

//--------检查输入内容为空的函数，传递的参数为一个表单 
function CheckStringByteLength(FildBox,HitStr,intLength)
{
 CheckFormStringOver = true; 
 if (ByteLenght(document.forms[0].elements[FildBox].value) > intLength*2) 
 {
    CheckFormStringOver = false;
    alert("×," + HitStr + "!内容太长了,只需:" + intLength + "个字!");
    document.forms[0].elements[FildBox].focus();
    return CheckFormStringOver; 
 } 
 else 
  { 
    return CheckFormStringOver; 
  } 
} 

//长度计算，一个汉字为2个长度
function ByteLenght(s) 
{ 
    var l = 0; 
    var a = s.split(""); 
    for (var i=0;i<a.length;i++) 
    { 
        if (a[i].charCodeAt(0)<299) 
        { 
            l++; 
        } 
        else 
        { 
            l+=2; 
        } 
    } 
    return l; 
} 

 //return CheckNum("PostIDTextBox","邮政编码","NoNull");
//--------------------------省市选择结束
function CheckNum(FildBox,HitStr,IsNull)
{
  CheckOver = true;  
  
  if ((IsNull == "NoNull") && (document.forms[0].elements[FildBox].value.length < 1)) {
    CheckOver = false;
    document.forms[0].elements[FildBox].focus();
    alert("×," + HitStr + "！不能为空！必须重新输入一个数字！");  
    return CheckOver;
   }

  if (isNaN(document.forms[0].elements[FildBox].value) == true) {
    CheckOver = false;
    document.forms[0].elements[FildBox].focus();
    alert("×," + HitStr + "！请重新输入数字！");  
    return CheckOver;
   }
   return CheckOver;   
}


//打开新窗口函数：
//________________________________________

function PopPage(strURL, name, width, height, left, top)
{
    if(width==null) width=800;
    if(height==null) height=500;
    if(left==null) left = ( screen.width - width ) / 2;
    if(top==null) top  = ( screen.height - height ) / 2;
    temp = "width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=1,toolbar=no,location=no,directories=no,status=no,resizable=no";
    w = window.open(strURL,name,temp);
    w.focus();
}


//保存当前页面文件
//________________________________________
//str:默认使用的文件名,如果为空自动显示当前页的title,在文件名扣加上：_tourunion.htm
//调用如：<INPUT onclick="doSaveFile('要改变的新文件名')" type=button value="保存代码" class=FormBtn>
//调用如：doSaveFile('')

function doSaveFile(str)
{
    if(str=="") str=document.title;
    var win=window.open("", "另存为", "top=200,left=200,height=300,width=200");
    win.document.write(window.document.body.innerHTML + "<br><hr><center>来源网址:<a href='" + window.location.href + "' target=_blank>" + window.location.href + "</a>&nbsp;&nbsp;<font color=red>★<b>旅游联盟</b>★:</font><a href='http://www.tourunion.com' target=_blank>http://www.tourunion.com</a></center>");
    win.document.execCommand("SaveAs","",str+"_tourunion.html");//innerHTML或innerText
    win.close();
}

//--------打印广告
function PrintAd(){
document.write("<div align=right><img src=images/v4-search.gif width=17 height=17 align=absmiddle><font size=2>" + today.getMonth() + "."
 + today.getDate() + "日  由TourMall[旅游超市] 　　　www.tourunion.com</font></div>");
}




//-------------------------------------数字判断
//调用如：if (!isNum("333")) return false;
function isNum(number){
var i,str1="0123456789";
	if (number==null||number=="")  return false;
	for(i=0;i<number.length;i++){
	if(str1.indexOf(number.charAt(i))==-1){
		return false;
		break;
			}
		}
return true;
}
//-------------------------------------*数字判断

//-------------------------------------手机号判断
//调用如：isMobile("txtMobile",0)
//IsNull:0必填，1不是必填项
function isMobile(FildBox,IsNull)
{
 CheckFormStringOver = true; 
 MoblieNO=document.forms[0].elements[FildBox].value;
 if (IsNull==0 && MoblieNO.length<1) 
 {
    CheckFormStringOver = false; 
    alert("×,手机号码要求必须填写！请重新输入！\n\n所有带*号的项都必须准确填写！"); 
    document.forms[0].elements[FildBox].focus();
    return CheckFormStringOver; 
 }
 
 if(MoblieNO.length>0)
 {

	if (!isNum(MoblieNO))
	{
		CheckFormStringOver = false; 
		alert("×,手机号码应该是11位的数字，请不要加0！\n\n请重新准确填写！"); 
		document.forms[0].elements[FildBox].focus();
		return CheckFormStringOver; 		
	}
	
	if (MoblieNO.length!=11)
	{
		CheckFormStringOver = false; 
		alert("×,手机号码应该是11位的数字，请不要加0！\n\n请重新准确填写！"); 
		document.forms[0].elements[FildBox].focus();
		return CheckFormStringOver; 		
	}
	if (MoblieNO.substring(0,1)!="1")
	{
		CheckFormStringOver = false; 
		alert("×,手机号码应该是11位的数字，请不要加0！\n\n请重新准确填写！"); 
		document.forms[0].elements[FildBox].focus();
		return CheckFormStringOver; 		
	}
 }

	return CheckFormStringOver; 
}
//-------------------------------------*手机号判断

//-------------------------------------密码判断
//调用如：CheckPW("pw1","pw2")
function CheckPW(PW1,PW2)
{
 CheckFormStringOver = true; 
 PassWord=document.forms[0].elements[PW1].value;
 if (PassWord.length<6) 
 {
    CheckFormStringOver = false; 
    alert("×,密码不足6位！请输入6-12位的登陆密码！\n\n字母和数字均可！"); 
    document.forms[0].elements[PW1].focus();
    return CheckFormStringOver; 
 }
 
 if(PassWord!=document.forms[0].elements[PW2].value)
 {
	 CheckFormStringOver = false; 
	 alert("×,两次输入的密码不一致！\n\n请重新准确输入2次密码！"); 
	 document.forms[0].elements[PW2].focus();
	 return CheckFormStringOver; 	
	
 }

	return CheckFormStringOver; 
}
//-------------------------------------*密码


//打开地图片,地十由MapUrl全定,上面2个删除
function OpenTourUnionPic(MapUrl){
    	var win = window.open("/CTU_Temp.htm", "CTU_Temp", "scrollbars=yes,resizable=yes,z-look=yes"); 
		with (win.document) {
		open("text/html", "replace");
		write("<HTML><HEAD><TITLE>中国旅游景点图,旅游地图,景点图片，景点风光,景区导游图，景区旅游图,景区照片</TITLE><meta name='keywords' content='中国旅游景点图,旅游地图,景点图片，景点风光,景区导游图，景区旅游图,景区照片...'><link href='http://www.tourunion.com/CTU_Info.css' rel='stylesheet' type='text/css'></HEAD><BODY style='TABLE-LAYOUT: fixed; BACKGROUND-ATTACHMENT: fixed; WORD-BREAK: break-all' leftMargin=0 background='' topMargin=0 marginheight='0' marginwidth='0'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td width=262><a href='http://www.tourunion.com/map/'><img src='http://www.tourunion.com/map/images/uu_map.gif' alt='中国旅游联盟地图频道--图行中国' width='262' height='45' border='0'></a></td><td align='right'><a href='javascript:window.print();'><img src='http://www.tourunion.com/images2/printpage.gif' border=0 alt='打印此旅游地图,旅游线路图,旅游交通图'></a> | <a href='javascript:window.close();'>关闭</a>&nbsp;&nbsp;</td></tr></table><TABLE border=0 align='center' cellPadding=0 cellSpacing=5 bgColor=#c5df57 style='BORDER-RIGHT: #42a600 1px dashed; TABLE-LAYOUT: auto; BORDER-TOP: #42a600 1px dashed; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #42a600; BORDER-LEFT: #42a600 1px dashed'><TR><TD colspan='2' align=middle vAlign=center bgColor=#c5df57 style='BORDER-RIGHT: #42a600 1px dashed; BORDER-TOP: #42a600 1px dashed; BORDER-LEFT: #42a600 1px dashed; BORDER-BOTTOM: #42a600 1px dashed'><img src='http://www.tourunion.com/" + MapUrl + "' style='cursor:hand' onerror=this.src='http://www.tourunion.com/images2/NoPic.gif' alt='选择上部的打印按扭可打印此旅游地图,旅游线路图，旅游交通图'></TD></TR></TABLE></BODY></HTML>");
		close();
		}
}


//打开对话框:reload＝"reload"　时，原始页面刷新
 function OpenDialog(url,reload,Width,Height)
  {
     if(url.length>0)
     {
       window.showModalDialog(url,"UUDialog","dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no");
       if(reload=='reload')
       {
         window.location.reload();
       }
     }else
     {
        return true;  
     }
  }
  //图片放大缩小
  function   bbimg(o){   
		var   zoom=parseInt(o.style.zoom,   10)||100;zoom+=event.wheelDelta/12;   
		if(zoom>0&&zoom<=100)
		  {
			  o.style.zoom=zoom+'%'; 
		}  
		return   false;
		}
//旅游百宝箱调用函数 objid(html 标签ID) type 类型（系统默认调用 通用） 调用前 必须先引jquery.js文件
function BaiBaoXiang(objid,type,classname,col)
{
	if(objid==null)
	{
		return ;
		
		}
		
	var htm="";
	
	var ColumnsNum=3 //显示列数
	if(classname==null)
	{
		classname="";
		}
	if(col!=null)
	{
		ColumnsNum=col;
		}
		$.ajax({type:'POST',url:'/tourmall/AjaxSource/BaiBXAjax.aspx',data:{"type":"qtselect","btype":encodeURI(type),"classname":classname,"col":ColumnsNum},dataType:'text',success:function(data){
	
			$("#"+objid).html(data);
		
		}});
		
	}
//热点推荐 
function hotnav(objid,type,fanwei,classname,col,ptotal,ctotal)
{
	var data={"optype":"select","type":encodeURI(type),"fanwei":encodeURI(fanwei),"classname":classname,"col":col,"ptotal":ptotal,"ctotal":ctotal};
	$.ajax({
   type: "POST",
   url:"/tourmall/AjaxSource/HotnavAjax.aspx",
   data: data,
   success: function(htm){
     $("#"+objid).html(htm)
   }
});
	}
//酒店展开房型
	function MoreRoom(objid,obj)
		{
			var show= $(obj).attr("show");
			
			if(show=="off")
			{
				
				$("tr[id^='"+objid+"_']").css("display", "");
				 $(obj).attr("show","on");
				 $(obj).text("收起房型↑");
				}else{
					$("tr[id^='"+objid+"_']").css("display", "none");
				 $(obj).attr("show","off");
				 $(obj).text("全部房型↓");
			}
		}
//验证码刷新
function YZReload(id)
{
	var cpt = document.getElementById(id);
	var src = cpt.src;
	cpt.src	= src+'?'+Math.random();
	
	}
//		
//查询留言
/*参数说明:
objid HTML 标签 ID
SourceID 留言源ID，Source 留言类型如（线路 酒店 信息 等）
BigClassID 大类ID ，SmallClassid 小类ID ，SpeID 专线ID
Contry 国家，Sheng 省，Shi 市，Xian 县
Spot 景区 注：多个景区请用逗号隔开最多不超过四个 如 九寨沟，峨眉山
col 显示列数 ，pagesize 每页显示条数， getword 显示字数
*/
function LYselect(objid,SourceID,Source,BigClassID,SmallClassID,SpeID,Country,Sheng,Shi,Xian,Spot,pagesize,col,getword)
{
	var data={"optype":"select","SourceID":SourceID,"Source":encodeURI(Source),"BigClassID":BigClassID,"SmallClassID":SmallClassID,"SpecialID":SpeID,"Country":encodeURI(Country),"Sheng":encodeURI(Sheng),"Shi":encodeURI(Shi),"Xian":encodeURI(Xian),"Spot":encodeURI(Spot),"col":col,"pagesize":pagesize,"getword":getword};
	$.ajax({
   type: "POST",
   url:"/tourmall/AjaxSource/LYAjaxSource.aspx",
   data: data,
   success: function(htm){
     $("#"+objid).html(htm)
   }
});
	}
//添加留言
/*参数说明:
SourceID 留言源ID，Source 留言类型如（线路 酒店 信息 等）
BigClassID 大类ID ，SmallClassid 小类ID ，SpeID 专线ID
Contry 国家，Sheng 省，Shi 市，Xian 县
Spot 景区 注：多个景区请用逗号隔开最多不超过四个 如 九寨沟，峨眉山
GuestName 姓名，GuestTel 电话 ，Content 留言内容, TMYZCode 验证码
*/
function LYAdd(SourceID,Source,BigClassID,SmallClassID,SpeID,Country,Sheng,Shi,Xian,Spot,GuestName,GuestTel,Content,TMYZCode)
{
	if(Content==null||$.trim(Content).length==0)
	{
		alert('留言内容不能为空，请输入留言内容！');
		return 
		}
	if(GuestName==null||$.trim(GuestName).length==0)
	{
		
		alert('姓名不能为空,请输入你的姓名!');
		return
		}
	if(TMYZCode==null||$.trim(TMYZCode).length==0)
	{
		alert('验证码不能为空,请输入验证码!');
		return
		}
	var rs="0";
	var data={"optype":"add","SourceID":SourceID,"Source":encodeURI(Source),"Type":encodeURI("留言"),"BigClassID":BigClassID,"SmallClassID":SmallClassID,"SpecialID":SpeID,"Country":encodeURI(Country),"Sheng":encodeURI(Sheng),"Shi":encodeURI(Shi),"Xian":encodeURI(Xian),"Spot":encodeURI(Spot),"GuestName":encodeURI(GuestName),"GuestTel":encodeURI(GuestTel),"Content":encodeURI(Content),"TMYZCode":TMYZCode};
	
	$.ajax({
   type: "POST",
   url:"/tourmall/AjaxSource/LYAjaxSource.aspx",
   data: data,
    async: false,
   success: function(htm){
	   if(htm=="0"||htm=="")
	   {
		   alert('留言失败！');
		   }
     rs=htm;
   }
});
return rs;
	}
