function over(overid)
{
		i=overid;
		if(document.getElementById(i).className!="btn2")
		document.getElementById(i).className="event";
	}
	
function out(outid)
{
       i=outid;
		if(document.getElementById(i).className!="btn2")
		document.getElementById(i).className="btn1";

	}	
//根据用户选择的不同更改表单action以及域名

function SearchChange(name)
{

i=name;
	
var Surl= new Array();
var Scontent= new Array();
var Sbtn= new Array();

//定义搜狗所有的tab和action///////////////////////////////////////////////////////////////
Surl[11]="http://www.sogou.com/web";
Scontent[11]="query";


Surl[21]="http://news.sogou.com/news";
Scontent[21]="query";


Surl[31]="http://d.sogou.com/music.so";
Scontent[31]="query";


Surl[41]="http://pic.sogou.com/pics/pics";
Scontent[41]="query";


Surl[61]="http://s.sogou.com/say";
Scontent[61]="query";


Surl[51]="http://maps.sogou.com/localnew/local.jsp?query="+document.getElementById("query").value;
Scontent[51]="query";

//定义搜狗所有的tab和action///////////////////////////////////////////////////////////////

document.getElementById("searchform").action=Surl[i];
document.getElementById("query").name=Scontent[i];

if(i==61)
{
document.getElementById("sayname").value=document.getElementById("query").value;
}
}

function SetSay()
{
document.getElementById("sayname").value=document.getElementById("query").value;
}
	
//更改按钮背景色
function BgChange(num)
{
	for (i=1;i<7;i++) {
		document.getElementById(i).className="btn1";
	}
	new_id=num;
	document.getElementById(new_id).className="btn2";
	setCookie("searchid",num);
}

//cookie的相关函数
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 exp = new Date(); 
       exp.setTime (exp.getTime()+3600000000); 
       document.cookie = name + "=" + value + "; expires=" + exp.toGMTString()+"; path=/"; 
}

//根据cookie记住用户的搜索习惯
searchid=getCookie("searchid");
if(searchid==null)
{
searchid=1;
}
try
{
	BgChange(searchid);
	SearchChange(searchid+"1");
}
catch(e){}
