function checkemail() {
	var str=document.frm1.txt_email.value;
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	
	if ((str==null)||(str=="")){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Required field cannot be left blank.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}
	
	if (str.indexOf(at)==-1){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.indexOf(at,(lat+1))!=-1){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.indexOf(dot,(lat+2))==-1){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	if (str.indexOf(" ")!=-1){
		document.getElementById('err1').innerHTML = "<img src='images/error.gif' width='16' height='16' align='absmiddle' /> Invalid email address format.";
		document.getElementById('err1').style.visibility = 'visible';
		return false;
	}

	document.getElementById('err1').style.visibility = 'hidden';
	return true;
}

function start(){
	document.getElementById('checking_process').style.visibility = 'visible';
	var c1 = checkemail();
	
	if (c1){
		return true;
	}else{
		document.getElementById('checking_process').style.visibility = 'hidden';
		return false;
	}
}

function stop(success){
	var result = '';
	if (success == 0){
		window.location="../forgot_password_done.php";
	} else if (success == 1){
		window.location="../forgot_password_done.php";
	}

	document.getElementById('checking_process').style.visibility = 'hidden';
	return true;    
}
