﻿// JScript File

function Validate()
{
    var result = true;
    var StrMsg          = "<strong style=\"color:red;\">" + "!Oops Fields Missing" + "</strong><br /><br />";
    var txtEmailid      = GetElement("ctl00_cphmain_txtEmail");
    var txtFirstName    = GetElement("ctl00_cphmain_txtFirstName");
    var txtSubject      = GetElement("ctl00_cphmain_txtSubject");
    var txtVerfCode     = GetElement("ctl00_cphmain_txtVerification");
    if(trimAll(txtEmailid.value).length == 0)
    {
        StrMsg += " Email Address is Empty.<br />";
        if(result == true)
        {
            txtEmailid.focus();
        }
        result = false;    
    }
    else
    {
        if(!validateEmail(trimAll(txtEmailid.value)))
        {
            StrMsg += " Enter Valid Email Address.<br />";
            if(result == true)
            {
                txtEmailid.focus();
            }
            result = false;            
        }
    }
    if(trimAll(txtFirstName.value).length == 0)
    {
        StrMsg += " First Name is Empty.<br />";
        if(result == true)
        {
            txtFirstName.focus();
        }
        result = false;    
    }
    if(trimAll(txtSubject.value).length == 0)
    {
        StrMsg += " Subject is Empty.<br />";
        if(result == true)
        {
            txtSubject.focus();
        }
        result = false;    
    }
    if(trimAll(txtVerfCode.value).length == 0)
    {
        StrMsg += " Verification Code is Empty.<br />";
        if(result == true)
        {
            txtVerfCode.focus();
        }
        result = false;    
    }
    if(!result)
    {
        document.getElementById("ctl00_lblErrMsg").innerHTML = StrMsg;
        document.getElementById("ctl00_btnHidden").click();
    }
    return result;
}