var mysec;
var myfocus=0;
var lastScrollY=0;
var percent;
var nowY;

document.write ("<div id='searchbar' style='position:absolute; right:0px; top:0px; width:370px; height:32px; background:url(http://www.souxj.cn/js/images/b.gif) no-repeat; padding:2px 0px 3px 10px; color:#000000; font-size:10pt;'>");
document.write ("<table><tr><td valign=\"top\"><a href=\"http://www.souxj.cn\" target=\"_blank\"><img src=\"http://www.souxj.cn/js/images/logo.gif\" border=\"0\" title=\"搜新疆 新疆人自己的百度\"></a></td>");
document.write ("<td><input name=\"keyword\" id=\"keyword\" style=\"width:165px; font-size:9pt; color:#cccccc;\" type=\"text\" id=\"keyword\" style=\"width:100%\" value=\"点击输入关键字\" onClick=\"myfocus=1;\" onFocus=\"if (this.value=='点击输入关键字') {this.value='';this.style.color='#000000';myfocus=1;}\" onBlur=\"if (this.value=='') {this.value='点击输入关键字';this.style.color='#cccccc';myfocus=0;CountDown(60);}\"> ");
//document.write ("<select name=\"searchtype\" style=\"width:50px; overflow:hidden;\"><option value=\"3\">全部</option><option value=\"1\">企业</option><option value=\"2\">网页</option></select> ")
document.write ("<input name='searchtype' id='searchtype' type='hidden' value='3'>");
document.write ("<input type='button' style='background-image:url(http://www.souxj.cn/js/images/go.gif); width:43px; height:19px; border:0px;' onclick='Go(keyword.value,searchtype.value);'> ");
document.write ("<a onclick='searchbar.style.display=\"none\"; return false;' href='#' id='countdown' style='text-decoration:none; font-family:Tahoma; font-size:9pt; text-align:center; width:27px;' title='点击这里隐藏搜索条'>隐藏</a> ");
document.write ("</td></tr></table></div>");

//setTimeout("searchbar.style.display='none';",60000);

function Go(mykeyword,mytype)
{
	if (mykeyword=="undefined"||mykeyword==""||mykeyword=="点击输入关键字")
	{
		alert("请输入关键字");
	}
	else
	{
		if (mytype=="1")
		{
			window.open ("http://www.souxj.cn/search/?keyword="+mykeyword+"&type=souxj");
		}
		else if (mytype=="2")
		{
			window.open ("http://www.souxj.cn/search/?keyword="+mykeyword+"&type=xj135");
		}
		else if (mytype=="3")
		{
			window.open ("http://www.souxj.cn/search/?keyword="+mykeyword+"&type=all");
		}
	}
}

function CountDown(sec)
{
	mysec=sec-1;
	if (mysec==0)
	{
		searchbar.style.display='none';
	}
	else
	{
		if (myfocus==0)
		{
			document.all.countdown.title=""+mysec+"秒后自动隐藏";
			setTimeout("CountDown(mysec);",1000);
		}
		else
		{
			document.all.countdown.title="点击这里隐藏搜索条";
		}
	}
}



function MoveWithScroll() 
{ 
	 if(typeof window.pageYOffset != 'undefined') { 
        nowY = window.pageYOffset; 
     } 
     else if(typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') { 
        nowY = document.documentElement.scrollTop; 
     } 
     else if(typeof document.body != 'undefined') { 
        nowY = document.body.scrollTop; 
     }  

	  //nowY = document.body.scrollTop;
		percent = .1*(nowY - lastScrollY);
		if(percent > 0) 
		{
			percent=Math.ceil(percent);
		} 
		else
		{
			percent=Math.floor(percent);
		}

	 document.getElementById("searchbar").style.top = parseInt(document.getElementById("searchbar").style.top) + percent+"px";
	 lastScrollY = lastScrollY + percent;
	 tOut = window.setTimeout("MoveWithScroll()",1);
}

CountDown(60);
window.setTimeout("MoveWithScroll()",1);