function verifyemail(email) {
	if (email=='' || email.indexOf('@')==-1 || email.indexOf('.')==-1){
		return false;
	}
	email = email.toLowerCase();
	NotAllowed = Array('..','.@','@.','@@',' ',';' , ',');
	Allowed = Array('_','-','0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','.','@');
	for (Ji=0;Ji< NotAllowed.length;Ji++){
		if (email.indexOf(NotAllowed[Ji])!=-1){	// Finds a character which is not allowed
			return false;
			break;
		}
	}	// --- Check . or @ is present either at the start or at the end
	if (email.substr(0,1)=='.' || email.substr(0,1)=='@' || email.lastIndexOf('.')==(email.length-1) || email.lastIndexOf('@')==(email.length-1)){
		return false;	
	}
	TT = email.substring(email.indexOf('@')+1);
	if (TT.indexOf('.')==-1){ // Check . is not present after @
		return false;
	}
	if (TT.indexOf('@')!=-1){	// there are more than 1 @s in the email
		return false;
	}
	//-------------- Verify Allowed Characters --------------
	var found=false;
	for (Ji=0;Ji< email.length;Ji++){
		found = false;
		for (Ki=0;Ki< Allowed.length;Ki++){
			if (email.substr(Ji,1)==Allowed[Ki]){
				found=true;
				break;
			}
		}
		if (found==false){
			return false;
		}
	}
	//--------- If All tests above are OK then return true
	return true;
}
function validate(){
	if (document.frm.Name.value==''){
		alert('Please write your name');
		document.frm.Name.focus();
		return false;
	} else if (document.frm.Email.value==''){
		alert('Please write your email address');
		document.frm.Email.focus();
		return false;	
	} else if (verifyemail(document.frm.Email.value)==false){
		alert('Your email address does not appears to be valid. Please write correct email address');
		document.frm.Email.focus();
		return false;
	} else {
		return true;
	}
}
