document.onmousedown=RightClick;
//document.onselectstart=eventfalse 
//document.ondragstart=eventfalse
//document.oncontextmenu=eventfalse
//document.onkeydown="if((event.ctrlKey)||(event.keyCode==116)||(event.keyCode==122)||(event.keyCode==8)){event.keyCode=0;return false}"


//js错误
function KillErrors() { 
    return true; 
  } 
window.onerror = KillErrors;

//-----------关闭右键结束
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;  
     }
  }