﻿

// JScript File

// JScript File





 function validation()
{


var msg="";


if(document.getElementById("dnn_ctr473_ViewCallback_request_FullName").value=="")
{
msg="\n - Please enter Full Name ";
}
if(document.getElementById("dnn_ctr473_ViewCallback_request_EmailAddress").value=="")
{

////emailID.value=""
////emailID.focus()
msg += "\n - Please enter email address ";

}

if(document.getElementById("dnn_ctr473_ViewCallback_request_EmailAddress").value!="")
{
 if(echeck(document.getElementById('dnn_ctr473_ViewCallback_request_EmailAddress').value)==false){
////emailID.value=""
////emailID.focus()
msg += "\n - Incorrect Emailid ";
}

}
if(document.getElementById("dnn_ctr473_ViewCallback_request_PhoneNumber").value=="" && document.getElementById("dnn_ctr473_ViewCallback_request_txtmobile").value=="")
{
msg += "\n - Enter any one Phone No. Or Mobile No. ";
   
//{

}
//if(document.getElementById("dnn_ctr473_ViewCallback_request_PhoneNumber").value!="")
//{
//var NumberToTest = document.getElementById("dnn_ctr473_ViewCallback_request_PhoneNumber").value;
//var IsFound = /^-?\d+$/.test(NumberToTest);
//if(IsFound==false)
//{
////// alert("Enter Valid Phone No.");
//msg += "\n - Invalid Phone No";

//}
//}

//alert(document.getElementById("dnn_ctr473_ViewCallback_request_selectDepartment").value)
if(document.getElementById("dnn_ctr473_ViewCallback_request_PhoneNumber").value!="")

    {
    var NumberToTest = document.getElementById("dnn_ctr473_ViewCallback_request_PhoneNumber").value;

    var IsFound = /^-?\d+$/.test(NumberToTest);
     //alert(IsFound);
if(IsFound==false)
{
//// alert("Enter Valid Phone No.");
msg += "\n - Invalid Phone No";
}
    
    }
     if(document.getElementById("dnn_ctr473_ViewCallback_request_txtmobile").value!="")
    {
    var MobileToTest = document.getElementById("dnn_ctr473_ViewCallback_request_txtmobile").value;

    var mobileIsFound = /^[-#+'' '0-9]+$/.test(MobileToTest);

    
    if(mobileIsFound==false)
    {
        //// alert("Enter Valid Phone No.");
        msg += "\n - Invalid Mobile No";

        }
    
    }  
    
    
    if(document.getElementById("dnn_ctr473_ViewCallback_request_Extension").value!="")
{
var NumberToTest = document.getElementById("dnn_ctr473_ViewCallback_request_Extension").value;
var IsFound = /^-?\d+$/.test(NumberToTest);
if(IsFound==false)
{
//// alert("Enter Valid Mobile No.");
msg += "\n - Invalid Extenstion No";

}
}
    
    
      

if(document.getElementById("dnn_ctr473_ViewCallback_request_selectDepartment").value=="0")
{
msg += "\n - Please select the department ";

}
if(document.getElementById("dnn_ctr473_ViewCallback_request_Subject").value=="")
{
msg +="\n - Please enter Subject ";
}




if(msg!="")
{
alert(msg);
return false;
}


else
{ return true;
}
}


function echeck(str)

 {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
//alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
// alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
// alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
//alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
// alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
// alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
// alert("Invalid E-mail ID")
return false
}

return true
}



