var browser = navigator.appName;
var ie = /Microsoft Internet Explorer/;
var SLi = 0;

function setFocus(element) {
	element.focus();
}

function resetPSCell() {
	document.getElementById("psCell").style.backgroundColor="#FFFFFF";
	document.getElementById("psCell").style.color="#00B5E6";
}

function setPassStrength(elem) {
	//White #FFFFFF, Purple #62549E, Yellow #FCEE21, Blue #00B5E6 
	var psC = document.getElementById("psCell");
	if(psC != null) {
		var psColors = ["#FFFFFF", "#62549E", "#FCEE21", "#00B5E6", "#00B5E6"];
		var psTColors = ["#00B5E6", "#FFFFFF", "#00B5E6", "#FFFFFF", "#FFFFFF"];
		var psValues = ["at least 6 characters long", "normal", "good", "strong", "very strong"];
		var ps = 0, psS = 0, psB = 0, psN = 0, psSymb = 0;
		str = elem.value;
		if(str.length > 5) {
			for(i = 0; i < str.length; i++) {
				if(str.charCodeAt(i) >= 97 && str.charCodeAt(i) <= 122)
					psS++;
				else
					if(str.charCodeAt(i) >= 65 && str.charCodeAt(i) <= 90)
						psB++;
					else
						if(str.charCodeAt(i) >= 48 && str.charCodeAt(i) <= 57)
							psN++;
						else
							psSymb++;
			}
		}
		if(psS > 0)
			ps++;
		if(psB > 0)
			ps++;
		if(psN > 0)
			ps++;
		if(psSymb > 0)
			ps++;
		psC.value = psValues[ps];
		psC.style.backgroundColor = psColors[ps];
		psC.style.color = psTColors[ps];
	}
}

function fixIEDisabledOption(elem, sli) {
	if(elem.selectedIndex == sli) {
		elem.selectedIndex = SLi;
	}
}

function setSLI(elem) {
	if(ie.exec(browser))
		SLi = elem.selectedIndex;
}

function Time() {
	setTimeout('window.location = "../Common/logout.php"', 600000);
}