// JavaScript Document
function Login()
{
	var url = "/WebService/LoginService.svc/";
		param='{"account":"'+document.getElementById("labAccount").value+'","password":"'+document.getElementById("labPwd").value+'"}';//,"CheckCode":"'+document.getElementById("labCode").value+'"
    Call(url,"LoginIn",param,OnLoginResult);
}
function OnLoginResult(result)
{
	if(result==1)			
    	  	{
	    	var Type="",Account,UserID,Licence,Name,Pwd,Point="",MsgCount="",EmailCount="";
			var cook=readCookieEx("jxjyzy");
			if(cook!=null && cook!="")
			{			
				var arr=cook.split("&");
				for(var i=0;i<arr.length;i++)
				{
					var xx=arr[i].split("=");
					if(xx[0]=="Account")
					{
						Account=xx[1];
						continue;
					}
					if(xx[0]=="UserID")
					{
						UserID=xx[1];
						continue;
					}
					if(xx[0]=="Name")
					{
						Name=xx[1];
						continue;
					}
					if(xx[0]=="Pwd")
					{
						Pwd=xx[1];
						continue;			
					}
					if(xx[0]=="Licence")
					{
						Licence=xx[1];
						continue;
					}
					if(xx[0]=="Point")
					{
						Point="你的威望值是"+xx[1];
						continue;
					}
					if(xx[0]=="EmailCount")
					{
						EmailCount=xx[1];
						continue;
					}
					if(xx[0]=="MsgCount")
					{
						MsgCount=xx[1];
						continue;
					}
					if(xx[0]=="Type")
					{
						Type=xx[1];					;
						continue;
					}
				}
				if(Type=="1")
				{
				    var s="";
				    s="<div id='help' style='float:right;padding-top:8px;'><font color='red'></font><A href='"+geturl()+"User/Index.aspx'><font color='#ffff00'>[会员中心]</font></A>&nbsp;&nbsp;";
				    s+="<A href='"+geturl()+"User/UserResEdit.aspx?EditMode=False'><font color='#ffff00'>[上传资源]</font></A>&nbsp;&nbsp;";
				    s+="&nbsp;&nbsp;<a href='javascript:LoginOut();'><strong><font color='#ffff00'>[退出]</font></strong></a></div>";
				    s+="<div style='float:left;'><IMG src='"+geturl()+"images/login_dot.png' width='30' align='absMiddle'>欢迎您"+Account +",";
				    s+=Point+"&nbsp;&nbsp;&nbsp;&nbsp;<img width='18' height='12' src='"+geturl()+"images/clip_image001.gif'>";
				    s+="<a href='"+geturl()+"User/UserInnerMessageList.aspx?Status=Receive'><font color='#FFFF00'>待阅短信("+MsgCount+")</font></a>&nbsp;&nbsp;";
				    s+="<a href='"+geturl()+"EMail/EMailLogin.aspx?ReturnUrl=http://mail.jxjyzy.com/webmailgov/mail.jsp'><font color='#FFFF00'>邮箱"+EmailCount+"</font></a></div>";
				    document.getElementById("loginin").innerHTML=s;

				}
	        }
	  }
		
	if(result==-1)			
    	alert("登录失败");
    	 if(result==-2)			
    	alert("验证码输入错误！");
}
function LoginOut()
{
	var url = "/WebService/LoginService.svc/";
	param='';
	Call(url,"LoginOut",param,OnLoginOutResult);
}
function OnLoginOutResult(result)
{
	if(result==1)
	{
		var s="";
		s+="<div id='help' style='float:right;padding-top:8px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/Register.aspx?Type=HaveCard&amp;POS=HOME'><font color='#ffff00'>新用户注册</font></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/GetPassword.aspx'><font color='#ccff00'>取回密码</font></A>>&nbsp;&nbsp;<A href='"+geturl()+"Help/Help.aspx?HelperID=14'><font color='#ccff00'>忘记帐号和密码</font></A></div>";
		s+="<div style='float:left;'><IMG  src='"+geturl()+"images/login_dot.png'  align='absMiddle' />&nbsp;&nbsp;用户名:";
		s+="<input type='text' id='labAccount' name='labAccount' style='size:10px;height:14px; width:80px;' maxlength='30'/>&nbsp;&nbsp;密 码:";
		s+="<input type='password' style='size:10px;height:14px; width:80px;'id='labPwd' name='labPwd' maxlength='8'/>";
		//   s+="&nbsp;&nbsp;验证码:<input type='text' style='size:10px; height:14px; width:40px;'id='labCode' name='labCode' maxlength='4'/><input type='image' src='"+geturl()+"Login/ValidateImage.aspx'  align='absmiddle'  border='0' value='验证码' />&nbsp;&nbsp;";
       s+=" <input type='image' src='"+geturl()+"images/index_07_r4_c8.gif' name='Submit' onclick='Login();' align='absmiddle' width='59' height='21' border='0' value='提交' /></div>		";
		document.getElementById("loginin").innerHTML=s;
	}
}
			function geturl(){
  if (!top.gAbsolutePath){
		var loc = document.location;
		top.protocal = loc.protocol;
		top.host = loc.host;
		top.hostname = loc.hostname;
		top.port = loc.port;
		top.gAbsolutePath = top.protocal + "//" + top.host + (top.port != '' ? ':' + top.port : '') 
  }
  top.path = top.gAbsolutePath;
  return top.gAbsolutePath + "//";
}
		function getfullurl()
		{
			var loc = document.location;
			var path=loc.pathname.substr(loc.pathname.indexOf('/')+1, loc.pathname.lenght).replace("//","/");
		  	return path;
		}
		function readCookie(name)		
		{		
		  var cookieValue = "";		
		  var search = name + "=";		
		  if(document.cookie.length > 0)		
		  { 		
			offset = document.cookie.indexOf(search);		
			if (offset != -1)		
			{ 		
			  offset += search.length;		
			  end = document.cookie.indexOf(";", offset);		
			  if (end == -1) end = document.cookie.length;		
			  cookieValue = decodeURI(document.cookie.substring(offset, end));		
			}		
		  }		
		  return cookieValue;		
		};
		function readCookieEx(name)
		{
		  var cookieValue = "";
		  var search = name + "=";
		  if(document.cookie.length > 0){ 		
			offset = document.cookie.indexOf(search);		
			if (offset != -1)		
			{ 		
			  offset += search.length;		
			  end = document.cookie.indexOf(";", offset);		
			  if (end == -1) end = document.cookie.length;		
			  cookieValue = decodeURI(document.cookie.substring(offset, end));		
			}		
		  }		
		  return cookieValue;		
		};
		function Deletecookie (name) 
		{  
			var exp = new Date();    
			exp.setTime (exp.getTime() - 1);    
			var cval = readCookie (name);    
			document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();  
		}  
				function ContentSize(size)
		{
			var obj=document.all.Content;
			obj.style.fontSize=size+"px";
		}
//		function Head()
//		{
//	
//			var cook=readCookieEx("jxjyzy");
//			if(cook!=null && cook!="")
//			{
//				var Type="",Account,UserID,Licence,Name,Pwd,Point="",MsgCount="",EmailCount="";
//				var arr=cook.split("&");
//				for(var i=0;i<arr.length;i++)
//				{
//					var xx=arr[i].split("=");
//					if(xx[0]=="Account")
//					{
//						Account=xx[1];
//						continue;
//					}
//					if(xx[0]=="UserID")
//					{
//						UserID=xx[1];
//						continue;
//					}
//					if(xx[0]=="Name")
//					{
//						Name=xx[1];
//						continue;
//					}
//					if(xx[0]=="Pwd")
//					{
//						Pwd=xx[1];
//						continue;			
//					}
//					if(xx[0]=="Licence")
//					{
//						Licence=xx[1];
//						continue;
//					}
//					if(xx[0]=="Point")
//					{
//						Point="你的威望值是"+xx[1];
//						continue;
//					}
//					if(xx[0]=="EmailCount")
//					{
//						EmailCount=xx[1];
//						continue;
//					}
//					if(xx[0]=="MsgCount")
//					{
//						MsgCount=xx[1];
//						continue;
//					}
//					if(xx[0]=="Type")
//					{
//						Type=xx[1];					;
//						continue;
//					}
//				}
//				if(Type=="1")
//				{
//					document.write("<div id='loginin'><div id='help' style='float:right;padding-top:8px;'><font color='red'></font><A href='"+geturl()+"User/Index.aspx'><font color='#ffff00'>[会员中心]</font></A>&nbsp;&nbsp;");
//					document.write("<A href='"+geturl()+"User/UserResEdit.aspx?EditMode=False'><font color='#ffff00'>[上传资源]</font></A>&nbsp;&nbsp;");
//					document.write("&nbsp;&nbsp;<a href='javascript:LoginOut();'><strong><font color='#ffff00'>[退出]</font></strong></a></div>");
//					document.write("<div style='float:left;'><IMG src='"+geturl()+"images/login_dot.png' width='30' align='absMiddle'>欢迎您"+Account +",");
//					document.write(Point+"&nbsp;&nbsp;&nbsp;&nbsp;<img width='18' height='12' src='"+geturl()+"images/clip_image001.gif'>");
//					document.write("<a href='"+geturl()+"User/UserInnerMessageList.aspx?Status=Receive'><font color='#FFFF00'>待阅短信("+MsgCount+")</font></a>&nbsp;&nbsp;");
//					document.write("<a href='"+geturl()+"EMail/EMailLogin.aspx?ReturnUrl=http://mail.jxjyzy.com/webmailgov/mail.jsp'><font color='#FFFF00'>邮箱/"+EmailCount+"/</font></a></div></div>");
//				}
//				else
//				{
//					Deletecookie("jxjyzy");
//					//document.write("<form id='fff' style='margin:0' method='post' action='"+geturl()+"/login/login.aspx?Type=1&ReturnUrl="+getfullurl()+"'>");
//					document.write("		<div id='loginin'><div id='help' style='float:right;padding-top:8px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/Register.aspx?Type=HaveCard&amp;POS=HOME'><font color='#ffff00'>新用户注册</font></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/GetPassword.aspx'><font color='#ccff00'>取回密码</font></A>>&nbsp;&nbsp;<A href='"+geturl()+"Help/Help.aspx?HelperID=14'><font color='#ccff00'>忘记帐号和密码</font></A></div>");
//					document.write("		<div style='float:left;'><IMG  src='"+geturl()+"images/login_dot.png'  align='absMiddle' />&nbsp;&nbsp;用户名:");
//					document.write("		<input type='text' id='labAccount' name='labAccount' style='size:10px;height:14px; width:80px;' maxlength='30'/>&nbsp;&nbsp;密 码:");
//					document.write("		<input type='password' style='size:10px;height:14px; width:80px;'id='labPwd' name='labPwd' maxlength='8'/>");
//				//	document.write("		&nbsp;&nbsp;验证码:<input type='text' style='size:10px; height:14px; width:40px;'id='labCode' maxlength='4' name='labCode'/><input type='image' src='"+geturl()+"Login/ValidateImage.aspx'  align='absmiddle'  border='0' value='验证码' />&nbsp;&nbsp;");
//			        document.write(" <input type='image' src='"+geturl()+"images/index_07_r4_c8.gif' name='Submit' onclick='Login();' align='absmiddle' width='59' height='21' border='0' value='提交' /></div></div>		");
//					//document.write("</form>");	
//
//				}
//			}
//			else
//			{
//			//	document.write("<form id='fff' style='margin:0' method='post' action='"+geturl()+"/login/login.aspx?Type=1&ReturnUrl="+getfullurl()+"'>");
//						document.write("		<div id='loginin'><div id='help' style='float:right;padding-top:8px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/Register.aspx?Type=HaveCard&amp;POS=HOME'><font color='#ffff00'>新用户注册</font></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href='"+geturl()+"login/GetPassword.aspx'><font color='#ccff00'>取回密码</font></A>>&nbsp;&nbsp;<A href='"+geturl()+"Help/Help.aspx?HelperID=14'><font color='#ccff00'>忘记帐号和密码</font></A></div>");
//					document.write("		<div style='float:left;'><IMG  src='"+geturl()+"images/login_dot.png'  align='absMiddle' />&nbsp;&nbsp;用户名:");
//					document.write("		<input type='text' id='labAccount' name='labAccount' maxlength='30' style='size:10px;height:14px; width:80px;' />&nbsp;&nbsp;密 码:");
//					document.write("		<input type='password' style='size:10px;height:14px; width:80px;' maxlength='8' id='labPwd' name='labPwd'/>");
//				//	document.write("		&nbsp;&nbsp;验证码:<input type='text' style='size:10px; height:14px; width:40px;'id='labCode' maxlength='4' name='labCode'/><input type='image' src='"+geturl()+"Login/ValidateImage.aspx'  align='absmiddle'  border='0' value='验证码' />&nbsp;&nbsp;");
//			        document.write(" <input type='image' src='"+geturl()+"images/index_07_r4_c8.gif' name='Submit' onclick='Login();' align='absmiddle' width='59' height='21' border='0' value='提交' /></div></div>		");
//					//	document.write("</form>");
//
//			}
//		}
		//加为收藏
function addFav()
{
window.external.AddFavorite('http://www.jxjyzy.com',' ');
}
function addAnnounceFav()
{
	window.external.AddFavorite(getfullurl(),' ');
}

//设为首页
function addHome()
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.jxjyzy.com');
}
function AdvertisementMiddle()
{
	document.write("<div id='ad_article_cotent' style='margin:0 0 5px 5px; float:right;display:none;'></div>");
}

