function click_input(thisinput, searchUrl)
{	

	var keyword = document.getElementById("search_keyword").value;
	if(keyword == "想找什么？输入类别或关键字试试")
		keyword="";
	if(document.images) 
	{ 
		(new Image()).src='http://bj.ganji.com/adcount.php?search-from-URL='+ location.href+'&search-keyword='+keyword+'&search-select='; 
	}
	if(!keyword)
	{
		var _search_type = document.getElementById("search_type").value;
        if(_search_type == 'site'){
            window.location.href = '/';
        }else{
            switch(_search_type){
                case 'qjianzhi':
                    _search_type = 'qiuzhi';
                    break;
                case 'tongchengjiaoyou':
                    _search_type = 'jiaoyou';
                    break;
                case 'tongchenghuodong':
                    _search_type = 'huodong';
                    break;
               case 'cheliang':
                    _search_type = 'che';
                    break;
               case 'shenghuofuwu':
                    _search_type = 'huangye';
                    break;
               case 'shangwufuwu':
                    _search_type = 'shangwu';
                    break;
           }
            window.location.href = '/'+_search_type;
        }
		return false;
	}
	else
	{
		if (searchUrl)
		{
			var url = searchUrl + "/" + document.getElementById("search_type").value + "/s/_" + 
				document.getElementById("search_keyword").value;
		}
		else
		{
			var url = "http://" + window.location.host + "/" + document.getElementById("search_type").value + "/s/_" + 
				document.getElementById("search_keyword").value;
		}
		window.location.href = encodeURI(url);
		return false;
	}
}

function inputStyle(){
	var keyword = document.getElementById("search_keyword").value;
	if(keyword != "想找什么？输入类别或关键字试试")
		document.getElementById("search_keyword").className="txt_search";
	else
		document.getElementById("search_keyword").className="f_c_gray2";
}


function open_new_window(url,window_name,features) 
{
	window.open(url,window_name,features);
}

function clickGoogleSearch(thisinput)
{		
	var   keyword="searchword";
	if(document.images) 
	{ 
		(new Image()).src='http://bj.ganji.com/adcount.php?search-googlefrom-URL='+ location.href+'&search-googlekeyword='+keyword; 
	}		
}


var searchInput = document.getElementById('search_keyword');
function inputFocus()
{if(!searchInput)return;
    if(searchInput.value == '想找什么？输入类别或关键字试试')
        searchInput.value = '';
} 
function inputBlur()
{if(!searchInput)return;
    if(searchInput.value ==''){
        searchInput.className = "f_c_gray2 txt_search_gray txt_search";
        searchInput.value = '想找什么？输入类别或关键字试试';
    }   
}
if(searchInput){
if(window.addEventListener)
{
    searchInput.addEventListener('focus',inputFocus,false);
    searchInput.addEventListener('blur',inputBlur,false);
}
else
{
    searchInput.attachEvent('onfocus',inputFocus);
    searchInput.attachEvent('onblur',inputBlur);
}
}

//初始化全站智能搜索
if ( window.jQuery ) {
	$('#search_keyword').websiteSearch();
}
