		var httpLogin;
		var destURL;
		var destUsername;
		
		function processurl(dest_url){
			destURL = dest_url;
			document.getElementById('div_login').style.top = 0;			// position the login box near the top-left corner
			document.getElementById('div_login').style.display = '';	// show the login box
			scroll(0,0);												// scroll the window to the top-left corner
			document.getElementById('login_username').focus();			// set the focus in the email address box
			return false;
		}

		function cancellogin(){
			document.getElementById('div_login').style.display = 'none';	
			return false;
		}
		
		function createRequestObject(){
			var request_o; //declare the variable to hold the object.
			var browser = navigator.appName; //find the browser name
			if(browser == "Microsoft Internet Explorer"){
				/* Create the object using MSIE's method */
				request_o = new ActiveXObject("Microsoft.XMLHTTP");
			}else{
				/* Create the object using other browser's method */
				request_o = new XMLHttpRequest();
			}
			return request_o; //return the object
		}

		function submitlogin(username, password, Eoption){	
			destUsername = username; /* save this for later */
			var url_param = 'verify_login.cfm?username=' + username + '&password=' + password+ '&Eoption=' + Eoption;
			httpLogin = createRequestObject();
			httpLogin.open('get', url_param);
			httpLogin.onreadystatechange = verifylogin;
			httpLogin.send(null);
			
		}
		
		function verifylogin(){
			if(httpLogin.readyState == 4){ //Finished loading the response
				try
				{

					var response = httpLogin.responseXML;
					var valid_login = response.getElementsByTagName('valid_login');
					if(valid_login.length > 0){
						/* this means I received a response from the server */
						/* var is_valid = unescape(valid_login[0].childNodes[0].firstChild.nodeValue); */
						var is_valid = unescape(valid_login[0].firstChild.nodeValue);
						if(is_valid == 'yes'){
							/* this means I can redirect to the destURL */
							/* I will append the user's email and the Eoption value to the end of the url */
							/* first I check to see if the '?' is already in the URL */
							if (destURL.indexOf ('?',0) == -1){
								destURL = destURL + '?';
							} else {
								destURL = destURL + '&';
							}
							destURL = destURL + 'username=' + destUsername + '&Eoption=' + document.getElementById('Eoption').checked + '&Xref=' + document.getElementById('Xref').value;
							window.location=destURL;
						} else {
							/* this means the login was not valid */
							document.getElementById('login_failed').innerHTML = 'The login was not valid';
							document.getElementById('login_failed').style.display = 'block';
						}
					} else {
						document.getElementById('login_failed').innerHTML = 'Invalid response received';
						document.getElementById('login_failed').style.display = 'block';						
					}
				}
				catch(e)
				{
					document.getElementById('login_failed').innerHTML = e;
					document.getElementById('login_failed').style.display = 'block';
				}
			}
		}

	
