function getE(elementid) {
	//alert(elementid);
	return document.getElementById(elementid);
}
function trim(str) {
	return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
}
function UrlEncode(str){
	str = str.replace(/[^0-9a-zA-Z]/g,function(sHex)
	{
		window.EnCodeStr = "";
		window.sHex = sHex;
		window.execScript('window.EnCodeStr=Hex(Asc(window.sHex))',"vbscript");
		return window.EnCodeStr.replace(/../g,"%$&");
	});
	return str;
}
function getAction()
{
	//navtop_classtype,navtop_q	
	classtype=getE('navtop_classtype').value;
	q = trim(getE('navtop_q').value);
	q = UrlEncode(q);
	if (q==''){alert('请填写搜索关键词！'); return false;}
	
	switch(classtype){			
		//楼盘
		case "0":
			getE("nav_form1").action= "http://newhouse.hfhouse.com/houseList.asp?q=0&keyWords=" + q;
			break;
		//新闻
		case "1":
			getE("nav_form1").action="http://news.hfhouse.com/searchList.asp?highLight=1&Q=" + q;
			break;
		//租房
		case "2":
			getE("nav_form1").action= "http://oldhouse.hfhouse.com/chuzu/___________20_"+q+"_.html";
			break;
		//售房
		case "3":
			getE("nav_form1").action= "http://oldhouse.hfhouse.com/chushou/___________20_"+q+"_.html";
			break;
		//视频
		case "4":
			getE("nav_form1").action="http://tv.hfhouse.com/result.asp?subkey="+q+"";
			break;
		}	
	
}
//参数：indexId  搜索方式 0楼盘 1新闻 2租房 3售房 4视频，searchStr 关键词 
function setTopNav(indexId,searchStr)
{
document.getElementById('navtop_classtype').options[indexId].selected = true;
document.getElementById('navtop_q').value=searchStr;
}