var breadcityover = false;
function changeCity(pid,c)
{
	var obj = document.getElementById("JS_City_Layer");
	obj.innerHTML = "<font class='" + c + "'>正在读取城市列表，请等待……如果1分钟后无响应，请按F5或点<a href='javascript:void(0)' onclick='window.location.reload()' class='" + c + "'>这里刷新</a></font>";
	eval("setTimeout('readcityover(" + pid + ",\"" + c + "\")',9000)");
	sCity.src = "../inc/ReadCity.aspx?ID=" + pid + "&C=" + c;
}

function readcityover(pid,c)
{
	if (!breadcityover)
	{
		sCity.src = "../inc/ReadCity.aspx?ID=" + pid + "&C=" + c;
	}
}

function setCityHtml()
{
	var obj = document.getElementById("JS_City_Layer");
	if (obj == null)
	{
		setTimeout("setCityHtml()",100);
		return;
	}
	var strBody = "";
	for (var i=0;i<CityItem.length ;i++ )
	{
		strBody += (strBody == "" ? "" : "、") + CityItem[i];
	}
	obj.innerHTML = strBody;
	breadcityover = true;
}

function scroll_provice(oname,iStyle)
{
	var obj = document.getElementById(oname);
	var iWidth = obj.offsetWidth / 3;
	var jLeft = obj.scrollLeft;
	if (jLeft < 0)
	{
		jLeft = 0;
	}
	var iLeft = iStyle == 1 ? jLeft - iWidth : jLeft + iWidth;
	if (iLeft < 0)
	{
		iLeft = 0;
	}
	obj.scrollLeft = iLeft;
}

function calculateSumOffset(idItem, offsetName)
{
	var totalOffset = 0;
	var item = eval('idItem');
	do
	{
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	} while (item != null);
	return totalOffset;
}

function changeSearchType(istyle)
{
	for (var i=1;i<=6 ;i++ )
	{
		if (i == istyle)
		{
			document.getElementById("search_Img_" + i).src = "images/search_" + i + "_1.jpg";
			document.getElementById("c").value = istyle;
		}
		else
		{
			document.getElementById("search_Img_" + i).src = "images/search_" + i + ".jpg";
		}
	}
}

function hos_change(obj, objname)
{
	document.getElementById(objname).options[0].text = "加载科室...";
	document.getElementById(objname).disabled = true;
	document.getElementById("sobjChange").src = "../inc/ReadSpeciality.aspx?ID=" + obj.value + "&CName=" + objname;
}

function spe_change(obj, objname)
{
	document.getElementById(objname).options[0].text = "加载医生...";
	document.getElementById(objname).disabled = true;
	document.getElementById("sobjChange").src = "../inc/ReadDoctor.aspx?ID=" + obj.value + "&CName=" + objname;
}

function changePaihang(i)
{
	paihangNowIndex = i;
	ShowPaihang();
}

var paihangItem = new Array();
var paihangItemIndex = 0;
var paihangNowIndex = 0;
function paihangProperty(id,name,link)
{
	this.ID = id;
	this.Name = name;
	this.MoreLink = link;
}

paihangItem[paihangItemIndex++] = new paihangProperty(1,"健康顾问排行榜","Permanent.aspx");
paihangItem[paihangItemIndex++] = new paihangProperty(2,"医院排行榜","Hosindex.aspx");
paihangItem[paihangItemIndex++] = new paihangProperty(3,"专科排行榜","Speindex.aspx");

function ShowPaihang()
{
	var strBody = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#D5D5D5\"><tr><td height=\"32\" background=\"images/mysy_zktj_phb.gif\" style=\"padding-top: 6px\">";
	strBody += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"100%\"><tr><td style=\"padding-left: 20px\" width=\"80%\"><span class=\"style3\">" + paihangItem[paihangNowIndex].Name + "</span></td><td width=\"20%\" nowrap aling=\"right\"><a href=\"" + paihangItem[paihangNowIndex].MoreLink + "\" target=\"_blank\" class=\"b\"><span class=\"style4\">&gt;&gt;更多</span></a>&nbsp;&nbsp;&nbsp;</td></tr></table>";
	strBody += "</td></tr><tr><td bgcolor=\"#D6D6D6\" class=\"bk2\">";
	strBody += document.getElementById("paihangLayer" + paihangNowIndex).innerHTML;
	strBody += "</td></tr>";
	for (var i=0;i<paihangItem.length ;i++ )
	{
		if (i != paihangNowIndex)
		{
			strBody += "<tr><td align=\"center\" background=\"images/mysy_jkgw_op.gif\" height=\"32\" align=\"\" class=\"fb\" style=\"cursor: hand\" onclick=\"changePaihang(" + i + ")\">" + paihangItem[i].Name + "</td></tr>";
		}
	}
	strBody += "</table>";
	document.getElementById("paihangLayers").innerHTML = strBody;
}










function searchForm2_CheckData(theform)
{
	if (theform.q.value == "" || theform.q.value == "请选定分类后在此填写你要搜索的内容")
	{
		alert("请输入关键字！");
		theform.q.value == "";
		theform.q.focus();
		return false;
	}
	switch (theform.c.value)
	{
	case "0":
		theform.action = "../Hospital/Hoslist.aspx";
		break;
	case "1":
		theform.action = "../Hospital/Doclist.aspx";
		break;
	case "2":
		theform.action = "../Hospital/Speciality.aspx";
		break;
	case "3":
		theform.action = "";
		break;
	case "4":
		theform.action = "../News/Search.aspx";
		break;
	case "5":
		theform.action = "../Hospital/Hoslist.aspx";
		break;
	}
	return true;
}

function searchForm_checkData(theform)
{
	if (theform.q.value == "")
	{
		alert("请输入关键字！");
		theform.q.focus();
		return false;
	}
	if (theform.c.value == "")
	{
		theform.c.value = "1";
	}
	var ic = parseInt(theform.c.value);
	switch (ic)
	{
	case 2:
		theform.action = "Doclist.aspx";
		break;
	case 3:
		theform.action = "Speciality.aspx";
		break;
	case 4:
		theform.action = "";
		return false;
	case 5:
		theform.action = "Hoslist.aspx";
		break;
	case 6:
		theform.action = "";
		return false;
		break;
	default:
		theform.action = "Hoslist.aspx";
		break;
	}
	return true;
}

function Hosnewsearch_checkData(theform)
{
	if (theform.q.value == "")
	{
		alert("请输入关键字！");
		theform.q.focus();
		return false;
	}
	return true;
}

function comentForm_CheckData(theform)
{
	if (theform.nLogined.value == "1")
	{
		if (theform.UserName.value == "")
		{
			alert("请输入用户名！");
			theform.UserName.focus();
			return false;
		}
		if (theform.UserPass.value == "")
		{
			alert("请输入密码！");
			theform.UserPass.focus();
			return false;
		}
	}
	if (theform.InfoTitle.value == "")
	{
		alert("请输入标题！");
		theform.InfoTitle.focus();
		return false;
	}
	if (theform.InfoIntro.value == "")
	{
		alert("请输入内容！");
		theform.InfoIntro.focus();
		return false;
	}
	return true;
}