﻿// JScript File
    function ValidateFields()
    {
   
        var str="";
        if (document.getElementById('ctl00_cphContent_txtFirstName').value.replace(/^\s+|\s+$/,'')=="")
        {
            str += " First name,";
        }
        if (document.getElementById('ctl00_cphContent_txtLastName').value.replace(/^\s+|\s+$/,'')=="")
        {
            str += " Last name,";
        }
        if (document.getElementById('ctl00_cphContent_txtEmail').value.replace(/^\s+|\s+$/,'')=="")
        {
            str += " Email,";
        }     
        else if(ChkValidEmail(Trim(document.getElementById('ctl00_cphContent_txtEmail').value)) == false)
        {
            str += " Email Format,";
        } 
//        if (document.getElementById('ctl00_cphContent_txtUserName').value.replace(/^\s+|\s+$/,'')=="" )
//        {
//            str += " Username,";
//        }         
        if (document.getElementById('ctl00_cphContent_txtPassword').value.replace(/^\s+|\s+$/,'') == "")
        {
           str += " Password,"
        }
        else if (document.getElementById('ctl00_cphContent_txtPasswordAgain').value.replace(/^\s+|\s+$/,'') == "")
        {
           str += " Password again,"
        }
        else if(document.getElementById('ctl00_cphContent_txtPassword').value.replace(/^\s+|\s+$/,'').length < 6)
        {
           str += " Password should be Minimum of 6 Digits,"
        }       
        else if(document.getElementById('ctl00_cphContent_txtPassword').value.replace(/^\s+|\s+$/,'').toLowerCase() != document.getElementById('ctl00_cphContent_txtPasswordAgain').value.replace(/^\s+|\s+$/,'').toLowerCase())
        {
           str += " Password and Password again Should be same,"
        }    
        

                       
        if (str!= "")
        {
            str = str.substring(0,str.length-1)
           
            document.getElementById('ctl00_cphContent_lblErrorMessage').innerHTML = "The following field(s) have invalid value(s):" + str+ "." ;
            location.href = "#ctl00_cphContent_lblErrorMessage";                      
            return false;
        }
    }     


