﻿
function searchkey(value)
{
    window.open("Class_Search.aspx?key="+ encodeURIComponent(value));
}
//课程查询
function btsearch()
{ 
    window.location.href="Class_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtKey").value);
}
//信息查询
function btsearchNews(fkey)
{
    if(getparastr('fkey')==null)
    {
        window.location.href="more_news.aspx?key="+ encodeURIComponent(document.getElementById("txtNewsKey").value)+"&fkey="+fkey;
    }
    else
    {
        window.location.href="more_news.aspx?key="+ encodeURIComponent(document.getElementById("txtNewsKey").value)+"&fkey="+getparastr('fkey');
    }
}
//信息查询
function btsearchNews1(fkey)
{ 
    if(event.keyCode==13)   
    {
    if(getparastr('fkey')==null)
    {
        window.location.href="more_news.aspx?key="+ encodeURIComponent(document.getElementById("txtNewsKey").value)+"&fkey="+fkey;
    }
    else
    {
        window.location.href="more_news.aspx?key="+ encodeURIComponent(document.getElementById("txtNewsKey").value)+"&fkey="+getparastr('fkey');
    }
    }
}
//专家查询
function btsearchDoct()
{
    if(getparastr('type')==null)
    {
        window.location.href="NiteDoct.aspx?key="+ encodeURIComponent(document.getElementById("txtDoctKey").value)+"&type="+doct;
    }
    else
    {
        window.location.href="NiteDoct.aspx?key="+ encodeURIComponent(document.getElementById("txtDoctKey").value)+"&type="+getparastr('type');
    }
}
//专家查询
function btsearchDoct1()
{ 
    if(event.keyCode==13)   
    {
    if(getparastr('type')==null)
    {
        window.location.href="NiteDoct.aspx?key="+ encodeURIComponent(document.getElementById("txtDoctKey").value)+"&type=doct";
    }
    else
    {
        window.location.href="NiteDoct.aspx?key="+ encodeURIComponent(document.getElementById("txtDoctKey").value)+"&type="+getparastr('type');
    }
    }
}

//讲师查询
function btsearchmaker()
{  
    window.location.href="Moreteacher.aspx?key="+encodeURIComponent(document.getElementById("txtMaker").value);
} 
//课程回车执行
function btsearch1()
{ 
if(event.keyCode==13)   
    {
        window.location.href="Class_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtKey").value);
    }
}
//讲师回车执行
function btsearchmaker1()
{
if(event.keyCode==13)   
    {   
        window.location.href="Moreteacher.aspx?key="+encodeURIComponent(document.getElementById("txtMaker").value);
    }
} 
//得置
function btresert()
{
    document.getElementById("txtKey").value="";
}

//考试查询
function btexamsearch()
{ 
    window.location.href="Exam_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtExamKey").value);
}
//考试回车执行
function btexamsearch1()
{ 
if(event.keyCode==13)   
    {
    window.location.href="Class_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtExamKey").value);
    }
}
//考试得置
function btexamresert()
{
    document.getElementById("txtBookKey").value="";
}

//图书查询
function btbooksearch()
{ 
    window.location.href="Book_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtBookKey").value);
}
//图书回车执行
function btbooksearch1()
{ 
if(event.keyCode==13)   
    {
    window.location.href="Book_Search.aspx?key="+ encodeURIComponent(document.getElementById("txtBookKey").value);
    }
}
//图书得置
function btbookresert()
{
    document.getElementById("txtBookKey").value="";
}

//csip证书查询
function SearchCerForCsip()
{
    window.open("CerResult.aspx?plucode="+ encodeURIComponent(document.getElementById("scode").value)+"&checkCode="+encodeURIComponent(document.getElementById("checkCode").value));
}


//************************************************************************  
//    函数名称： setCookie                                               |  
//    函数功能： 设置cookie函数                                          |  
//    入口参数： Name：cookie名称                                        |  
//    维护记录： zinger(创建）                                           |  
//    版权所有： (C) 2008-2009 深圳新为软件有限公司                      |  
//    编写时间： 2008年5月4日 21:00                                      |  
//************************************************************************ 
function setCookie(name, value,expires)   
{   
   var today = new Date();  
   today.setTime(today.getTime());  
   if(expires) { expires *= 86400000; }  
   var expires_date = new Date(today.getTime() + (expires));  
   document.cookie = name + "=" + escape(value)+";expires=" + expires_date.toGMTString()+";path=/";
}  
//************************************************************************  
//    函数名称： getCookie                                               |  
//    函数功能： 得到cookie函数                                          |  
//    入口参数： Name：cookie名称                                        |  
//    维护记录： zinger(创建）                                           |  
//    版权所有： (C) 2008-2009 深圳新为软件有限公司                      |  
//    编写时间： 2008年5月4日 21:00                                      |  
//************************************************************************    
function getCookie(Name)   
{  
   var search = Name + "="   
   if(document.cookie.length > 0)   
   { 
       offset = document.cookie.indexOf(search)   
       if(offset != -1)   
       {   
           offset += search.length;   
           end = document.cookie.indexOf(";", offset);   
           if(end == -1) end = document.cookie.length;
	     
           return unescape(document.cookie.substring(offset, end));   
       }   
       else return "";   
   }
   else
   {
       return "";
   }
}   
///***********************************************************************  
//    函数名称： deleteCookie                                            |  
//    函数功能： 删除cookie函数                                          |  
//    入口参数： Name：cookie名称                                        |  
//    维护记录： zinger(创建）                                           |  
//    版权所有： (C) 2008-2009 深圳新为软件有限公司                      |  
//    编写时间： 2008年5月4日 21:00                                      |  
//************************************************************************       
function deleteCookie(name)   
{   
   document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT";
    
}  

//************************************************************************  
//    函数名称： GetCSS                                                  |  
//    函数功能： 获取用户登陆函数                                        |  
//    维护记录： zinger(创建）                                           |  
//    版权所有： (C) 2008-2009 深圳新为软件有限公司                      |  
//    编写时间： 2008年5月4日 21:00                                      |  
//************************************************************************  


 function GetCSSIndex()
 {
  var customer_name=getCookie("cookiename");

        if(customer_name!="")
        {
            if (customer_name!="null")
            {
                     return "<A href='http://www.nite.org.cn/bos/web/framework/desktop/user_gl.aspx' target='_blank'><span>"+customer_name+"</span></A><span>您好!</span><a href='javascript:cancel();'><span>注销</span></a>";
            }
            else
            {
                    return "<span>通行证</span><div class='s1'><input id='UserName' name='UserName' type='text' class='logininput' runat='server'onKeyDown='checklogin()'></div><span>密码</span> <div class='s1'><input id='PassWord' name='PassWord' type='password' class='logininput' runat='server' onKeyDown='checklogin()'></div> <span><input type='button' onclick='login()' value='登陆' class='searchbutton'/>  </span><span><a href='http://www.nite.org.cn/bos/web/framework/desktop/reg_server.aspx'>注册</a></span><span><a href='http://www.nite.org.cn/bos/web/framework/desktop/BackPassword.aspx'>找回密码</a></span>";

            }
       }
       else
       {
                    return "<span>通行证</span><div class='s1'><input id='UserName' name='UserName' type='text' class='logininput' runat='server'onKeyDown='checklogin()'></div><span>密码</span> <div class='s1'><input id='PassWord' name='PassWord' type='password' class='logininput' runat='server' onKeyDown='checklogin()'></div> <span><input type='button' onclick='login()' value='登陆' class='searchbutton'/>  </span><span><a href='http://www.nite.org.cn/bos/web/framework/desktop/reg_server.aspx'>注册</a></span><span><a href='http://www.nite.org.cn/bos/web/framework/desktop/BackPassword.aspx'>找回密码</a></span>";
       }
 }

function GetCSSIndex1()
 {
  var customer_name=getCookie("cookiename");

        if(customer_name!="")
        {
            if (customer_name!="null")
            {
                     return "<td width='15' valign='middle'><img style='padding-top:5px' src='http://www.smecn.org.cn/img/ico1.gif' width='15' height='14' /></td><td><A href='http://www.nite.org.cn/bos/web/framework/desktop/user_gl.aspx' target='_blank'>"+customer_name+"</A></td><td>您好，欢迎来到国家信息技术紧缺人才公共服务平台!<a href='javascript:cancel();'>[注销]</a></td>";
            }
            else
            {
	            return "<td width='15' valign='middle'><img style='padding-top:5px' src='http://www.smecn.org.cn/img/ico1.gif' width='15' height='14' /></td><td>您好，欢迎来到国家信息技术紧缺人才公共服务平台!<a href='http://www.nite.org.cn/bos/web/framework/desktop/login.aspx'>[请登录]</a><a href='http://www.nite.org.cn/bos/web/framework/desktop/reg_server.aspx'>[免费注册]</a></td>";

            }
       }
       else
       {
                   	            return "<td width='15' valign='middle'><img style='padding-top:5px' src='http://www.smecn.org.cn/img/ico1.gif' width='15' height='14' /></td><td>您好，欢迎来到国家信息技术紧缺人才公共服务平台!<a href='http://www.nite.org.cn/bos/web/framework/desktop/login.aspx'>[请登录]</a><a href='http://www.nite.org.cn/bos/web/framework/desktop/reg_server.aspx'>[免费注册]</a></td>";
       }
 }
 
 
 function GetSencondIndex()
 {
        var customer_name=getCookie("cookiename");

        if(customer_name!="")
        {
            if (customer_name!="null")
            {
                    return "<A href='../desktop/user_gl.aspx' target='_blank'><span>"+customer_name+"</span></A><span>您好!</span><a href='javascript:cancel();'><span>注销</span></a>";
            }
            else
            {
                    return "<span>您好!</span><A href='../desktop/login.aspx'><span>请登录</span></A><a href='../desktop/reg_server.aspx'><span>免费注册</span></a>";

            }
       }
       else
       {
             return "<span>您好!</span><A href='../desktop/login.aspx'><span>请登录</span></A><a href='../desktop/reg_server.aspx'><span>免费注册</span></a>";      
       }
 }
 
 //金风科技使用登录脚本
  function GetSencondIndexByJinFen()
 {
       var customer_name=getCookie("cookiename");
        if(customer_name!="")
        {
            if (customer_name!="null")
            {
                     return "<tr><td  height='25'>"+customer_name+"，您好！</td></tr><tr><td height='25'>欢迎光临,金风科技!</td></tr><tr><td><a href='javascript:cancel();'>注&nbsp;&nbsp; 销</A></td></tr>";
            }
            else
            {
                    return "<tr><td width='75' height='25'>用户名：</td><td width='131'><input id='UserName' name='UserName' type='text' class='logininput' runat='server' onKeyDown='checklogin()'></td></tr><tr><td height='25'>密码：</td><td><input id='PassWord' name='PassWord' type='password' class='logininput' runat='server' onKeyDown='checklogin()'></td></tr><tr><td height='40'>&nbsp;</td><td><input type='button' onClick='login()' value='登&nbsp;&nbsp;陆' class='button_kw'/></td></tr><tr><td height='40'>&nbsp;</td><td><a href='../desktop/reg_server.aspx'>注册</A> 忘记密码</td></tr>";

            }
       }
       else
       {
                    return "<tr><td width='75' height='25'>用户名：</td><td width='131'><input id='UserName' name='UserName' type='text' class='logininput' runat='server' onKeyDown='checklogin()'></td></tr><tr><td height='25'>密码：</td><td><input id='PassWord' name='PassWord' type='password' class='logininput' runat='server' onKeyDown='checklogin()'></td></tr><tr><td height='40'>&nbsp;</td><td><input type='button' onClick='login()' value='登&nbsp;&nbsp;陆' class='button_kw'/></td></tr><tr><td height='40'>&nbsp;</td><td><a href='../desktop/reg_server.aspx'>注册</A> 忘记密码</td></tr>";
       }
 }
 
 
 
 
 //检查是否回车
 function checklogin()
 {
    if(event.keyCode==13)   
    {
        login();
    }
 }
 
//登录到LOGIN1
 function login()
 {
      //alert('sksk');
      MainForm.submit();
//    account=document.getElementById("UserName").value;
//    password=document.getElementById("PassWord").value;
//    if(account=="")
//    {
//       alert("登录账号不能为空，请重新输入！");
//       document.all("UserName").focus();
//       return;
//    }
//     setCookie("Tmp_UserName",account);
//     setCookie("Tmp_UserPassWord",password);
//     window.location.href="login1.aspx";		
 }
 function  ResetUserInfo()
 {
    document.getElementById("UserName").value="";
    document.getElementById("PassWord").value="";
 }

  
  function showmenu()
  {
    document.getElementById("Layer2").style.display="block";
  }
  function closemenu()
  {
    document.getElementById("Layer2").style.display="none";
  }
  
  function showmenut()
  {
    document.getElementById("Layer3").style.display="block";
  }
  function closemenut()
  {
    document.getElementById("Layer3").style.display="none";
  }

  function cancel()
  {
 //   alert(getCookie("__Newv-Passport__"));
 //    setCookie("__Newv-Passport__",null);

    setCookie("cookieuseruid",null,-1);
    setCookie("cookiename",null,-1);
    deleteCookie("cookiename");
    deleteCookie("cookieuseruid");
    window.location.href="index.html";
  }
 //添加到收藏夹
function AddFavorite(title,url) 
{
if (window.sidebar) 
{ 
window.sidebar.addPanel(title, url,""); 
} 
else if( document.all ) 
{
window.external.AddFavorite( url, title);
} 
else if( window.opera && window.print ) 
{
return true;
}
}

//改变图片大小
function resizepic(o)
{ 
    var maxwidth=550;   //定义最大宽度
    var maxheight=800;  //定义最大高度
    var a=new Image();
    a.src=o.src
    if(a.width > maxwidth)
    {
      o.style.width=maxwidth;
    }
    if (a.height> maxheight)
    {
      o.style.height=maxheight;
    }
}
//无级缩放图片大小
function bbimg(o)
{
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}
//清空输入框
function ClearDate(name)   
{   
    var Forms = document.getElementById(name).getElementsByTagName("input");   
    for(var i=0;i<Forms.length;i++)   
    {   
        if(Forms[i].type=='text')   
        {   
            Forms[i].value="";
        }
        else if(Forms[i].type=='checkbox')
        {
            Forms[i].value="";
        }
        else if(Forms[i].type=='radio')
        {
            Forms[i].value="";
        }
        else if(Forms[i].type=='hidden')
        {
            Forms[i].value="";
        }            
    }
    var Forms = document.getElementById(name).getElementsByTagName("select");   
    for(var i=0;i<Forms.length;i++)   
    {   
                Forms[i].value=""; 
    }           
}
//得到URL中指定参数
function getparastr(strname) 
{ 
     var hrefstr,pos,parastr,para,tempstr;
     hrefstr = window.location.href; 
     pos = hrefstr.indexOf("?"); 
     parastr = hrefstr.substring(pos+1); 
     para = parastr.split("&"); 
     tempstr=""; 
     for(i=0;i<para.length;i++) 
     {  
         tempstr = para[i];  
         pos = tempstr.indexOf("=");  
         if(tempstr.substring(0,pos) == strname) 
         {   
             return tempstr.substring(pos+1); 
         } 
     } 
     return null;  
}  
//************************************************************************  
//    函数名称： utf8                                                    |  
//    函数功能： 转换UTF8格式                                            |  
//    维护记录： zinger(创建）                                           |  
//    版权所有： (C) 2006-2007 深圳新为软件有限公司                      |  
//    编写时间： 2008年5月4日 21:00                                      |  
//************************************************************************  
function utf8(wide) 
{
      var c, s;
      var enc = "";
      var i = 0;
      while(i<wide.length) 
      {
            c= wide.charCodeAt(i++);
            if (c>=0xDC00 && c<0xE000) continue;
            if (c>=0xD800 && c<0xDC00) 
            {
                  if (i>=wide.length) continue;
                  s= wide.charCodeAt(i++);
                  if (s<0xDC00 || c>=0xDE00) continue;
                  c= ((c-0xD800)<<10)+(s-0xDC00)+0x9800;
            }
            if (c<0x80) enc += String.fromCharCode(c);
            else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
            else if (c<0x9800) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
            else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
      }
      return enc;
}
document.title="国家信息技术紧缺人才公共服务平台";

function g(o){return document.getElementById(o);}
function HoverLi(n)
{
	
	for(var i=1;i<=3;i++)
	{
	    g('tb_'+i).className='normaltab1';
	    g('tbc_0'+i).style.display='none';
	}
		
	g('tb_'+n).className='hovertab1';
	g('tbc_0'+n).style.display='block';
}

function changeTab(n,className)
{
	
	for(var i=1;i<=4;i++)
	{
	    g('tb_'+i).className=className;
	    g('tbc_0'+i).style.display='none';
	}
		
	g('tb_'+n).className=className;
	g('tbc_0'+n).style.display='block';
}

function changeTab2(n,className)
{
	
	for(var i=1;i<=2;i++)
	{
	   
	    g('tb2_'+i).className=className;
	    g('tbc2_0'+i).style.display='none';

	}
		
	g('tb2_'+n).className=className;
	g('tbc2_0'+n).style.display='block';
}

function h(o){return document.getElementById(o);}
function HoverLi2(n)
{
	
	for(var i=1;i<=2;i++)
	{
	   
	    g('tb2_'+i).className='normaltab2';
	    g('tbc2_0'+i).style.display='none';

	}
		
	g('tb2_'+n).className='hovertab2';
	g('tbc2_0'+n).style.display='block';
}
function f(o){return document.getElementById(o);}


//**********************************************************
//  文字滚动效果
//  创建人：raymond
//  创建时间：2010/9/2
//***********************************************************
function $(element){
	if(arguments.length>1){
		for(var i=0,length=arguments.length,elements=[];i<length;i++){
			elements.push($(arguments[i]));
		}
		return elements;
	}
	if(typeof element=="string"){
		return document.getElementById(element);
	}else{
		return element;
	}
}
var Class={
create:function(){
		return function(){
				this.initialize.apply(this,arguments);
			}
	}
}
Function.prototype.bind=function(object){
	var method=this;
	return function(){
		method.apply(object,arguments);
	}
}
var Scroll=Class.create();
Scroll.prototype={
	initialize:function(element,element2,height){
		this.element=$(element);
		this.element2=$(element2);
		if(this.element2.offsetHeight<=this.element.offsetHeight) return;
		this.element.innerHTML+=this.element.innerHTML;
		this.height=height;
		this.maxHeight=this.element.scrollHeight/2;
		this.counter=0;
		this.scroll();
		this.timer="";
		this.element.onmouseover=this.stop.bind(this);
		this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this);
	},
	scroll:function(){
		if(this.element.scrollTop<this.maxHeight){
			this.element.scrollTop++;
			this.counter++;
		}else{
			this.element.scrollTop=0;
			this.counter=0;
		}
		if(this.counter<this.height){
			this.timer=setTimeout(this.scroll.bind(this),20);
		}else{
			this.counter=0;
			this.timer=setTimeout(this.scroll.bind(this),3000);
		}
	},
	stop:function(){
		clearTimeout(this.timer);
	}
}


