///////////热门搜索/////////////
function queryKeyword(){
	Ext.Ajax.request({"url":webroot+'index/indexCommon.do?method=queryKeywordList',"method":"POST",success:function(r){doSuccess2(r);}});	
}

function doSuccess2(response){
	var responsevalue = response.responseText;  
	var queryKeyword=document.getElementById('queryKeyword');
	queryKeyword.innerHTML=responsevalue;
   		
 }
 ///////////促销类别////////
 function promotionType(){
 	Ext.Ajax.request({"url":webroot+'index/indexCommon.do?method=bottomMerchantTypeList',"method":"POST",success:function(r){doSuccessPromotion(r);}});
 }
 function doSuccessPromotion(response){
	var responsevalue = response.responseText;  
	var str=responsevalue.split("-");
	//促销分类
	var resVale=str[0];
	var proVale=resVale.split("|");
	var strpro="<ul class=\"promo_list\">";
	if(proVale.length>0){
		for(var i=0;i<proVale.length-1;i++){
			var value=proVale[i];
			strpro=strpro+"<li>"+value+"</li>";
		}
	}
	
	var promotiontypeDiv=document.getElementById("promotiontypeDiv");
	promotiontypeDiv.innerHTML=strpro+"</ul>";
	//商户分类
	myArray=str[1].split(",");
	var str1="<ul class=\"promo_list\">";
	if(myArray.length>0){
		for(var i=0;i<myArray.length-1;i++){
			var value=myArray[i];
			str1=str1+"<li>"+value+"</li>";
		}
	}
	var merchantTypeDiv=document.getElementById("indexmerchantTypeDiv");
	merchantTypeDiv.innerHTML=str1+"</ul>";
	//试用品牌
	var trytype=str[2].split(",");
	var strtry="<ul class=\"promo_list\">";
	if(trytype.length>0){
		for(var i=0;i<trytype.length-1;i++){
			var value=trytype[i];
			strtry=strtry+"<li>"+value+"</li>";
		}
	}
	
	var trybrandTypeDiv=document.getElementById("indextrybrandTypeDiv");
	trybrandTypeDiv.innerHTML=strtry+"</ul>";
	//热门城市
	var hotcity=str[3].split("|");
	var hotCityDiv=document.getElementById("hotCityDiv");
	var strhotcity="";
	if(hotcity.length>0){
		for(var i=0;i<hotcity.length-1;i++){
   				var value=hotcity[i];
   				array1=value.split(",");
   				strhotcity="<td height=45><a href=\""+webroot+"index/index.do?method=innerMain&city="+array1[0]+"\">"+array1[1]+"</a></td>"+"  "+strhotcity;
   			}
   		}
   		//alert(strhotcity);
   		hotCityDiv.innerHTML="<tr>"+strhotcity+"<tr>";
	}
  
  function submitPromotionForm(promotionType,promotionName){
 	 document.getElementById("promotiontype").value = promotionType;
 	 document.getElementById("promotionname").value = promotionName;
 	 document.getElementById("promotionForm").submit();
  
  }
 
/////////////热门城市/////////
function hotCity(){
	Ext.Ajax.request({"url":webroot+'index/indexCommon.do?method=cityList',"method":"POST",success:function(r){doSuccessHotCity(r);}});	
}
function doSuccessHotCity(response){
	var responsevalue = response.responseText;  
	var hotCityDiv=document.getElementById("hotCityDiv");
	if(responsevalue.length>0){
   		myArray=responsevalue.split("|");
   		var str="<tr>";
   		var str1="";
   		for(var i=0;i<myArray.length-1;i++){
   			var value=myArray[i];
   			array1=value.split(",");
   			
   			 str1="<td height=45><a href=\""+webroot+"index/index.do?method=innerMain&city="+array1[0]+"\">"+array1[1]+"</a></td>"+"  "+str1;
   		}
   		
   		hotCityDiv.innerHTML=str+str1+str;
   	}
 
}
////////////////根据cookie中保存的城市代号得到城市名称/////////
function getCityName(){
	//alert(GetCookie('unscardcityid'));
	Ext.Ajax.request({"url":webroot+'index/indexCommon.do?method=getCityName',"method":"POST",success:function(r){doSuccessCityName(r);}});	
}
function doSuccessCityName(response){
	var responsevalue = response.responseText;  
	
	//alert(responsevalue);
	//var cityNameDiv=document.getElementById("cityNameDiv");
   		//alert(responsevalue);
   //	cityNameDiv.innerHTML=responsevalue;
 
}
//////////////////
function clearKeyWord(){
	var keyword=document.getElementById("keyword");
	keyword.value="";
}
/////
function keywordSubmit(keyWord){
	var searchType=document.getElementById("searchType");
	var keyword=document.getElementById("keyword");
	searchType.value="1";
	keyword.value=keyWord;
	var formSearch=document.getElementById("formSearch");
	formSearch.submit();
}
	
	