﻿function Search()
{
   if (SearchCheck())
     NameSearch();
}

function SearchCheck()
{
   var Key = document.all("Key").value.replace(/(^\s*)|(\s*$)/g,"");
   if (Key == "" || Key == "搜索您感兴趣的公司")
   {
	alert("请输入您要搜索的公司名称");
	document.all("Key").focus();
	return false;
   }
   return true;
}

function NameSearch()
{
    document.location = "/Search.html?Key=" + encodeURI(document.all("Key").value)+ "_00_1";
}

function GetCookie(cookiename)
{
    var thebigcookie = document.cookie;
    var firstchar = thebigcookie.indexOf(cookiename);
    if (firstchar != -1) {
        firstchar += cookiename.length + 1;
        lastchar = thebigcookie.indexOf(";",firstchar);
        if(lastchar == -1) lastchar = thebigcookie.length;
        return unescape(thebigcookie.substring(firstchar, lastchar));
    }
    return "";
}

function Load()
{
	var company = GetCookie("Company");
	if (company ==null || company == "")
		return;
	company=unescape(company);
	var list = company.split("|");
	for(var i=0;i<list.length-1;i=i+2)
	{
		document.getElementById('History').innerHTML += '<li><a href="/Company/'+list[i]+'.html">'+list[i+1]+'</a></li>';
	}
}