
$(document).ready(function(){
	var mtype=$("#mtype").val();
	$("#searchType li").eq(0).find("a").attr("class","fzdnaindexli2301ahover");
	$("#searchType li").each(function(){
		var arrType=$(this).attr("id").split("_");
		if($.trim(mtype)==""){
			$("#searchType li").eq(0).find("a").attr("class","fzdnaindexli2301ahover");
		}else{
			if(mtype==arrType[1]){
				$("#searchType li a").attr("class","");
				$(this).find("a").attr("class","fzdnaindexli2301ahover");
			}
		}
		$(this).click(function(){
			$("#searchType li a").attr("class","");
			$(this).find("a").attr("class","fzdnaindexli2301ahover");
			$("#opParameters").val(arrType[0]);
			$("#mtype").val(arrType[1]);
		});
	});
	
	// 点击搜索事件
	$("#searchButton").submit(function (){
		var keyWord = $.trim($("#keyWord").val());
		//alert(keyWord=='输入关键字...');
		if(keyWord=='输入关键字...'){$("#keyWord").val("");}
		var searchTypeOne = $("#mtype").val();
		var searchType = parseInt(searchTypeOne);

		switch (searchType){
			case 1: // 找店铺
				$(this).attr("action","http://"+$("#fzdnaUrl").val()+"/search/searchShop.do");
				break;
			case 2: // 找衣服
				$(this).attr("action","http://"+$("#fzdnaUrl").val()+"/search/searchClothes.do");
				break;
			case 3: // 找品牌
				$(this).attr("action","http://"+$("#fzdnaUrl").val()+"/search/searchBrands.do");
				break;
			case 4: // 找资讯
				$(this).attr("action","http://"+$("#e1htUrl").val()+"/comm/searchNewInfo.do");
				break;
			default:
				return false;
		}
	});
		
//	
//	if($("#mtype").val()==null||$.trim($("#mtype").val())==""){
//		$("#mtype").attr("value","2");
//		$("#searchType a").removeClass("fzdnaindexli2301ahover");
//		$("#clothes").attr("class","fzdnaindexli2301ahover");
//	}
//	if($("#mtype").val()==2){
//		$("#searchType a").removeClass("fzdnaindexli2301ahover");
//		$("#clothes").attr("class","fzdnaindexli2301ahover");
//	}
//	if($("#mtype").val()==1){
//		$("#searchType a").removeClass("fzdnaindexli2301ahover");
//		$("#shops").attr("class","fzdnaindexli2301ahover");
//	}
//	if($("#mtype").val()==3){
//		$("#searchType a").removeClass("fzdnaindexli2301ahover");
//		$("#brands").attr("class","fzdnaindexli2301ahover");
//	}
//	// 类型下拉框背景颜色变换事件
//	$("#searchTypeDiv li").mouseover(function (){
//		$(this).css("background","#0054A7");
//	}).mouseout(function (){
//		$(this).css("background","");
//	});		
	
//	var displayFlag = false; // 下拉框是否隐藏标志位
//	// 鼠标放入选择类型事件
//	$("#searchType").mouseover(function(){
//		displayFlag = true;
//		$("#searchTypeDiv").show()
//		$("#searchTypeDiv").mouseover(function(){
//			displayFlag = true;
//		});
//		$("#searchTypeDiv").mouseout(function (){
//			displayFlag = false;
//			// 延迟隐藏
//			setTimeout(function(){ if(!displayFlag){$("#searchTypeDiv").hide();}},1000);
//		});
//		// 延迟隐藏
//		setTimeout(function(){ if(!displayFlag){$("#searchTypeDiv").hide();}},1000);
//	});
//	// 鼠标离开选择类型事件
//	$("#searchType").mouseout(function (){
//		displayFlag = false;
//		// 延迟隐藏
//		setTimeout(function(){ if(!displayFlag){$("#searchTypeDiv").hide();}},1000);
//	});
//		
});
// 点击城市
function changeCity(city){
	$('#callBackCity').val(city);
	$('#cityCallBackForm').submit();
}

