document.write("<scr"+"ipt language='javascript' src='/getWWWInfo.asp'></scr"+"ipt>");
var srcHref = window.location.href.toUpperCase();
var srcHrefs = window.location.href;
if(srcHref.indexOf('.ASP')>=0)
{
}
else
{
	if(srcHref.indexOf('MAP.CHINAOK.COM')>=0)
	{
	   window.location.href = "http://www.mapforyou.com"+srcHrefs.substr(srcHref.indexOf('MAP.CHINAOK.COM')+15);  
	}
	else if(srcHref.indexOf('WWW.CHINATREE.COM')>=0)
	{
	   window.location.href = "http://www.mapforyou.com"+srcHrefs.substr(srcHref.indexOf('WWW.CHINATREE.COM')+17);  
	}
	else if(srcHref.indexOf('MAPS.CHINAOK.COM')>=0)
	{
	   window.location.href = "http://www.mapforyou.com"+srcHrefs.substr(srcHref.indexOf('MAPS.CHINAOK.COM')+16);  
	   }
	else if(srcHref.indexOf('WWW.MAPFORYOU.COM.CN')>=0)
	{
	   window.location.href = "http://www.mapforyou.com"+srcHrefs.substr(srcHref.indexOf('WWW.MAPFORYOU.COM.CN')+20);  
	}
}
document.write("<div align='center'>");
document.write("	<table cellpadding='0' cellspacing='0' width='760'>" );
document.write("	<tr>" );
document.write("			<td height='58' width='180' rowspan='2' style='font-size:9pt' nowrap>" );
document.write("			<img border='0' src='/images/logo.gif' width='180' height='58' nowrap>" );
document.write("			<td height='20' class='style1' colspan='2'>" );
document.write("			<p style='MARGIN-TOP: 4px;font-size:9pt' align='right'>" );
document.write("			<a  href='/'>" );
document.write("			首页</a> | <a  href='/okmap/'>地图搜索</a> | <a  href='/enterprise/'>企业黄页</a> | <a  href='/city_new/'>城市黄页</a> | <a  href='/company/'>服务与产品</a> | <a  href='/okmap/api/'>地图引用</a></td>" );
document.write("		</tr>" );
document.write("		<tr>" );
document.write("			<td height='38' nowrap  align='right'>" );
document.write("			<font color='#000099'>镜像：<a href='http://tel.mapforyou.com/enterprise/' style='color:#000099'>电信</a>  <a href='http://cnc.mapforyou.com/enterprise/' style='color:#000099'>网通</a></font>&nbsp;" );
document.write("			</td>" );
document.write("			<td height='38' nowrap>" );
document.write("			<div align='right' id='user_not_login' style='diplay:block'>" );
document.write("				<form name='login' action='' target='_self' method='post'>" );
document.write("				<table cellpadding='0' width='100%' style='border-collapse: collapse; font-size:9pt' height='100%'>" );
document.write("					<tr>" );
document.write("						<td height='100%' style='border-collapse: collapse;text-align:right' id='table40' height='100%'>" );

document.write("						用户名:<input type='text' name='username' value='' size='12' style='height:18'/> " );
document.write("						密码:<input type='password' name='password' value='' size='12'style='height:18'/>" );
document.write("						<input value='登录' onclick='return checkLogin()' type='submit'/> " );
document.write("						<input value='注册' onclick=location.href='/login/reguser.html' type='button'/> </td>" );	
document.write("            <td nowrap><p style='text-align: right; margin-right:3px; margin-top:2px; margin-bottom:2px'>		<a href='/enterprise/reg/joinEnt_step_1.jsp'>		<img border='0' src='/enterprise/images/addin.gif'></a></td>" )
document.write("					</tr>" );
document.write("				</table>" );
document.write("				</form>" );
document.write("			</div>" );
document.write("			<div align='right' id='user_logined' style='diplay:none'>" );
document.write("				<table cellpadding='0' width='100%' style='border-collapse: collapse; font-size:9pt'   height='100%'>" );
document.write("					<tr>" );
document.write("						<td height='100%' style='border-collapse: collapse;text-align:right'  height='100%'nowrap>" );
document.write("							<span id='show_logined_state' style='font-size:9pt'></span>" );
document.write("						</td>			" );		
document.write("					</tr>" );
document.write("				</table>" );
document.write("			</div>" );
document.write("			</td>" );
document.write("		</tr>" );
document.write("	</table>" );
document.write("<table cellspacing='0' cellpadding='0' style='border-collapse: collapse;width: 760px; height: 100px;margin-bottom:5px;' >")
document.write("<tr>")
document.write("<td>")
document.write("<a target='_blank' href='http://yw.chinaok.com'><img src='/images/yw20090703.jpg' border='0' width='760' height='100'></a>")
document.write("</td>")
document.write("</tr>")
document.write("</table>")

document.write("</div>");

	/**
		检查用户输入的值并提交
		*/
	function checkLogin()
	{
		if(login.username.value=="")
		{
			alert("请输入用户名！");
			login.username.focus();
			return false;
		}
		if(login.password.value=="")
		{
			alert("请输入密码！");
			login.password.focus();
			return false;
		}
		
		var ref=window.location.href;
		//alert(ref);
		var reg=/.*\?url=([^&]+).*/;
		var v=ref.match(reg);

		document.login.action="/PermitLogin.asp";
		if(v)
		{
			document.login.action="/PermitLogin.asp"+"?url="+v[1];
		}
		return true;	
	}

function Ajax()
{
		//定义XMLHttpRequest对象实例
		this.http_request = false;
		//定义可复用的http请求发送函数
		this.sendRequest=function(method,url,content,responseType) {//初始化、指定处理函数、发送请求的函数
			this.http_request = false;
			//开始初始化XMLHttpRequest对象
			if(window.XMLHttpRequest) { //Mozilla 浏览器
				this.http_request = new XMLHttpRequest();
				if (this.http_request.overrideMimeType) {//设置MiME类别
					this.http_request.overrideMimeType("text/xml");
				}
			}
			else if (window.ActiveXObject) { // IE浏览器
				try {
					this.http_request = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						this.http_request = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {}
				}
			}
			if (!this.http_request) { // 异常，创建对象实例失败
				window.alert("不能创建XMLHttpRequest对象实例.");
				return false;
			}
			if(responseType.toLowerCase()=="text") {
				this.http_request.onreadystatechange = this.processTextResponse;
			}
			else if(responseType.toLowerCase()=="xml") {
				this.http_request.onreadystatechange = this.processXMLResponse;
			}
			else {
				window.alert("响应类别参数错误。");
				return false;
			}
			// 确定发送请求的方式和URL以及是否异步执行下段代码
			if(method.toLowerCase()=="get") {
				this.http_request.open(method, url, true);
			}
			else if(method.toLowerCase()=="post") {
				this.http_request.open(method, url, true);
			}
			else {
				window.alert("http请求类别参数错误。");
				return false;
			}
			this.http_request.send(content);
		}
		// 处理返回文本格式信息的函数
		this.processTextResponse=function() {
			//alert(this.http_request.readyState+"   "+this.http_request.status);
			/**if (this.http_request.readyState == 4) { // 判断对象状态
				if (this.http_request.status == 200) { // 信息已经成功返回，开始处理信息
					alert(this.http_request.responseText);
					alert("Text文档响应。");
				} else { //页面不正常
					alert("您所请求的页面有异常。");
				}
			}*/
			alert("processTextResponse,该方法必须被重载才使用");
		}
		//处理返回的XML格式文档的函数
		this.processXMLResponse=function() {
			/**if (this.http_request.readyState == 4) { // 判断对象状态
				if (this.http_request.status == 200) { // 信息已经成功返回，开始处理信息
					//alert(this.http_request.responseXML);
					alert("XML文档响应。");
				} else { //页面不正常
					alert("您所请求的页面有异常。");
				}
			}*/
			alert("processXMLResponse,该方法必须被重载才使用");
		}
}

	/**
		检测用户登录状态
		*/
  function checkLoginState()
  {
  		var loginState=new Ajax();
			loginState.processTextResponse=function()
			{
				if (loginState.http_request.readyState == 4) { // 判断对象状态
					if (loginState.http_request.status == 200) { // 信息已经成功返回，开始处理信息
						var state=loginState.http_request.responseText;
						if(state=='-1')
						{
							var item=document.getElementById("user_not_login");
							item.style.display="block";
							item=document.getElementById("user_logined");
							item.style.display="none";
						}
						else
						{
							var username=state;
							var item=document.getElementById("show_logined_state");
							item.innerHTML=state+"，您已经成功登录！&nbsp;<a href='/permit/login.jsp'>管理</a>|<a href='/PermitLogout.asp?url=/city_new/index.html'>退出</a>&nbsp;";
							item=document.getElementById("user_not_login");
							item.style.display="none";
							item=document.getElementById("user_logined");
							item.style.display="block";
						}					
					}
				}
			}		
			loginState.sendRequest("get",'/PermitCheckLoginState.asp',null,"text");	
  }	
checkLoginState();


