

Event.observe(window, 'load', function(){
	var showPasswordStrength = function( div, pw ) 
	{
		if (ClientSideBestPassword(pw))
		{
			div.innerHTML="<div style=\"width:200; height:25; background-image:url('/passwordCheck/str4.png')\">Best Strength Password</div>";
		}
		else if (ClientSideStrongPassword(pw))
		{
			div.innerHTML="<div style=\"width:200; height:25; background-image:url('/passwordCheck/str3.png')\">Strong Strength Password</div>";
		}
		else if (ClientSideMediumPassword(pw))
		{
			div.innerHTML="<div style=\"width:200; height:25; background-image:url('/passwordCheck/str2.png')\">Medium Strength Password</div>";
		}
		else
		{
			div.innerHTML="<div style=\"width:200; height:25; background-image:url('/passwordCheck/str1.png')\">Weak Strength Password</div>";
		}
	};

	var pwdCheck = function()
	{
		//console.log($('pwd1').value);

		if ($('pwd1').value.length!=0 && $('pwd2').value.length==0)
		{
			showPasswordStrength($('pwdStrength'),$('pwd1').value);			
		}
		else if ($('pwd1').value!=$('pwd2').value)
		{
			$('pwdStrength').innerHTML="<div style=\"width:200; height:25; background-image:url('/passwordCheck/str0.png')\">Passwords do not match</div>";
		}
		else if ($('pwd1').value.length>0)
		{
			showPasswordStrength($('pwdStrength'),$('pwd1').value);
		}
		else
			$('pwdStrength').innerHTML="";
	};

	Event.observe($('pwd1'), 'keyup', pwdCheck);
	Event.observe($('pwd2'), 'keyup', pwdCheck);	
});