

<!-- //





////////////////////////////////////////////////////////////////////////////////////////////////
// name: get_username_password
// purpose: Just a place holder function so we can get the value of the email entered into
//          the text box on the HTML page
////////////////////////////////////////////////////////////////////////////////////////////////
function get_username_password()
{
	requestUsernamePassword(document.getElementById('lost_password_text_box').value);
}

////////////////////////////////////////////////////////////////////////////////////////////////
// name: requestUsernamePassword
// purpose: Calls the PHP script that checks for an existing email address, if the PHP script
//          finds a valid email address then the PHP script will send out the username/password
//          to the given email address on file.  The callback funciton below will parse any
//          response, success or error from the PHP script's XML output
////////////////////////////////////////////////////////////////////////////////////////////////
function requestUsernamePassword(email) 
{
	//var req;
	
	var url = 'scripts/requestUsernamePassword.php?email=' + email;
	
	//alert(url);
	
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processUsernamePassword;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
		
		req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processUsernamePassword;
            req.open("GET", url, true);
            req.send();
        }
    }

}


////////////////////////////////////////////////////////////////////////////////////////////////
// name: processUsernamePassword
// purpose: this is the callback function, it takes the results from the XML output of the PHP 
//          script and parses the elements in order to write the success or error message
//          directly to the original HTML page
////////////////////////////////////////////////////////////////////////////////////////////////
function processUsernamePassword() 
{
	//alert('got here');

    // only if req shows "complete"
    if (req.readyState == 4) {
      // only if "OK" 
	  //alert('got here');
	  
      if (req.status == 200) {
			
	  //alert('got here NOW');
      response  = req.responseXML.documentElement;

      error_code    = response.getElementsByTagName('error_code')[0].firstChild.data;
      message    = response.getElementsByTagName('message')[0].firstChild.data;
	  
	  //alert('message: ' + message);
	  
	  var mdiv = document.getElementById("lost_password_message");
	  mdiv.innerHTML = message;

        } else {
            //alert("There was a problem retrieving the XML data:\n" + message);
        }
    }
}


// -->

