function IsNull()
{
    this.errormessage;
    this.controltovalid;
    this.controlid;
    this.color="red";
    this.className="";
    this.isalert=true;
    this.isvalid=function()
    {
        var objinput=document.getElementById(this.controltovalid);
        var objspan=document.getElementById(this.controlid);
        if(objinput!=null&&objspan!=null)
        {
            if(objinput.value.Trim()=="")
            {
                objspan.style.display="";
                objspan.innerHTML=this.errormessage;
                if(this.color!="")
                {
                    objspan.style.color=this.color;
                }
                if(this.className!="")
                {
                    objspan.className=this.className;
                }
                if(this.isalert)
                {
                    alert(this.errormessage);
                }
                objinput.focus();
                return false;
            }
            else
            {
                objspan.style.display="none";
            }
        }
        return true;
    }
}

function Compare()
{
    this.errormessage;
    this.controltovalid;
    this.controlvalid;
    this.comparedid;
    this.color="red";
    this.className="";
    this.isalert=true;
    this.isvalid=function()
    {
        var obj1=document.getElementById(this.controltovalid);
        var obj2=document.getElementById(this.compareid);
        var objspan=document.getElementById(this.controlid);
        if(obj1!=null&&obj2!=null&&objspan!=null)
        {
            if(obj1.value.Trim()!=obj2.value.Trim())
            {
                objspan.style.display="";
                objspan.innerHTML=this.errormessage;
                if(this.color!="")
                {
                    objspan.style.color=this.color;
                }
                if(this.className!="")
                {
                    objspan.className=this.className;
                }
                if(this.isalert)
                {
                    alert(this.errormessage);
                }
                objinput.focus();
                return false;
            }
            else
            {
                objspan.style.display="none";
            }
        }
        return true;
    }
}

function ExpressionValid()
{
    this.errormessage;
    this.controltovalid;
    this.controlid;
    this.color="red";
    this.className="";
    this.isalert=true;
    this.expresstion;
    this.isvalid=function()
    {
        var objinput=document.getElementById(this.controltovalid);
        var objspan=document.getElementById(this.controlid);
        if(objinput!=null&&objspan!=null)
        {
            var inputtext=objinput.value.Trim();
            if(inputtext!="")
            {
                var patrn=this.expresstion;
                if(!patrn.exec(inputtext))
                {
                    objspan.style.display="";
                    objspan.innerHTML=this.errormessage;
                    if(this.color!="")
                    {
                        objspan.style.color=this.color;
                    }
                    if(this.className!="")
                    {
                        objspan.className=this.className;
                    }
                    if(this.isalert)
                    {
                        alert(this.errormessage);
                    }
                    objinput.focus();
                    return false;
                }
                else
                {
                    objspan.style.display="none";
                }
            }
        }
        return true;
    }
}

String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

