var iVis;
var gid=1;
function $E(id){ return document.getElementById(id);}
isUndef  = function(a){ return typeof a == "undefined";}
String.prototype.trim = function()
{
	return this.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "");	
};
function getId(){var s=window.location.href;if((d1=s.indexOf("#id="))!=-1){s = s.substring(d1+4);if((d1=s.indexOf("&"))!=-1){s = s.substring(0,d1);}gid = s;}else{gid =1;}};
function tongji(b,u,s) 
{ 
    var content = b;
	var tit = u;
	var  po = s;
    window.setTimeout(function() 
    { 
        t(content,tit,po); 
    }, 1); 
} 
function t(b,u,s)
{
	if(document.images)
	{
		var url = window.document.location.href;
		var stime =new Date().getTime();
		b=b.replace(/<[^<>]+>/g, "");
		var img = new Image();
		img.src="http://s.beesou.com/databack.aspx?query=click&title="+encodeURIComponent(b) +"&url="+encodeURIComponent(u)+"&spos="+s+"&path="+ escape(url) +"&t="+ stime +"&pattern=0";
	}
	return true;
}

function load()
{
   var s=window.location.href;
   var d1;
   if((d1=s.indexOf("#id="))!=-1)
   {
       s=s.substring(d1+4);
	   if((d1=s.indexOf("&"))!=-1)
	   {
		  s = s.substring(0,d1);
	   }
	   gid=s;
   }
}

function fl()
{
	var s=location.href;
	if(s.indexOf("q=")!=-1)
	{
		try
		{
			var q=(s.match(new RegExp("q=[^&$#]*")).toString());
			$E("s").value=decodeURIComponent(q.substr(2));
		}
		catch(e){}
	}
}


function m(o,p)
{
    var u=o.href;
	var w = $E("s").value;
	if(w.length>0)
	{
		var qw = encodeURIComponent(w);
		o.href=o.href+"?q="+qw;
	}
	getId();
	if(gid!=1 && !isUndef(gid))
	   o.href += "#id="+gid;
	return 1;
}
function toGoo()
{
   var o="http://www.google.cn/search";
    var w = $E("s").value;
	if(w.length>0)
	{
		var qw = encodeURIComponent(w);
		o+="?q="+qw+"&client=aff-beesou&ie=UTF-8&oe=UTF-8&hl=zh-CN&channel=search";
	}
	top.location = o;
}
function kankan()
{
  var t = new Date().getTime();;
  var u = "http://www.beesou.com/kankan/index.aspx";
  window.open(u);
}


function check()
{
   var i=0;
   var s2 = 'ra_';
   var s1;
   var tail="&f=1";
   var w = encodeURIComponent($E("s").value.trim());
   for(;i<4;++i)
   {
      s1 = s2+i;
	  if($E(s1).checked == true)
	     break;
   }
   
   var ty = 0;
   var u ="http://www.beesou.com";
   switch(i)
   {
     case 0:
	 {}
	 break;
	 case 1:
	 {
	    ty=1;
	 }
	 break;
	 case 2:
	 {
	   ty=2;
	 }
	 break;
	 case 3:
	 { 
	   formsubmit('','','',1,$E("s").value,2);
	   return true;
	 }
	 break;
   }
   if(w.length > 0)
   { 
	   if(ty>0)
	   {
	     u += "/search.aspx?search=" + w +"&id="+gid+"&ty="+ty;
	   }
	   else
	   {
	      u += "/search.aspx?search=" + w +"&id="+gid;
	   } 
   }
   		
	top.location = u;
}

function formsubmit(type,year,area,page,val,searchby)
{
  var sLink;
  if(searchby == 1)
  {
     sLink = "http://www.beesou.com/Sections/search.asp?type="+encodeURIComponent(type)+"&year="+encodeURIComponent(year)+"&area="+encodeURIComponent(area)+"&searchby=1&page=1";
  }
  else
 {
     sLink = "http://www.beesou.com/Sections/search.asp?query="+encodeURIComponent(val)+"&searchby=2&page=1"
 }

 top.location=sLink;
}
function MM_findObj(n, d) 
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() 
{
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function showMenu(i)
{
   if(i == 0)
   {
      if(iVis == 2)
	  {
	      MM_showHideLayers('more_menu1','','hide');
		  iVis = 3;
	  }
	  else if(iVis == 1)
	  { 
	      iVis = 2;
	  }
	    
   }
   else
   {
      iVis =1;
      MM_showHideLayers('more_menu1','','show');
   }
}
function add_favorite()
{ 
	if (document.all)  
	{
		$E("homepage").setHomePage('http://www.beesou.com');
	}
	else if (window.sidebar)  
	window.sidebar.addPanel('Ð¡Ëµ±ØËÑ', 'http://www.beesou.com', "");
}
