		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 {
							if(is_valid == 'not'){
						
							/* this means the login is good but not a paid subscriber */
							document.getElementById('login_failed').innerHTML = 'Your login is correct but we do not show you as a paid subscriber<br><A HREF="mailto:webmaster@FootballDiehards.com?subject=Check My Subscription&body=The system said I am not a paid subscriber but I think I am. Please check.">Email us</a> for varification or <a href="https://secure.fspnet.com/footballdiehards/" target="_blank">order now</a>';
							document.getElementById('login_failed').style.display = 'block';
							
							} else {
							
								if(is_valid == 'badpassword'){
							
									/* this means the login had a bad password */
									document.getElementById('login_failed').innerHTML = 'Password Incorrect <a href="http://www.footballdiehards.com/emailPassword.cfm" target="_blank"><font color="White">Get your password emailed</font></a>';
									document.getElementById('login_failed').style.display = 'block';
									
								} else {
						
										/* this means the login was not valid */
										document.getElementById('login_failed').innerHTML = 'Your Email address is incorrect';
										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';
				}
			}
		}

	
