
function isblank(s) {
	for (var i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if ((c != " ") && (c != "\n") && (c != "\t")) {
			return false;
		}
	}
	return true;
}
function openNewWindow(url, name, width, height) {
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	var desc = "resizable=no,status=no,toolbar=no,menubar=no,location=no,center=yes,scrollbars=yes,width=" + width + ",height=" + height + ",top=" + topVal + ",left=" + leftVal;
	myWindow = window.open(url, name, desc);
	myWindow.focus();
}
function emailCheck(str) {
	var at = "@";
	var dot = ".";
	var lat = str.indexOf(at);
	var lstr = str.length;
	var ldot = str.indexOf(dot);
 // check if '@' is at the first position or at last position or absent in given email 
	if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
		return false;
	}              
 // check if '.' is at the first position or at last position or absent in given email
	if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.lastIndexOf(dot) == lstr-1) {
		return false;
	}       
   
 // check if '@' is used more than one times in given email
	if (str.indexOf(at, (lat + 1)) != -1) {
		return false;
	}
              
// check for the position of '.' 
	if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
		return false;
	}           

 // check if '.' is present after two characters from location of '@'
	if (str.indexOf(dot, (lat + 2)) == -1) {
		return false;
	}
                   
// check for blank spaces in given email
	if (str.indexOf(" ") != -1) {
		return false;
	}
	return true;
	
}
