﻿// JScript File


 function validation()
{


var msg="";


if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtName").value=="")
{
msg="\n - Please enter Name ";
}

if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtCity").value=="")
{

msg += "\n - Please enter City ";

}
if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtState").value=="")
{

msg += "\n - Please enter State ";

}
if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtCountry").value=="")
{

msg += "\n - Please enter Country ";

}


if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtEmail").value=="")
{

////emailID.value=""
////emailID.focus()
msg += "\n - Please enter Email address ";

}

if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtEmail").value!="")
{
 if(echeck(document.getElementById('dnn_ctr479_ViewContactus_resume_txtEmail').value)==false){
////emailID.value=""
////emailID.focus()
msg += "\n - Incorrect Emailid ";
}

}



if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtTel").value=="" && document.getElementById("dnn_ctr479_ViewContactus_resume_txtMobile").value=="")
{
msg += "\n - Enter any one Phone No. Or Mobile No. ";
   
//{

}

if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtTel").value!="")

    {
    var NumberToTest = document.getElementById("dnn_ctr479_ViewContactus_resume_txtTel").value;

    var IsFound = /^[-#+'' '0-9]+$/.test(NumberToTest);
     //alert(IsFound);
if(IsFound==false)
{
//// alert("Enter Valid Phone No.");
msg += "\n - Invalid Phone No";
}
    
    }
     if(document.getElementById("dnn_ctr479_ViewContactus_resume_txtMobile").value!="")
    {
    var MobileToTest = document.getElementById("dnn_ctr479_ViewContactus_resume_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_ctr479_ViewContactus_resume_FileUpload1").value=="")
{
msg += "\n - Upload your Resume ";

}

var fileName=document.getElementById("dnn_ctr479_ViewContactus_resume_FileUpload1").value;
// if(fileName=="")
// {
// alert("1");
// msg=msg+"Upload your Resume\n";
// }
// else{
var dot=fileName.lastIndexOf(".");
var imgType=fileName.substr(dot);
if(fileName!="" && imgType!=".doc" )
{
//alert("2");
msg=msg+"\n - File should be .doc \n";

}



//if(document.getElementById("dnn_ctr623_ViewCallback_request_PhoneNumber").value=="")
//{
//msg += "\n - Please enter Phone Number ";

//}
//if(document.getElementById("dnn_ctr623_ViewCallback_request_PhoneNumber").value!="")
//{
//var NumberToTest = document.getElementById("dnn_ctr623_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_ctr623_ViewCallback_request_selectDepartment").value)

//if(document.getElementById("dnn_ctr623_ViewCallback_request_selectDepartment").value=="0")
//{
//msg += "\n - Please select the department ";

//}
//if(document.getElementById("dnn_ctr623_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
}

