//Hide 错容
function killErrors() { 
return true; 
} 
window.onerror = killErrors;
//var exit=true;
//function ext()
//{
//if (exit)
//window.open("http://www.chinaxjs.com/");}

//项目
function mouseOver(obj,img)
{
	document.getElementById(obj).src ="../images/menu_"+img+"_s.jpg"
}
function mouseOut(obj,img)
{
	document.getElementById(obj).src ="../images/menu_"+img+".jpg"
}
//放大和缩小字体
function doZoom(size){ 
var obj=document.getElementById("list");
obj.style.fontSize=size+"px";
} 
//FLASH调用
function i(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
document.write('<param name="movie" value="' + ur + '">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');
document.write('<embed src="' + ur + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
document.write('</object> ');
}
//
function ImageMovie(){	
  this.width=100;
  this.height=100;
  this.textHeight=0;
  this.flashHeight=0;
  this.pics='';
  this.links='';
  this.texts='';

  this.add=function(pic,link,text){
	  if(this.pics!='')this.pics+='|';
	  this.pics+=pic;

	  if(this.links!='')this.links+='|';
	  this.links+=link;

	  if(this.texts!='')this.texts+='|';
	  this.texts+=text;
  }

  this.play = function(){	 
    this.flashHeight=this.height + this.textHeight;
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ this.width +'" height="'+ this.flashHeight +'">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain">');
	document.writeln('<param name="movie" value="images/focus.swf">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="bgcolor" value="#ffffff">');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name=wmode value="transparent">');
	document.writeln('<param name="FlashVars" value="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'">');
	document.writeln('<embed src="images/focus.swf" wmode="opaque" FlashVars="texts='+this.texts+'&pics='+this.pics+'&links='+this.links+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ this.width +'" height="'+ this.flashHeight +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.writeln('</object>');
  }
}
function OpenWindow(url)
{window.open(url,null,"width=600,height=500,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no");
}
function autotv()
{
try
{
document.all["Tv"].style.height=Tv.document.body.scrollHeight
}
catch(e){}
}
function autozss()
{
try
{
document.all["zss"].style.height=zss.document.body.scrollHeight
}
catch(e){}
}
function autoiframe()
{
try
{
document.all["iframe"].style.height=iframe.document.body.scrollHeight
}
catch(e){}
}
function autoResize()
{
try
{
document.all["book"].style.height=book.document.body.scrollHeight
}
catch(e){}
}
function autozs()
{
try
{
document.all["zs"].style.height=zs.document.body.scrollHeight
}
catch(e){}
}
function KillSpace(x){
while((x.length>0) && (x.charAt(0)==' '))
x = x.substring(1,x.length)
while((x.length>0) && (x.charAt(x.length-1)==' '))
x = x.substring(0,x.length-1)
return x
}
function check_mail(myint)
{
 var checkOk="@";
 var checkStr=myint;
 var allValid=true;
 var decPoints=0;
 var allNum="";
 if(checkStr.charAt(0)=='@')
 return(false);
 if(checkStr.charAt(checkStr.length-1)=='@')
 return(false);
 if(checkStr.charAt(checkStr.length-1)=='.')
 return(false);
 a_valid=0;
 a_count=0;
 d_valid=0;
 for(i=0;i<checkStr.length;i++)
 {
  ch=checkStr.charAt(i);
  if(ch=='@')
  {a_valid=1;a_count++;}
  if(ch=='.')
  {d_valid=1;}
 }
 if(a_count>1)
 return(false);
 if(a_valid==1&&d_valid==1)
 return(true);
 else return(false);
 }
function CheckForm()
{
	if (document.myform.type.value.length == 0)
 {
		alert("请输入项目名称！");
		document.myform.type.focus();
		return false;
	}
	if (document.myform.username.value.length == 0)
 {
		alert("请输入用户名.");
		document.myform.username.focus();
		return false;
	}
	if (document.myform.username.value.indexOf("<")!=-1 || document.myform.username.value.indexOf(">")!=-1 || document.myform.username.value.indexOf("$")!=-1)
{
		alert("用户名中包含非法字符 (<,>,$) ");
		document.myform.username.focus();
		return false;
	}
	if (document.myform.username.value.indexOf("'")!=-1 || document.myform.username.value.indexOf("%")!=-1 || document.myform.username.value.indexOf("&")!=-1)
{
		alert("用户名中包含非法字符 (',%,&) ");
		document.myform.username.focus();
		return false;
	}
	if (isNaN(document.form.tels.value))
	{
		alert("区号不是数字类型！");
		document.form.tels.focus();
		return false;
	}
	if (document.myform.tel.value.length == 0)
{
		alert('电话不能为空');
		document.myform.tel.focus();
		return  false;
	}
	 else{
		  var Letters = "0123456789()+-１２３４５６７８９０";
		  for (i=0; i< document.myform.tel.value.length; i++){
			 var CheckChar = document.myform.tel.value.charAt(i);
			 if (Letters.indexOf(CheckChar) == -1){
			   alert('电话号码输入错误');
		       document.myform.tel.focus();
		       return  false;
			  }
			}
		  }
	if (isNaN(document.myform.mobi.value))
{
		alert("手机号不是数字类型！");
		document.myform.mobi.focus();
		return false;
	}
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
	var checkStr = myform.mail.value;
	var allValid = true;
	for (i = 1;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 1;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}
	if (!allValid)
	{
		alert("您输入的 \"电子邮件地址\" 无效!");
		myform.mail.focus();
		return false;
	}
	address=myform.mail.value;
    if(address.length>0)
	{
        i=address.indexOf("@");
        if(i==-1)
		{
			window.alert("对不起！您输入的电子邮件地址是错误的！")
			myform.mail.focus();
			return false
        }
       ii=address.indexOf(".")
        if(ii==-1)
		{
			window.alert("对不起！您输入的电子邮件地址是错误的！")
			myform.mail.focus();
			return false
        }
    }
	if (isNaN(document.myform.oicq.value))
{
		alert("QQ不是数字类型！");
		document.myform.oicq.focus();
		return false;
	}
	if (document.myform.post.value.length == 0)
 {
		alert("请输入邮编！");
		document.myform.post.focus();
		return false;
	}
	if (document.myform.post.value.length != 6)
 {
		alert("邮编号码输入有误！");
		document.myform.post.focus();
		return false;
	}
	if (isNaN(document.myform.post.value))
{
		alert("邮编不是数字类型！");
		document.myform.post.focus();
		return false;
	}
	if (document.myform.home.value.length == 0)
 {
		alert("请输入详细地址！");
		document.myform.home.focus();
		return false;
	}	
	if (document.myform.content.value.length == 0)
 {
		alert("请输入留言内容！");
		document.myform.content.focus();
		return false;
	}
		return true;
}

//检查字符串
 function fucCheckSTR(NUM)
 {
    var i,j,strTemp;
    strTemp="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    if ( NUM.length== 0)
        return 0
    for (i=0;i<NUM.length;i++)
    {
       j=strTemp.indexOf(NUM.charAt(i));
       if (j==-1)
       {
         return 0;
       }
    }
    return 1;
 }

 function checktext(text)
{
			allValid = true;

		for (i = 0;  i < text.length;  i++)
		{
			if (text.charAt(i) != " ")
			{
				allValid = false;
				break;
			}
		}

return allValid;
}

function getCookieVal (offset) 
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

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;
}

function SetCookie (name, value) 
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 1)); 

function menuControl()
{
window.event.cancelBubble=true;
var objID=event.srcElement.id;
var index=objID.indexOf("_");
var mainID=objID.substring(0,index);
var numID=Math.floor(Math.random()*3)+1;
eval("showMenu("+"menu_"+numID+")");
SetCookie("gbook1", numID, expdate, "/", null, false);
}

function menuControl2()
{
window.event.cancelBubble=true;
var objID=event.srcElement.id;
var index=objID.indexOf("_");
var mainID=objID.substring(0,index);
gbook = GetCookie("gbook1");
eval("hideMenu("+"menu_"+gbook+")");
}

var nbottom=0,speed=7;
function displayMenu(obj)
{
obj.style.clip="rect(0 100% "+nbottom+"% 0)";
nbottom+=speed;
if(nbottom<=100) 
{
timerID=setTimeout("displayMenu("+obj.id+"),70");
}
else clearTimeout(timerID);
}

function showMenu(obj)
{
obj.style.display="block";
obj.style.clip="rect(0 0 0 0)";
nbottom=5;
displayMenu(obj);
}

function hideMenu(obj)
{
nbottom=0;
obj.style.display="none";
}

function keepMenu(obj)
{
obj.style.display="block";
}

function sel(theinput)
{
  if(document.myform.content.value!="")
     document.myform.content.value+="\n"+theinput
  else
	 document.myform.content.value=theinput
}

//
function LTrim(s)
{
    for(var i=0;i<s.length;i++)
        if(s.charAt(i)!=' ')
            return s.substring(i,s.length);
    return "";
}

function RTrim(s)
{
	for(var i=s.length-1;i>=0;i--)
		if(s.charAt(i)!=' ')
		    return s.substring(0,i+1);
    return "";
}

function Trim(s)
{
	return RTrim(LTrim(s));
}