var cityCode="";
//cityCode=getCookie("CityCode");
cityCode=getCitycodebyUrl();
//alert("**"+cityCode)
if(cityCode==""||cityCode==null||cityCode=="localhost")
{
//判断域名中的城市code
	cityCode="bj"
}
function getCitycodebyUrl()
{
  var objurl=window.location.hostname.split(".");
  var url="";
  if(objurl.length>0)
  {
	url=objurl[0];
  }
  return url;
}
function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
	c_start=document.cookie.indexOf(c_name + "=")
	if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1 
		c_end=document.cookie.indexOf(";",c_start)
		if (c_end==-1) c_end=document.cookie.length
		return unescape(document.cookie.substring(c_start,c_end))    
		} 
	}
	return null
}
function gid(id)
{
	return document.getElementById?document.getElementById(id):null;
}
function jumpCitylocation(cityCode)
{

	//更新城市cookies;
	//document.cookie="CityCode="+cityCode+";";
	//document.cookie="CityCode="+cityCode;
	//document.location.reload();
}
function getCityName(cityCode)
{
	var cityname="未知";
	switch (cityCode)   
	{   
		case   "bj":   cityname   =   "北京";   
		break;   
		case   "zz":   cityname   =   "郑州";   
		break;   
		case   "sh":   cityname   =   "上海";   
		break;   
		case   "tj":   cityname   =   "天津";   
		break;   
		case   "cq":   cityname   =   "重庆";   
		break;   
		case   "cd":   cityname   =   "成都";   
		break;   
		case   "gz":   cityname   =   "广州";   
		break; 
		case   "sz":   cityname   =   "深圳";   
		break; 
		case   "wh":   cityname   =   "武汉";   
		break; 
		case   "jn":   cityname   =   "济南";   
		break; 
		case   "xa":   cityname   =   "西安";   
		break;
	}
	cityname="<font color=red>" +cityname +"</font>"
	return cityname;
}

function SelectCity(objdivId,objhId)
{
	if(document.getElementById(objdivId).style.display == "block")
	{
		mcl(false,objdivId, objhId, true);
	}
	else
	{
		mcl(true,objdivId, objhId, true);
	}	
}
function SelectCityOnIndex(objdivId,objhId)
{
	var objdiv =document.getElementById(objdivId);
	var objh =document.getElementById(objhId);
	if(objdiv.style.display == "block")
	{
		objdiv.style.display = "none";
	}
	else
	{
		objdiv.style.top = (objh.offsetTop + objh.offsetHeight+8) + "px";
		
		objdiv.style.left = "496px";
		
		objdiv.style.display = "block";
	}	
}
function SelectCityOnSearch(objdivId,objhId)
{

	var objdiv =document.getElementById(objdivId);
	var objh =document.getElementById(objhId);
	if(objdiv.style.display == "block")
	{
		objdiv.style.display = "none";
	}
	else
	{
		objdiv.style.top = (objh.offsetTop + objh.offsetHeight+8) + "px";
		
		objdiv.style.left = "60px";
		
		objdiv.style.display = "block";
	}	
}
function closeSelCityDiv()
{
	var objdiv =document.getElementById("MenuCityList");
	objdiv.style.display = "none";
}

function getDivCitys(sign)
{
	var strDivcitys="";
	var strUrl="";
	//strDivcitys=strDivcitys+'<DIV class="FlowMenuList" id="MenuCityList" style="LEFT: '+lpx+'px; TOP: '+tpx+'px" Z-INDEX: 1200>';
	//strDivcitys=strDivcitys+'<DIV id="MenuCityList" class="FlowMenuList" style="position:absolute;display:none;z-index:1200;width:200;height:200">';
	strDivcitys=strDivcitys+'<DIV id="MenuCityList" class="FlowMenuList" style="position:absolute;display:none;z-index:1200">';
	strDivcitys=strDivcitys+'<TABLE bgcolor=#ffffff style="font:12px">';
	if(sign==0)
	{
		strDivcitys=strDivcitys+'<TR><a onclick="closeSelCityDiv()"><td align="right" colspan="5"><img src="http://'+getHost(document.URL)+'/images/f03.gif" hspace="3" vspace="3" alt="关闭窗口"></a></td></tr>';
	}
	if(sign==1)
	{
		strDivcitys=strDivcitys+'<TR><a onclick="SelectCity(\'MenuCityList\', \'MenuCity\')"><td align="right" colspan="5"><img src="http://'+getHost(document.URL)+'/images/f03.gif" hspace="3" vspace="3" alt="关闭窗口"></a></td></tr>';
		strUrl="/kecheng/class.htm";
	}
	
	strDivcitys=strDivcitys+'<TR>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://bj.soojoo.cn'+strUrl+'">北京</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://sh.soojoo.cn'+strUrl+'">上海</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://tj.soojoo.cn'+strUrl+'">天津</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://zz.soojoo.cn'+strUrl+'">郑州</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://cq.soojoo.cn'+strUrl+'">重庆</A></TD>';
	
	strDivcitys=strDivcitys+'</TR>';
	strDivcitys=strDivcitys+'<TR>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://gz.soojoo.cn'+strUrl+'">广州</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://sz.soojoo.cn'+strUrl+'">深圳</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://cd.soojoo.cn'+strUrl+'">成都</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://wh.soojoo.cn'+strUrl+'">武汉</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://jn.soojoo.cn'+strUrl+'">济南</A></TD>';
	strDivcitys=strDivcitys+'<TD><A class="B" href="http://xa.soojoo.cn'+strUrl+'">西安</A></TD>';
	strDivcitys=strDivcitys+'</TR>';
	
	strDivcitys=strDivcitys+'<TR><td align=right colspan=5>更多城市</td></tr>';
	strDivcitys=strDivcitys+'</TABLE>';
	strDivcitys=strDivcitys+'</div>';
	document.write(strDivcitys);
}



function jumpChannelUrl(channel)
{
var url="";
var kw="";
if(document.all.item("kw").value.substring(0,1)!='请')
{
	kw=document.all.item("kw").value;
}

if(kw!=""&&kw!=null)
	{
		kw=escape(kw);
	}
switch (channel)   
	{   
		case   1:   //课程
		url   =   "../kecheng/search.aspx";   
		break;   
		case   2:   //学校
			url   =   "../xuexiao/search.aspx";   
		break;   
		case   3:   //家教
			url   =   "../hometea/ht_msg_list.aspx";   
		break;		 //资料	
		case   4:   
			url   =   "../ziliao/search.aspx";   
		break;   
		case   5:   //点评
			url   =   "../dianping/index.aspx";   
		break;   
		case   6:   //问答
			url   =   "../wenda/index.aspx";   
		break;  
		case   10:   //学吧
			url   =   "../xuebar/search.aspx";   
		break;   
	}   
	if(url!="")
	{
		if(kw!="")
		{
			url=url+"?kw="+kw;
		}
		//alert(url);
		window.location.href(url);
	}

}
							
							