﻿// JScript File

String.prototype.trim = function() 
{
	return this.replace(/^\s+|\s+$/g,"");
}

function Validations()
{
    //Phone no
     if(document.getElementById('txtpno').value.trim()!="")
    {
        var varPrimary=/^[0-9-+()]{6,18}$/;
        if(document.getElementById('txtpno').value.trim().match(varPrimary)==null)
        {
            alert("Phone Number accepts only numerics,-,() and + (Ex +91-040-25454445,+919984545767).");
            document.getElementById('txtpno').focus();
            return false;
        }
        
        if(document.getElementById('txtpno').value.trim()=='0')
        {
            alert("Please enter valid Phone Number.");
            document.getElementById('txtpno').focus();
            return false;
        }
     }
     
   
    if(document.getElementById('txtEmail').value.trim()!="")
    {
        var emailExp = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
        if(document.getElementById('txtEmail').value.trim().match(emailExp)==null)
        {
            alert("Please enter valid Email.");
            document.getElementById('txtEmail').focus();		
            return false;
        }
    }

}
