﻿var isNull = false;

function UserLogin(url)
{
    if(IsEmpty("txtUserName","请输入用户名！"))
    {}
    else if(IsEmpty("txtUserPass","请输入密码！"))
    {}
    else if(IsNotDesignationLength("commentcontent",1,512,"评论内容必须在1~512个字符之间！"))
    {}
    else if(IsEmpty("txtValidate","请输入验证码！"))
    {}
    else
    {
        
        var array = "";
        array+=document.getElementById("txtUserName").value + ",";
        array+=document.getElementById("txtUserPass").value + ",";
        array+=opid  + ",";
        array+=encodeURI(document.getElementById("commentcontent").value);
        
        executereload(url+"?pa="+array);
        
    }
}

function ProfileLogin(url)
{
    if(IsEmpty("txtUserName","请输入用户名！"))
    {}
    else if(IsEmpty("txtUserPass","请输入密码！"))
    {}
    else if(IsEmpty("txtValidate","请输入验证码！"))
    {}
    else
    {
        
        var array = "?usr=";
        array+=encodeURI(document.getElementById("txtUserName").value) + "&pwd=";
        array+=encodeURI(document.getElementById("txtUserPass").value) + "&vdc=";
        array+=encodeURI(document.getElementById("txtValidate").value) + "&ReturnURL=";
        array+=location.href;
        
        location.href=url+array;
        
    }
}

function GuestLogin(url)
{
    if(IsEmpty("txtUserName","请输入用户名！"))
    {isNull=false;}
    else if(IsEmpty("txtUserPass","请输入密码！"))
    {isNull=false;}
    else if(IsNotDesignationLength("commentcontent",1,512,"评论内容必须在1~512个字符之间！"))
    {isNull=false;}
    else if(IsEmpty("txtValidate","请输入验证码！"))
    {isNull=false;}
    else
    {
        isNull=true;
        
        var array = "";
        array+=encodeURI(document.getElementById("txtUserName").value) + ",";
        array+=encodeURI(document.getElementById("txtUserPass").value);
        
        execute(url+"?pa="+array);
    }
}

function LoginAppearComment(url)
{
    if(isNull)
    {
        var array = "";
        array+=opid + ",";
        array+=encodeURI(document.getElementById("commentcontent").value);

        executereload(url+"?pa="+array);
        
    }
    
}

function AppearComment(url)
{
    if(IsNotDesignationLength("commentcontent",1,512,"评论内容必须在1~512个字符之间！"))
    {}
    else if(IsEmpty("txtValidate","请输入验证码！"))
    {}
    else
    {
        var array = "";
        array+=opid + ",";
        array+=encodeURI(document.getElementById("commentcontent").value)+ ",";
        array+=encodeURI(document.getElementById("txtValidate").value);

        executereload(url+"?pa="+array);
    }
}

function refreshimg(control)
{ 
    document.getElementById(control).src="http://smt.114chn.com/web/GetValidatePic.aspx?rnd='"+Math.random()+"'";
}