function cryptPass(){
		var hash;
		var pwd = document.loginForm.loginPassword.value;
		if(pwd.length != 40){
			hash = hex_sha1(pwd);
			document.loginForm.loginPassword.focus();
			document.loginForm.loginPassword.select();
			document.loginForm.loginPassword.value = hash;
		}
		return true;
	}
	//Creates Generic AJAX request object
	function ajaxRequest(){
		var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE
		if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
			for (var i=0; i<activexmodes.length; i++){
				try{
					return new ActiveXObject(activexmodes[i]);
				}catch(e){
					//suppress error
				}
			}
		}else if (window.XMLHttpRequest){ // if Mozilla, Safari etc
			return new XMLHttpRequest();
		}else{
			return false;
		}
	}
	//Sample call: var myajaxrequest=new ajaxRequest();
	//Check to see if they are of minimum age to show interest fields
  function checkAge(intMinimumAge){
	var today = new Date();
	var dateOfBirth = new Date(document.getElementById("month").value + " " + document.getElementById("day").value + " " + document.getElementById("birthYear").value);
	today = Date.parse(today);
	dateOfBirth = Date.parse(dateOfBirth);
	var minutes = 1000*60;
	var hours = minutes*60;
	var days = hours*24;
	var years = days*365.25;
	var yearsToDoB = dateOfBirth/years;
	var yearsToToday = today/years;
	var age = yearsToToday - yearsToDoB;
	if (age >= intMinimumAge){
		//alert("18+");
		document.getElementById("fldInterest").style.display = "block";
		document.getElementById("fldInterest").style.visibility = "visible";
	}else{
		//alert(">18");
		document.getElementById("fldInterest").style.display = "none";
		document.getElementById("fldInterest").style.visibility = "hidden";
	}
  }
  function checkPasswords(e){
	//compare both password fields to make sure they match
	var evt = e || window.event;
	var tg = (window.event) ? evt.srcElement : evt.target;
	var thePassword = document.getElementById("password").value;
	var confirmPassword = document.getElementById("confirmPassword").value;
	if (thePassword == confirmPassword){
		document.getElementById("confirmedPWMsg").innerHTML = "<span style='font-size:18pt; color:green; font-weight:bold;'>&#x2714;</span>";
	}else if (thePassword != confirmPassword){
		document.getElementById("confirmedPWMsg").innerHTML = "<span style='font-size:18pt; color:red; font-weight:bold;'>&#x2620;</span>";
	}else if (confirmPassword == "Confirm Password"){ // this isn't clearing. Have to figure it out later
		document.getElementById("confirmedPWMsg").innerHTML = "";
	}
  }
  /**
   *This only works error free if the user doesn't try to go back to a previous field.
   */
  function fixFieldsForPieceOfShitInternetExplorer(oldObject, oType) {
	  var newObject = document.createElement('input');
	  newObject.type = oType;
	  if(oldObject.size) newObject.size = oldObject.size;
	  if(oldObject.value) newObject.value = oldObject.value;
	  if(oldObject.name) newObject.name = oldObject.name;
	  if(oldObject.id) newObject.id = oldObject.id;
	  if(oldObject.className) newObject.className = oldObject.className;
	  oldObject.parentNode.replaceChild(newObject,oldObject);
	  return newObject;
	}
  //change field type to/from password on registration page
  function fixFieldType(e){
		var evt = e || window.event;
		var tg = (window.event) ? evt.srcElement : evt.target;
		//var blnIE = (window.event) ? true : false; //wasn't working in Chrome.
		var blnIE = (getInternetExplorerVersion() != -1) ? true : false;
		switch(tg.id){
			case "password":
				if(evt.type == "focus"){
					if(tg.value == "Password"){
						if(blnIE){ //nasty hack to fix fields in IE
							tg = fixFieldsForPieceOfShitInternetExplorer(tg,'password');
							addEvent(document.getElementById("password"), "focus", fixFieldType, false);
							addEvent(document.getElementById("password"), "blur", fixFieldType, false);
							tg.focus();
							tg.select();
						}else{
							tg.type = "password";
						}
						tg.value = "";
						tg.focus();
						return;
					}
				}else if(evt.type == "blur"){
					if (tg.value == "" || tg.value.toLowerCase() == "password"){
						if(blnIE){ //nasty hack to fix fields in IE
							tg = fixFieldsForPieceOfShitInternetExplorer(tg,'text');
							addEvent(document.getElementById("password"), "focus", fixFieldType, false);
							addEvent(document.getElementById("password"), "blur", fixFieldType, false);
						}else{
							tg.type = "text";
						}
						tg.value = "Password";
						return;
					}
				}
				break;
			case "confirmPassword":
				if(evt.type == "focus"){
					if(tg.value == "Confirm Password"){
						if(blnIE){ //nasty hack to fix fields in IE
							tg = fixFieldsForPieceOfShitInternetExplorer(tg,'password');
							addEvent(document.getElementById("confirmPassword"), "focus", fixFieldType, false);
							addEvent(document.getElementById("confirmPassword"), "blur", fixFieldType, false);
							tg.focus();
							tg.select();
						}else{
							tg.type = "password";
						}
						tg.value = "";
						tg.focus();
						return;
					}
				}else if(evt.type == "blur"){
					if (tg.value == "" || tg.value.toLowerCase() == "confirm password"){
						if(blnIE){ //nasty hack to fix fields in IE
							tg = fixFieldsForPieceOfShitInternetExplorer(tg,'text');
							addEvent(document.getElementById("confirmPassword"), "focus", fixFieldType, false);
							addEvent(document.getElementById("confirmPassword"), "blur", fixFieldType, false);
						}else{
							tg.type = "text";
						}
						tg.value = "Confirm Password";
						return;
					}
				}
				break;
			default:
				break;
		}
		return;
	}

	// Returns the version of Internet Explorer or a -1
	// (indicating the use of another browser).
	function getInternetExplorerVersion(){
	  var rv = -1; // Return value assumes failure.
	  if (navigator.appName == 'Microsoft Internet Explorer'){
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (re.exec(ua) != null)
		  rv = parseFloat( RegExp.$1 );
	  }
	  return rv;
	}
	//checks the length of the field to see if it exceeds max number of allowed characters
	function checkLength(maxchars,objTextarea){
		var textArea = document.getElementById(objTextarea);
		if(textArea.value.length > maxchars){
			 alert('Maximum update length is ' + maxchars + ' characters! Please remove '+
					 (textArea.value.length - maxchars) + ' characters');
			 return false;
		 }else{
//			 return true;
//		 }
			 if(textArea.value.length < 3){
				 alert('Minimum update length is 3 characters');
				 return false;
			 }else{
				 return true;
			 }
		}
	}
	//function called to submit an update
	function submitUpdate(intMaxLength,objTextarea,pageToCall){
		if(!checkLength(intMaxLength,objTextarea)){
			return false;
		}else{
	/*		var xmlhttpUpdate = new ajaxRequest();
			var dblFunctIDValue = encodeURIComponent(document.getElementById("dblFunctID").value);
			var privacyValue = encodeURIComponent(document.getElementById("privacy").value);
			var ratingValue = encodeURIComponent(document.getElementById("rating").value);
			var status_boxValue = encodeURIComponent(document.getElementById("status_box").value);
			var parameters = "dblFunctID="+dblFunctIDValue+"&privacy="+privacyValue+"&rating="+ratingValue+"&status_box="+status_boxValue;
			alert ("rs=" + xmlhttpUpdate.readyState);
			document.getElementById(objTextarea).value = xmlhttpUpdate.responseText;
			xmlhttpUpdate.onreadystatechange = function(){
				if (xmlhttpUpdate.readyState == 4){
					if (xmlhttpUpdate.status == 200 || window.location.href.indexOf("http") == -1){
						document.getElementById(objTextarea).value = xmlhttpUpdate.responseText;
					}else{
						alert("An error has occured making the request");
					}
				}
			}
			alert ("param = " + parameters);
			if(xmlhttpUpdate.readyState != 4){return false;}
			xmlhttpUpdate.open("POST", "system/"+pageToCall, true);
			alert(xmlhttpUpdate.status);
			xmlhttpUpdate.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttpUpdate.send(parameters);
			alert(xmlhttpUpdate.status);*/
			return true;
		}
	}




