function CheckPassword() 
{
	var textTag = document.getElementById('passStr');
	var pass = document.getElementById('pass').value;

	if(pass.length == 0)
		textTag.innerHTML = '<span style="color:#f00">No password</span>';
	else
	if(pass.length < 5)
		textTag.innerHTML = '<span style="color:#f00">Password is too short</span>';
	else {
		var lc = 0;
		var uc = 0;
		var nc = 0;
		var xc = 0;
		for(var i = 0; i < pass.length; i++) {
			var c = pass.substr(i, 1);
			if(c.match('[a-z]'))
				lc++;
			else
			if(c.match('[A-Z]'))
				uc++;
			else
			if(c.match('[0-9]'))
				nc++;
			else
				xc++;
		}
		var total = 0;
		if(lc > 1)
			total++;
		if(uc > 1)
			total++;
		if(nc > 1)
			total++;
		if(xc > 1)
			total += 2;
		switch(total) {
			case 0: textTag.innerHTML = 'Very weak'; break;
			case 1: textTag.innerHTML = 'Weak'; break;
			case 2: textTag.innerHTML = 'Medium'; break;
			case 3: textTag.innerHTML = 'Good'; break;
			default:
				if(total >= 4)
					textTag.innerHTML = 'Very good';
				else
					textTag.innerHTML = 'No password';
				break;
		}
	}	
}

