function tabit(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++)
	    {
            document.getElementById(tabName+"_div_"+i).style.display = "none"; 
		    document.getElementById(tabName+"_btn_"+i).className = "";
        
		};		
		document.getElementById(tabName+"_div_"+id).style.display = "block"; 
		btn.className = "curr";
};
var fodTime;
function delaytabit(btn){
clearTimeout(fodTime);
fodTime=setTimeout(function(){tabit(btn)},100);
}
function delaytabitNew(btn){
clearTimeout(fodTime);
fodTime=setTimeout(function(){tabitNew(btn)},100);
}
function tabitNew(btn)
{
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++)
	{
	    document.getElementById(tabName+"_div_"+i).style.display = "none";
		document.getElementById(tabName+"_btn_"+i).className = "";			
	}
	document.getElementById(tabName+"_leftdiv_0").style.display = "none";
	document.getElementById(tabName+"_leftdiv_1").style.display = "none";
    
    document.getElementById(tabName+"_div_"+id).style.display = "block";
    document.getElementById(tabName+"_div_"+id).style.display = "inline";
	document.getElementById(tabName+"_btn_"+id).className = "curr";
	if(id==1)
	{
	    document.getElementById(tabName+"_leftdiv_1").style.display = "block";
		document.getElementById(tabName+"_leftdiv_1").style.display = "inline";
	}
	else
	{
	    document.getElementById(tabName+"_leftdiv_0").style.display = "block";
		document.getElementById(tabName+"_leftdiv_0").style.display = "inline";
	}
};
/* slide */
var currslid = 0;
var slidint;
function setfoc(id){
document.getElementById("focpic").src = picarry[id];
document.getElementById("foclnk").href = lnkarry[id];
document.getElementById("fttltxt").innerHTML = "<a href=\""+lnkarry[id]+"\" target=_blank>"+ttlarry[id]+"</a>";
currslid = id;
for(i=0;i<4;i++)
{document.getElementById("tmb"+i).className = "thubpic";
};
document.getElementById("tmb"+id).className ="thubpiccur";
focpic.style.visibility = "hidden";
focpic.filters[0].Apply();
if (focpic.style.visibility == "visible") {
focpic.style.visibility = "hidden";
focpic.filters.revealTrans.transition=12;
}
else {
focpic.style.visibility = "visible";focpic.filters[0].transition=12;
}
focpic.filters[0].Play();
}
function playnext(){
	if(currslid==3){
		currslid = 0;
	}else{
		currslid++;
	};
	setfoc(currslid);
};
function playit(){
	//slidint = setInterval(playnext,3500);
};
function stopit(){
	clearInterval(slidint);
};
/* vidi */

function document.onkeydown()
{var e=event.srcElement;
 if(event.keyCode==13){
	document.getElementById("Submit1").click();
	return false;}
}

var xmlHttp=new ActiveXObject("Microsoft.XMLHttp"); 
var formfocus="";
function havevalue(e)
{
   var searchtext=document.getElementById("q");
   if(formfocus=="")
   {
      formfocus="资讯";
   }        
   if(searchtext.value==""||searchtext.value=="关键字：")
   {
      switch(formfocus)
      {
        case "资讯":
           window.open("http://s.12edu.cn/SearchMain.aspx");
           break;
        case "学校":
            window.open("http://s.12edu.cn/SearchSchool.aspx");
            break;
        case "专业":
            window.open("http://s.12edu.cn/SearchSpecialty.aspx");
            break;
        case "课程":
            window.open("http://s.12edu.cn/SearchCourse.aspx");
            break;
        case "资料":
            window.open("http://s.12edu.cn/SearchDatum.aspx");
            break;
        case "图书":
            window.open("http://s.12edu.cn/SearchBook.aspx");
            break;
        case "问吧":
            window.open("http://hn.12edu.cn/manage/Ask/default.aspx");
			break;
        case "百科":
            window.open("http://hn.12edu.cn/Manage/Lemma/Default.aspx");
            break;
		case "更多":
            window.open("http://s.12edu.cn");
            break;
            default: 
               window.open("http://s.12edu.cn/");
               break;
        }
   }
  else
  {
     xmlHttp.open("post","http://s.12edu.cn/UrlEncodeing.aspx?name="+ escape(searchtext.value)+"&type="+escape(formfocus),true);
     //xmlHttp.open("post","http://localhost:1635/UrlEncodeing.aspx?name="+ escape(searchtext.value)+"&type="+escape(formfocus),true);
     xmlHttp.onreadyStatechange=change;
     xmlHttp.send(null);
  }
}

function change()
{
   if(xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
   {
      var serin=xmlHttp.responseText;
      window.open(serin);
   }
}

function getfocus(e)
{
   formfocus=e;
}

function shoucang()
{
    window.external.AddFavorite(window.location.href,'教育城');
    return false;
}
function soulemma()
{ 
   return false;
}

function golemma()
{ 
    return false;
} 

// 作文。
function SearchZuoWen(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfZuoWen.aspx?cx=016157468549661712426%3A70hujmmhit8&cof=FORID%3A9&ie=UTF-8&q="+q+"&sa=%E6%90%9C%E7%B4%A2";
    }
}

// 资讯。
function SearchNews(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfNews.aspx?cx=016157468549661712426%3A70hujmmhit8&cof=FORID%3A9&ie=UTF-8&q="+ q +"&sa=%E6%90%9C%E7%B4%A2";
    }
}

// 论文。
function SearchLenWen(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfLunWen.aspx?cx=016157468549661712426%3A70hujmmhit8&cof=FORID%3A9&ie=UTF-8&q="+ q +"&sa=%E6%90%9C%E7%B4%A2";
    }
}

// 学校。
function SearchSchool(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfSchool.aspx?keyWord=" + q;
    }
}

// 专业。
function SearchSpecialty(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultSpecialty.aspx?keyWord=" +q ;
    }
}

// 课程。
function SearchCourse(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfCourse.aspx?keyWord=" + q;
    }
}

// 资料。
function SearchDatum(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfDatum.aspx?keyWord="+ q;
    }
}

// 图书。
function SearchBook(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href="http://s.12edu.cn/ResultOfBook.aspx?cx=015102395614341251732%3Aowsu310sk_0&cof=FORID%3A11&ie=UTF-8&q="+ q +"&sa=%E6%95%99%E8%82%B2%E6%90%9C%E7%B4%A2#1033"; 
    }
};

// 问吧。
function SearchAsk(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfAsk.aspx?keyWord=" + q;
    }
}

// 百科。
function SearchBaike(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfBaike.aspx?keyWord="+ q;
    }
}

// Blog。
function SearchBlog(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {

        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "ResultOfBlog.aspx?keyWord="+ q;
    }
}

// 模考。
function SearchExam(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfExam.aspx?keyWord="+ q;
    }
}

// 工作。
function SearchExam(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfJob.aspx?keyWord="+ q;
    }
}

// 百科。
function SearchBaike(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfBaike.aspx?keyWord="+ q;
    }
}
// Blog。
function SearchBlog(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfBlog.aspx?keyWord="+ q;
    }
}

// 模考。
function SearchExam(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfExam.aspx?keyWord="+ q;
    }
}
// 工作。
function SearchJobs(o)
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var h=o.href;
        var q=encodeURIComponent(w);
        o.href = "http://s.12edu.cn/ResultOfJob.aspx?keyWord="+ q;
    }
}

function Submit1_onclick() 
{
    var w=Form2.q.value;
    if(w.length>0)
    {
        var q=encodeURIComponent(w);
        window.location ="http://s.12edu.cn/ResultOfNews.aspx?cx=015102395614341251732%3Auq9psrywrl0&cof=FORID%3A11&ie=UTF-8&q="+ q +"&sa=%E6%95%99%E8%82%B2%E6%90%9C%E7%B4%A2#1046";
    }
else{
	window.location="http://s.12edu.cn/";
	}
}

