﻿// JavaScript Document

$(document).ready(function()
{
	//Forgot_Password
	$("#BTN_SENDMAIL").click(function()
	{
		var U_Email = document.getElementById("TF_MAIL_REGISTERED").value;
	
		if(U_Email=="")
		{
			document.getElementById("AreaMsg").innerHTML = "Your registered E-mail address is required.";
			return;
		}
		else if(U_Email.indexOf("@")<0)
		{
			document.getElementById("AreaMsg").innerHTML = "Incorrect E-mail Address.";
			return;
		}
		
		var httpObj = getHttpObject();
	
		httpObj.onreadystatechange = function(){
			if(httpObj.readyState == 4){
				if(httpObj.status == 200){
					var conttext = httpObj.responseText;
					if(conttext.indexOf("FAILED")<0)
					{
						document.getElementById("AreaMsg").innerHTML = "Your password is sent to your mailbox.";
						window.close();
					}
					else
					{
						document.getElementById("AreaMsg").innerHTML = "E-mail account not found.";
					}
				}
			}
		}		
		httpObj.open("GET", domainname+"sendmypassword.php?Email="+U_Email);
		httpObj.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT");
		httpObj.send(null);
	
	
	});

});

