function menuExpend(menuid) {
	$(".ulmenu").css("display", "none");
	$("#ulmenu" + menuid).css("display", "block");
}

function showDialog(pid) {
	
	var server = $("#serverurl").attr("value");

	var height = document.documentElement.scrollTop;
	var urladdress = server + "index.php/main/getProductContent/" + pid + "";
	$.ajax({
				type : "POST",
				url : urladdress,
				success : function(data, textStatus) {
					//Msg(data);
					showBox(data,1,height + 280);
					// $("#dialogcontent").html(data);
				}
			});
}

function showBox(htmlValue,v,height){
	if(v == 1){
		$("#dialog").css("display","inline");
		$("#dialog").css("top",height);
		$("#bg").css("display","inline");
		$("#bg").css("height",height+700);
		$("#dialogcontent").html(htmlValue);
	}else{
		$("#dialog").css("display","none");
		$("#bg").css("display","none");
		$("#dialogcontent").html("");
	}
}

function hiddenDialog() {
	showBox("",0);
	//$("#dialog").css("display", "none");
}

function searchProduct() {
	var keyword = encodeURIComponent($("#keyword").attr("value"));
	if( keyword == ""){
		alert("对不起，请输入搜索关键字！");
		return;
	}
	var cityid = $("#selectcity").attr("value");
	var server = $("#serverurl").attr("value");
	var keyword = keyword.toString().replace(/%/g, "_");
	var urladdress = server + "index.php/main/productsearch/" + cityid + "/"
			+ keyword + "/0/";
	window.location = urladdress;
}
/*
function Msg() {
	// 创建弹出对话框面板
	var dvMsg = document.createElement("div");
	// 设未绝对定位很重要
	dvMsg.style.position = "absolute";
	dvMsg.setAttribute('id', 'msg');
	dvMsg.style.width = "400px";
	dvMsg.style.height = "100px";
	dvMsg.style.top = "40%";
	dvMsg.style.left = "30%";
	dvMsg.style.background = "white";
	dvMsg.style.border = "1px solid #6699dd";
	dvMsg.style.zIndex = "1112";
	// 添加至body中
	document.body.appendChild(dvMsg);
}

function Msg(str)
// 创建提示对话框面板
var dvMsg = document.createElement("div");
dvMsg.style.position = "absolute";
dvMsg.setAttribute('id', 'msg');
dvMsg.style.width = "400px";
dvMsg.style.height = "100px";
dvMsg.style.top = "40%";
dvMsg.style.left = "30%";
dvMsg.style.background = "white";
dvMsg.style.border = "1px solid #6699dd";
dvMsg.style.zIndex = "1112";
document.body.appendChild(dvMsg);
// 标题栏
var title = document.createElement("div");
title.style.position = "absolute";
title.setAttribute('id', 'title');
title.style.width = "400px";
title.style.height = "10px";
title.style.top = "0";
title.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=100,finishOpacity=100%)";
title.style.zIndex = "1113";
title.innerHTML = "<font size='2'>提示</font>";
title.style.background = "#6699ff";

// 提示图片
var imgErr = document.createElement("img");
imgErr.src = "pic/err.gif";
imgErr.style.marginLeft = "15px";
imgErr.style.marginTop = "30px";
imgErr.style.position = "absolute";

// 关闭图片
var imgClo = document.createElement("img");
imgClo.src = "pic/delete.gif";
imgClo.style.marginLeft = "378px";
imgClo.style.marginTop = "0px";
imgClo.style.position = "absolute";
imgClo.style.zIndex = "1115";
imgClo.style.cursor = "hand";
imgClo.onclick = function() {
	document.body.removeChild(dv);
	document.body.removeChild(dvMsg);
}
// 确定按钮
var btn = document.createElement("input");
btn.id = "ok";
btn.type = "button";
btn.value = "确  定";
btn.style.marginTop = "75px";
btn.style.marginLeft = "43%";
btn.style.position = "absolute";
btn.style.border = "1px solid #6699ff";
btn.style.background = "lightblue";
// 点击关闭
btn.onclick = function() {
	document.body.removeChild(dv);
	document.body.removeChild(dvMsg);
}
// 响应回车
btn.onkeydown = function() {
	if (event.keyCode == "13") {
		document.body.removeChild(dv);
		document.body.removeChild(dvMsg);
	}
}
var msg = document.createElement("div");
msg.style.marginTop = "30px";
msg.style.marginLeft = "18%";
msg.style.position = "absolute";
msg.style.width = "300px";
msg.innerHTML = str;

msg.style.wordWrap = "break-word";
document.getElementById('msg').appendChild(msg);
document.getElementById('msg').appendChild(btn);
document.getElementById('msg').appendChild(imgErr);
document.getElementById('msg').appendChild(imgClo);
document.getElementById('msg').appendChild(title);
document.getElementById('ok').focus();
}*/