﻿// JScript File
function saleProperty()
{
//Validation for blank textbox
    if(document.getElementById("TxtName").value=="")
    {
       alert("Please enter your name");
        document.getElementById("TxtName").focus();
        return false;
    }
    //Check for EmailId validation
    var str=document.getElementById("TxtMail").value;
    var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if(str=="")
	{
	    alert("Please enter Your EmailId");
	    document.getElementById("TxtMail").focus();
	   return false;
	}
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail ID");
	   document.getElementById("TxtMail").focus();
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID");
	   document.getElementById("TxtMail").focus();
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail ID");
	    document.getElementById("TxtMail").focus();
	    return false;
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail ID");
	    document.getElementById("TxtMail").focus();
	    return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail ID");
	    document.getElementById("TxtMail").focus();
	    return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail ID");
	    document.getElementById("TxtMail").focus();
	    return false;
	 }
		
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail ID");
	    document.getElementById("TxtMail").focus();
	    return false;
	 }
    y=document.getElementById("TxtMobile").value;
    if(y=="")
    {
        alert("Please enter your Mobile No.");
        document.getElementById("TxtMobile").focus();
        return false;
    }
    y=document.getElementById("TxtMobile").value;
    if(isNaN(y)||y.indexOf(" ")!=-1)
        {
            alert("Enter numeric value");
            document.getElementById("TxtMobile").focus();
            return false;  
         }
    if (y.length>10 || y.length<10)
       {
            alert("enter 10 characters");
            document.getElementById("TxtMobile").focus();
            return false;
        }
    if (y.charAt(0)!="9")
       {
            alert("it should start with 9 ");
             document.getElementById("TxtMobile").focus();
             return false;
         }
         
    if(document.getElementById("TxtContAddress").value=="")
    {
        alert("Please enter your Contact Address");
        document.getElementById("TxtContAddress").focus();
        return false;
    }
    
    
}

 



