var prox;var proy;var proxc;var proyc;
function show(id){clearInterval(prox);clearInterval(proy);clearInterval(proxc);clearInterval(proyc);var o=document.getElementById(id);o.style.display="block";o.style.width="1px";o.style.height="1px";prox=setInterval(function(){openx(o,382)},10);}
function openx(o,x){var cx=parseInt(o.style.width);if(cx<x){o.style.width=(cx+Math.ceil((x-cx)/5))+"px";}else{clearInterval(prox);proy=setInterval(function(){openy(o,360)},10);}}
function openy(o,y){var cy=parseInt(o.style.height);if(cy<y){o.style.height=(cy+Math.ceil((y-cy)/5))+"px";}else{clearInterval(proy);}}
function closed(id){clearInterval(prox);clearInterval(proy);clearInterval(proxc);clearInterval(proyc);var o=document.getElementById(id);if(o.style.display=="block"){proyc=setInterval(function(){closey(o)},10);}}
function closey(o){var cy=parseInt(o.style.height);if(cy>0){o.style.height=(cy-Math.ceil(cy/5))+"px";}else{clearInterval(proyc);proxc=setInterval(function(){closex(o)},10);}}
function closex(o){var cx=parseInt(o.style.width);if(cx>0){o.style.width=(cx-Math.ceil(cx/5))+"px";}else{clearInterval(proxc);o.style.display="none";}}
function clock(id){var mask=document.getElementById(id);mask.style.visibility='visible';mask.style.height=document.body.clientHeight;}
function unclock(id){var mask=document.getElementById(id);mask.style.visibility='hidden';}
function onfoucs(id){var sear=document.getElementById(id);sear.value="";}
function $(id){return document.getElementById(id);}
function ChangeTo(){window.location.href="Online.aspx";}
function CKForm(){var strName=$("txtName").value;if(strName==""){alert("请输入用户名！");return false;}var strPwd=$("txtPwd").value;if(strPwd==""){alert("请输入密码！");return false;}return true;}
//function ChangeTo(){window.location.href="Online.aspx";}
//function CKForm(){var strName=$("txtName").value;if(strName==""){alert("请输入用户名！");return false;}var strPwd=$("txtPwd").value;if(strPwd==""){alert("请输入密码！");return false;}return true;}
function ShowEmailSend(){$('mask').style.height=document.body.clientHeight;clock('mask');var objMail=$("Mail");objMail.style.display="block";objMail.style.zIndex=9999;objMail.style.top=(document.body.clientHeight-objMail.clientHeight)/2+document.documentElement.scrollTop/2+"px";objMail.style.left=(document.body.clientWidth-objMail.clientWidth)/2+"px";}
function CloseEmailSend(){unclock('mask');$("Mail").style.display="none";$("txtPerName").value="";$("txtPerEmail").value="";$("txtRevName").value="";$("txtRevEmail").value="";$("ckCopyToSelf").Check=false;}
function SendMailForm(){var strUName=$("txtPerName");var strPerMsg=$("tdPerMsg");if(strUName.value.length==0){strPerMsg.innerHTML="<font color='red'>×您的名字不能为空！</font>";return false;}var strUEmail=$("txtPerEmail");var reg=new RegExp(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/);if(!strUEmail.value.match(reg)){strPerMsg.innerHTML="<font color='red'>×您的邮箱含有非法数字！</font>";return false;}var strTName=$("txtRevName");var strReMsg=$("tdRevMsg");if(strTName.value.length==0){strReMsg.innerHTML="<font color='red'>×收件人名字不能为空！</font>";return false;}var strTEmail=$("txtRevEmail");if(!strTEmail.value.match(reg)){strReMsg.innerHTML="<font color='red'>×收件人邮箱含有非法数字！</font>";return false;}return true;}document.onclick=function(){$("tdPerMsg").innerHTML="";$("tdRevMsg").innerHTML="";}




      
function   closeErrors()   {       
return   true;       
}       
window.onerror=closeErrors;       
function SetWinHeight(obj)
{
    try
    {
    var win=obj;
    if (document.getElementById)
    {
       if (win && !window.opera)
       {
            if (win.contentDocument && win.contentDocument.body.offsetHeight) 
                win.height = win.contentDocument.body.offsetHeight; 
            else if(win.Document && win.Document.body.scrollHeight)
                win.height = win.Document.body.scrollHeight;
       }
    }
    }catch(ex){}
}
function reinitIframe2()
{
    var iframe = document.getElementById("win2");
    try
    {
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height =  height;
    }catch (ex){}
}
window.setInterval("reinitIframe2()", 200);

function reinitIframe()
{
    var iframe = document.getElementById("win");
    try
    {
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height =  height;
    }catch (ex){}
}
window.setInterval("reinitIframe()", 200);

/*tooltipss*/

var tooltip=function(){
	var id = 'tt';
	var top = 18;
	var left = -2;
	var maxw = 300;
	var speed = 100;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,r,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
			
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u+top) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();

/*----------------*/
String.prototype.trim= function()  
{  
    // 用正则表达式将前后空格  
    // 用空字符串替代  
    return this.replace(/(^\s*)|(\s*$)/g, "");  
}
function checkLogin()
{
    var userID=document.getElementById("userId");
    var userPW=document.getElementById("userPw");
    if(userID.value.trim()==""||userPW.value.trim()=="")
    {
      alert("请输入账号或密码！");
       return false;
    }
   return true;
}
/////////////////////////////////////

var httpDomain = "http://" + window.location.host+"/";
function CheckCookies(Name)
      {
    
            var arr = document.cookie.match(new RegExp("(^| )"+Name+"=([^;]*)(;|$)"));
            //alert(unescape(arr[2]));
            if(arr != null) 
           {
               //alert(arr[2]);
              return unescape(arr[2]);
               return true;
          }
           return null;
       }
       function DeleCookies(name)
       {
          var exp = new Date();
            exp.setTime(exp.getTime() - 1);
            var cval=CheckCookies(name);
            if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
       }

       var coookievalue=CheckCookies("CusInfo");
        if (coookievalue != null) 
        { 
        //document.getElementById('login1').innerText="欢迎您"+coookievalue;
        document.getElementById('login').innerHTML="<span id='login1'  style='color:#293d6b;font-family:'微软雅黑';'>欢迎</span>&nbsp;&nbsp;&nbsp;"+coookievalue+"&nbsp;&nbsp;<a href='javascript:void(0)' onclick=\"DeleCookies('CusInfo');location.reload();\"><span style='color:#293d6b;font-family:'微软雅黑';'>[注销]</span></a>&nbsp;&nbsp;&nbsp;&nbsp;";
        }
        else
        {
        document.getElementById('login').innerHTML="<span style='color:#293d6b;font-family:'微软雅黑';'>欢迎</span>&nbsp;&nbsp;&nbsp;<a href='#'onclick=\"show('fd');clock('mask');return false;\"><span style='color:#293d6b;font-family:'微软雅黑';'>[登录]</span></a>&nbsp;&nbsp;<a href='"+httpDomain+"server/reg.html'><span style='color:#293d6b;font-family:'微软雅黑';'>[注册]</span></a>&nbsp;&nbsp;&nbsp;&nbsp;";
        }

/*搜索*/
////////////////////////////////
function ChangeURL() {
    if ($("q").value.trim() == "") {
        return;
    }
    var search = "http://www.google.cn/search?hl=zh-CN&q=" + document.getElementById("q").value + "+site%3Awww.ntintl.com.cn&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f&oq=";
    window.location.href = httpDomain + "SearchResult.aspx?KeyValue=" + search;
}
function ChangeURLByPage(obj,num) {
    var search = "";
    if (num == "1") { 
        search="http://www.google.cn/search" + obj + "sa=N";
    }else if(num=="0"){
        search="http://www.google.cn/search" + obj;
    }
    window.location.href = httpDomain + "SearchResult.aspx?KeyValue=" + search;
}
