function validationemail() {
	var emailID=document.MainForm.AlertsLoginEmailTextBox
	if ((emailID.value==null)||(emailID.value=="")){
		alert("  Please enter email address ");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.focus();
		return false;
	}
	return true;
}

function validationres() {
	var emailID=document.MainForm.AlertsRegisterEmailTextBox
	if (document.MainForm.AlertsContactFullNameTextBox.value=="") {
		alert ("  Please enter full name ");
		document.MainForm.AlertsContactFullNameTextBox.focus();
		return false;
	}
	if ((emailID.value==null)||(emailID.value=="")) {
		alert("   Please enter email address ");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false) {
		emailID.focus();
		return false
	}
	if (document.MainForm.AlertsLanguagesListBox.value=="") {
		alert ("    Please enter language ");
		document.MainForm.AlertsLanguagesListBox.focus();
		return false;
	}
	return true;
}

// dont remove, being used in the functions //
var bugchars = '!#$^&*()+|}{[]?><~%:;/,=`"\'';
function CharsInBag(s) {   
var i;
var lchar="";
    // Search through string's characters one by one.
    // If character is not in bag.
    for (i = 0; i < s.length; i++) {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
		if(i>0)lchar=s.charAt(i-1)
        if (bugchars.indexOf(c) != -1 || (lchar=="." && c==".")) return false;
    }
    return true;
}

function isInteger(s) {
	var i;
    for (i = 0; i < s.length; i++) {
        // Check that current character is not a number.
        var c = s.charAt(i);
        if ((c >= "0") && (c <= "9") && (c != ".")) return false;
    }
    // All characters are numbers.
    return true;
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	var lastdot=str.lastIndexOf(dot)
	if (str.indexOf(at)==-1){
	   alert(" Email address should be in the form of xyz@domainname ")
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert(" Email address should be in the form of xyz@domainname ");
	   return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr || str.substring(lastdot+1)==""){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	if (str.indexOf(" ")!=-1){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	if(CharsInBag(str)==false){
		alert(" Email address should be in the form of xyz@domainname ");
		return false;
	}
	var arrEmail=str.split("@")
	var ldot=arrEmail[1].indexOf(".")
	if(isInteger(arrEmail[1].substring(ldot+1))==false){
		alert("  Email address should be in the form of xyz@domainname ");
		return false;
	}
	return true;
}