/*
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Copyright amaDigital CMS mofied fo Phatisa DAta Room.
'
' File Name:
' ==========
'		sendPassword.js
'
' Description:
' ============
'       Javascript function that calls asp page suncd with Ajaz, then sends Password to invitee in background
'
' Revision History:
' =================
'		2011-04-07 SJB: Created file 
'		2011-04-14 SJB: Added checkPasswords() function to check that passwords match when password was reset and needs to be reassigned
'
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
*/


function sendPassword(){	    
		if(document.getElementById('un').value == ''){
		    alert("Please supply your email address in the username field");			
			document.getElementById('un').focus();
			return false;
		}else{
			if (window.ActiveXObject) {
				var xmlhttp = new ActiveXObject("microsoft.xmlhttp")
			} else if (window.XMLHttpRequest) {
				var xmlhttp = new XMLHttpRequest()
			}					
			xmlhttp.open('POST','/includes/sendPassword.asp',false);
			xmlhttp.setRequestHeader('If-Modified-Since','Tue, 12 Jan 2010 18:23:51 GMT');
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlhttp.send('un=' + document.getElementById('un').value + '&login_page=' + document.getElementById('login_page').value)			
			while(xmlhttp.readyState != 4){i = 0;}	
			alert(xmlhttp.responseText);			
		}  			
}//sendPassword()

function checkPasswords(password1,password2){
	
		if(password1==''){
			alert('Please enter a password in the password field!')
			document.getElementById('pw').focus()
		}else if(password1!=password2){
			alert('The password fields do not match, please confirm your password in the "Retype Password" field!')
			document.getElementById('pw1').focus()
		}	
		
}//checkPasswords(
