function GaugeKeyUp(e) {
//On every keypress checks for the strenght of the password being typed
	Browser = navigator.appName;
	if (Browser.indexOf("Microsoft") >= 0) {
		//Microsoft Fix
		e = window.event;
		e.target = window.event.srcElement;
	}
	var xmlhttp=false;
	if ((document.getElementById("v_new_password")) || (document.getElementById("v_password"))) {
		var myText = "password="+e.target.value.toString()+"&username="+document.getElementById("v_username").value.toString()+"&last_change="+document.getElementById("v_date").value.toString();
	} else {
		var myText = "pwd="+document.getElementById("customer_password").value.toString();
	}
	//Calculates the strength of your password
	var httpUrl = "http://www.entaonline.co.uk/gauge.php";

	
	//This code could possibly be needed for IE.
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		}
	} else {
		return false;
	}
	

	xmlhttp.open("POST", httpUrl, true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length",myText.length);
	xmlhttp.setRequestHeader("Connection","close");

	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState == 4) { 
			//Send the intPercent Value to the function that is returned from CheckStrongPassword.php
			GaugeCallback(xmlhttp.responseText);
		}
	}
	
	xmlhttp.send(myText);

}

function GaugeCallback(intPercent){
//Controls the bar with the strong password percentage variable.
	objGuage = document.getElementById("Gauge");
	if (intPercent>0){
		objGuage.style.width = intPercent+"%";
		if (intPercent<50){
			objGuage.style.background="#cc0000";
		}else if(intPercent<83){
			objGuage.style.background="#FFD700";
		}else{
			objGuage.style.background="#00A601";
		}
	}else{
		objGuage.style.width = 0;
	}
}
