// JavaScript Document
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					
	}
function jcap(){
var email=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
var myemail=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;


if(!myemail.test(document.frmcontact.myemail.value))
		{
			alert("Please enter your correct Email address.");
			document.frmcontact.myemail.focus();
			return false;
		}

var uwordn = document.getElementById(jfldidn).value;

if (uwordn==cwordn[anumn-1]) {
return true;
}

else {
alert("ERROR: Enter the code as it is shown.");
document.getElementById(jfldidn).focus();
return false;
}
}

function jcontact(){

if(document.frmqcontact.name.value==""){
alert('Please insert your name');
document.frmqcontact.name.value="";
document.frmqcontact.name.focus();
return false;
}

if(document.frmqcontact.email.value==""){
alert('Please insert your email address');
document.frmqcontact.email.value="";
document.frmqcontact.email.focus();
return false;
}
if (echeck(document.frmqcontact.email.value)==false){
document.frmqcontact.email.value="";
document.frmqcontact.email.focus();
return false;
}
if(document.frmqcontact.msg.value==""){
alert('Please insert your message');
document.frmqcontact.msg.value="";
document.frmqcontact.msg.focus();
return false;
}

var test = document.getElementById('uword').value;

if (test==cwordc[anumc-1]) {
	
return true;
}

else {
alert("ERROR: Enter the code as it is shown.");
document.getElementById('uword').focus();
return false;
}
}

function jquestion(){

if(document.frmquestion.email.value==""){
alert('Please insert your email address');
document.frmquestion.email.value="";
document.frmquestion.email.focus();
return false;
}
if (echeck(document.frmquestion.email.value)==false){
document.frmquestion.email.value="";
document.frmquestion.email.focus();
return false;
}
if(document.frmquestion.question.value==""){
alert('Please ask your question');
document.frmquestion.question.value="";
document.frmquestion.question.focus();
return false;
}
}