﻿Request = { QueryString : function(item){  var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));  var Qvalue = svalue ? svalue[1] : svalue;  if(Qvalue==null)   {	  return "";  }  else  {  return Qvalue.trim();  } } }
String.prototype.len = function(){ var str=this; return str.replace(/[^\x00-\xff]/g, "**").length;}
String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, "");}
function $(nodeid) { return document.getElementById(nodeid); }

function lgxhtml(loc)
{
	var result=ajax.login.lgxislogin(loc,showlgxhtml);
}

function changecheckcode()
{
	var d=new Date();
	var t=d.getFullYear().toString()+d.getMonth().toString()+d.getDate().toString()+d.getHours().toString()+d.getMinutes().toString()+d.getSeconds().toString()+d.getMilliseconds().toString();
	$("lgxcheckimg").src="/images/checkimg.aspx?t="+t;
}

function showlgxhtml(response)
{
	if($("lgx")) $("lgx").innerHTML=response.value;
}

function lgxlogin()
{
	var lgxusername=$("lgxusername").value.trim();
	var lgxuserpwd=$("lgxuserpwd").value.trim();
	var lgxcheckcode=$("lgxcheckcode").value.trim();
	if(lgxusername=="") { alert("用户名不能为空！");changecheckcode();return; }
	if(lgxuserpwd=="") { alert("密码不能为空！"); changecheckcode();return; }
	if(lgxcheckcode=="") { alert("验证码不能为空！"); changecheckcode();return; }
	var result=ajax.login.lgxlogin(lgxusername,lgxuserpwd,lgxcheckcode).value;
	if(result==null)
	{
		alert("网络繁忙！");changecheckcode();return;
	}
	if(result=="CheckcodeError")
	{
		alert("验证码错误！");changecheckcode();return;
	}
	if(result=="UsernameError")
	{
		alert("用户名错误！"); changecheckcode();return;
	}
	if(result=="Lock")
	{
		alert("您的用户名己被锁定，请与我们的管理员取得联系！");changecheckcode(); return;
	}
	if(result=="PasswordError")
	{
		alert("密码错误！");changecheckcode();return;
	}
	if(result=="Member" || result=="Agent")
	{
		top.location.href="/member/shop_bag.aspx";
	}
	if(result=="Editor" || result=="Admin" || result=="Programmer")
	{
		top.location.href="/admin/index.aspx";
	}
}

function exit(rooturl)
{
    var result=ajax.login.lgxexit().value;
    if(result=="1")
    {
        top.location.href=rooturl+"index.html";
    }
    else
    {
        alert("网络不稳定的异常错误！");
    }
}
