﻿var webserviceurl="http://sso.ak64.com/WebService.asmx/";
var cusername="用户名为空\r";
var cemail="邮箱为空\r";
var cpassword="密码为空\r";
var cpassword2="验证密码为空\r";
var csecode="验证码为空\r";

function CheckUsername(username)
{
    //var username="sssss";
    $.ajax({
        url:webserviceurl+"CheckUserName",
        data:  {username:username},
        dataType: "xml",
        type: "POST",
        cache: false,
        success: function(xml){        
        if($(xml).find("Isok").text()=="true")
        {
            $("#checkusername").html("<img src='style/check_right.gif' height='13' width='13' />");
            cusername="";
        }
        else
        {
        cusername=$(xml).find("Message").text()+"\r";
        $("#checkusername").html("<img src='style/check_error.gif' height='13' width='13' />" + $(xml).find("Message").text());
        }
        },
        error:function(xml,status){
         // alert(status);
        }
     });
}

function CheckPassword(password)
{
    //var username="sssss";
    $.ajax({
        url:webserviceurl+"CheckPassword",
        data:  {password:password},
        dataType: "xml",
        type: "POST",
        cache: false,
        success: function(xml){        
        if($(xml).find("Isok").text()=="true")
        {
        cpassword="";
           $("#checkpassword").html("<img src='style/check_right.gif' height='13' width='13' />");
        }
        else
        {
         cpassword=$(xml).find("Message").text()+"\r";
        $("#checkpassword").html("<img src='style/check_error.gif' height='13' width='13' />" + $(xml).find("Message").text());
        }
        },
        error:function(xml,status){
          //alert(status);
        }
     });
}

function checkPassword2(chkpassword)
{
    if(chkpassword==$("#password").val())
    {
    cpassword2="";
    $("#checkpassword2").html("<img src='style/check_right.gif' height='13' width='13' />");
    }
    else
    {
    cpassword2="密码不一致\r";
    $("#checkpassword2").html("<img src='style/check_error.gif' height='13' width='13' />密码不一致");
    }
}

function CheckEmail(Email)
{
    $.ajax({
        url:webserviceurl+"CheckEmail",
        data:  {Email:Email},
        dataType: "xml",
        type: "POST",
        cache: false,
        success: function(xml){        
        if($(xml).find("Isok").text()=="true")
        {
        cemail="";
           $("#checkemail").html("<img src='style/check_right.gif' height='13' width='13' />");
        }
        else
        {
        cemail=$(xml).find("Message").text()+"\r"
        $("#checkemail").html("<img src='style/check_error.gif' height='13' width='13' />" + $(xml).find("Message").text());
        }
        },
        error:function(xml,status){
          //alert(status);
        }
     });
}

function checkSeccode(Seccode)
{
    $.ajax({
        url:webserviceurl+"CheckSeccode",
        data:  {Seccode:Seccode},
        dataType: "xml",
        type: "POST",
        cache: false,
        success: function(xml){        
        if($(xml).find("Isok").text()=="true")
        {
        csecode="";
           $("#checkseccode").html("<img src='style/check_right.gif' height='13' width='13' />");
        }
        else
        {
         csecode=$(xml).find("Message").text()+"\r";
        $("#checkseccode").html("<img src='style/check_error.gif' height='13' width='13' />" + $(xml).find("Message").text());
        }
        },
        error:function(xml,status){
         // alert(status);
        }
     });
}

function checkClause()
{
    var xmsg= cusername + cemail + cpassword + cpassword2 + csecode;
    if(xmsg=="")
    {
        if(document.getElementById("accede").checked){
        return true;
    }
    else{   
        alert("只有同意“伊林注册协议”，才能注册成为伊林会员！");
        return false;
    }
    }
    else
    {
        alert(xmsg);
        return false;
    }
}

function getUserIndexajax(webid)
{       
    //$.ajax({type:"GET",
    //url:'http://sso.ak64.com/verifyInfo.aspx?webid=' + webid,
    //cache:false,
    //dataType:"html",
    //success:function(uinfostr){
    //    GetWebService(uinfostr);
    //}
    //});

 $.getJSON("http://sso.ak64.com/verifyInfo.aspx?webistid=" + webid + "&jsoncallback=?",
       function(json){ 
       if(json.status==1){ alert(json.info); }
       else(alert(json.info));
        });

}
    
function GetWebService(uinfostr){
      $.ajax({
	url:webserviceurl+"CheckUserInfo",
        data: {userInfoString:uinfostr},
        dataType: "xml",
        type: "POST",
        cache: false,
        success: function(xml){        
        alert($(xml).find("userName").text());        
        },
        error:function(xml,status){      
        }
      });
}

function fnChangeImage(){
	var o = document.getElementById('img_seccode');
	o.src = "ValidateCode.aspx?rnd="+Math.random();
}