var sType = 0;
var searchPath = "";
function searchItems(){
	var spath = $.trim($("#ssearch").val());
	if (spath.length < 2){
		ajaxMsg("ajaxerror","搜索关键字必须大于2个字符！");
		return;
	}
	spath = encodeURI(encodeURI(spath));
	var url = searchPath + "_" + spath;
	document.location.href = url;
}
$(function(){
	var spath = location.href + "";
	if (spath.split("/")[spath.split("/").length-2] == "agency"){
		searchPath = contextPath + "/agency/search";
		sType = 1;
		document.getElementById("ssearch").value = "留学中介全能搜索";
	} else if (spath.split("/")[spath.split("/").length-2] == "language"){
		searchPath = contextPath + "/language/search";
		sType = 8;
		document.getElementById("ssearch").value = "英语培训全能搜索";
	} else if (spath.split("/")[spath.split("/").length-2] == "activity"){
		searchPath = contextPath + "/activity/search";
		sType = 2;
		document.getElementById("ssearch").value = "活动讲座全能搜索";
	} else if (spath.split("/")[spath.split("/").length-2] == "community"){
		searchPath = contextPath + "/community/group/search";
		sType = 3;
		document.getElementById("ssearch").value = "讨论组全能搜索";
	} else if (spath.split("/")[spath.split("/").length-2] == "ranking"){
		searchPath = contextPath + "/ranking/search";
		sType = 4;
		document.getElementById("ssearch").value = "大学排名全能搜索";
	} else if (spath.split("/")[spath.split("/").length-2] == "exp") {
		searchPath = contextPath + "/exp/list_3_0";
		sType = 9;
		document.getElementById("ssearch").value = "经验分享全能搜索";
	} else {
		searchPath = contextPath + "/university/list";
		sType = 5;
		document.getElementById("ssearch").value = "全球院校全能搜索";
	} 
});
