
//得到对象和属性操作
var $ = function(el){
	return (typeof el == 'object')?el:document.getElementById(el);
};
 var searchType = "key"; 
 var productType="1"; 

//改变查询模块颜色
function Search_Select(type)
{
   $("search_div").className="search_shu1"	
   
    if(type=="key")
   {   
     $("keyword").value="Input Keywords";
     productType="1";
     
   }else if(type=="cp")
   {
     $("keyword").value="Input the products you are searching";  
     productType="2";
        
   }else  if(type=="dc")
   {
     $("keyword").value="Input the area or address";  
     productType="3";
        
   }else  if(type=="qy")
   {
     $("keyword").value="Input the Company name";    
     productType="4";
     
   }    
        
    $("anniu_" + searchType).style.background = "none";
    $("anniu_" + type).style.background = "url(http://www.114chn.com/style/images/bj_hong1.gif)";
    $("anniu_" + searchType).style.color = "#000";
    $("anniu_" + type).style.color = "#fff";
    $("anniu_" + type).style.backgroundRepeat = $("anniu_" + searchType).style.backgroundRepeat = "no-repeat";
    searchType = type;
  
   
}

//提交查询
function Search_Submit()
{
    $("search_div").className="search_shu1"	    
	if(IsEmpty($("keyword"),"Please enter a keyword!")) return false;
	if(IsHaveScript($("keyword"),"No website shall be included in keywords!")) return false;
	if(LengthCompare($("keyword"),100,"The keywords shall contain less than 100 characters!")) return false;	
	var keyword = $("keyword").value;
	

	if(keyword.length < 2)
	{
	    alert("The Keyword is too short！");
	    return false;
	}
	
	 window.open("http://www.moldpage.com/Com_list.asp?key="+encodeURI(keyword) +"&stype="+productType);
    
    
}

function  AutoTxt()
{

  $("keyword").focus();           
  //$("keyword").select(); 
  
  keyvalue= $("keyword").value;
  if(keyvalue=="Input the products you are searching" || keyvalue=="Input the area or address" || keyvalue=="Input Keywords" || keyvalue=="Input the Company name")
  {  
    $("keyword").value="";	
  }
  $("search_div").className="search_changefontcolor";
}



function btnkeypress(event)
{
    
    var code = 0;
    code = event.keyCode;
    if (code==13)
    {
        event.keyCode = 0;

        Search_Submit();
    }
}


function Openpage(areacode)
{
    window.open("http://www.moldpage.com/com_list.asp?type="+productType+"&areaid="+areacode);
}

