var base_path = "../../a";

function getQueryVariable(variable){
	   var login_name = '';
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){
				   login_name = pair[1];
				   this.login(login_name);
				}
       }
}

function login(login_name) {
	login_name =login_name .replace(/\s*/g,"");
	var login_pass = '';
	if(login_name == 'ksrc') {
		login_pass = 'ksrc@hmsoft';
	} else {
		alert('用户名不存在！');
		return false;
	}
  $.ajax({
    type : 'POST',
    url : base_path + '/frame/optr/login.htm',
    data : {
      loginName : login_name,
      loginPass : md5(login_pass),
      loginCode : '1234'
    },
    dataType : 'json',
    success : function(data) {
      if (data.success == false) {
        // 刷新验证码
        showErrorMsg(data.errorMsg);
        $(":button").removeAttr("disabled");
        return;
      } else {
        window.location = '../../frame.html';
      }
      $(":button").removeAttr("disabled");
    },
    error : function() {
      $(":button").removeAttr("disabled");
    }
  });
	return false;
}
