var curPath=(location.pathname+location.search).toLowerCase();
var menus=$(".left li");
if(curPath=='/' || curPath=='/index.html')
{
	setMenu(0);
}
else if(curPath.indexOf('/software')>-1)
{
	setMenu(1);
	SetSearchOption('software');
}
else if(curPath.indexOf('/idc')>-1)
{
	setMenu(2);
	SetSearchOption('idc');
}
else if(curPath.indexOf('/webmaster')>-1)
{
	setMenu(3);
	SetSearchOption('webmaster');
}
else if(curPath.indexOf('/project')>-1)
{
	setMenu(4);
	SetSearchOption('project');
}
else if(curPath.indexOf('/business')>-1)
{
	setMenu(5);
	SetSearchOption('business');
}
else if(curPath.indexOf('/job')>-1)
{
	setMenu(6);
	SetSearchOption('job');
}
else if(curPath.indexOf('/company')>-1 || curPath.indexOf('/my')>-1)
{
	setMenu(7);
	SetSearchOption('company');
}


function setMenu(id)
{
	for(var i=0;i<menus.length;i++)
	{
	    $(menus[i]).addClass("out");
	}
	$(menus[id]).addClass("on");
}
$("#key").keydown(
	function(event)
	{
		if(event.keyCode==13)
		{
			return searchPost();	
		}
	}
);
function searchPost()
{
	var key=$("#key").val();
	if((key==null || key=="" || key.indexOf("请输入关键")>-1))
	{
		//alert('请输入关键字！');
		$("#key").val('');
		$("#key").focus();
		return false;
	}
	else
	{
		window.location.href="/search.aspx?key="+escape(key)+"&channel="+document.getElementById('channel').value;
	}
}
function SetSearchOption(optionvalue)
{
	$("#channel").val(optionvalue);
}
var searchKey=getParameter("key");
if(searchKey!=null && searchKey!='')
{
	$("#key").val(unescape(searchKey));
	$("#key").css("color:red;font-size:14px;");
}

//获取url参数
function getParameter(name)
{
	var r=new RegExp("(\\?|#|&)"+name+"=([^&#]*)(&|#|$)");
	var m=location.href.match(r);
	return(!m?"":m[2]);
}

