ContentInfo = "";
topColor = "#666666"
subColor = "#FFFFFF"
var mouse_X;
var mouse_Y;
var tip_active = 0;

function update_tip_pos(){
		document.getElementById('ToolTip').style.left = mouse_X + 20;
		document.getElementById('ToolTip').style.top  = mouse_Y;
}

var ie = document.all?true:false;
if (!ie) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
function getMouseXY(e) {
if (ie) { // grab the x-y pos.s if browser is IE
mouse_X = event.clientX + document.body.scrollLeft;
mouse_Y = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
mouse_X = e.pageX;
mouse_Y = e.pageY;
}
if (mouse_X < 0){mouse_X = 0;}
if (mouse_Y < 0){mouse_Y = 0;}

if(tip_active){update_tip_pos();}
}
function EnterContent(TTitle, TContent){
ContentInfo = '<table border="0" width="300" cellspacing="0" cellpadding="0">'+
'<tr><td width="100%" bgcolor="#000000">'+
'<table border="0" width="100%" cellspacing="1" cellpadding="0">'+
'<tr><td width="100%" bgcolor='+topColor+'>'+
'<table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">'+
'<tr><td width="100%">'+
'<font class="tooltiptitle">&nbsp;'+TTitle+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'<tr><td width="100%" bgcolor='+subColor+'>'+
'<table border="0" width="90%" cellpadding="0" cellspacing="1" align="center">'+
'<tr><td width="100%">'+
'<font class="tooltipcontent">'+TContent+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>';
}
function tip_it(which, TTitle, TContent){
	if(which){
			update_tip_pos();
			tip_active = 1;
				document.getElementById('ToolTip').style.visibility = "visible";
				EnterContent(TTitle, TContent);
				document.getElementById('ToolTip').innerHTML = ContentInfo;
		}else{
			tip_active = 0;
			document.getElementById('ToolTip').style.visibility = "hidden";
	}
}

function TestURL()
{
	var URL = document.nu.url.value;
	if(URL == "" || URL == 'http://')	{
		alert("You must provide the URL before testing!");
		document.nu.url.focus();
		return false;
	}
	var URL = 'urltest.php?url='+URL;
	window.open(URL, '_blank' );
	return false;
}

function VerifyPasswordStrength(txt)
{
    var pw = txt.value;

    var pwWeak		= document.getElementById('pwWeak');
    var pwMedium	= document.getElementById('pwMedium');
    var pwStrong	= document.getElementById('pwStrong');

	// Reset the default colors
	pwWeak.style.backgroundColor	= '#FFFFFF';
	pwMedium.style.backgroundColor	= '#FFFFFF';
	pwStrong.style.backgroundColor	= '#FFFFFF';
	
	// What does out pw contain?
	var numbers		= 0;
	var uppercase	= 0;
	var lowercase	= 0;
	var special		= 0;
	for(i=0;i<pw.length;i++)
	{
		var c = pw.charCodeAt(i);
		if(c >= 48 && c <= 57)
			numbers = 1;
		else if(c >= 65 && c <= 90)
			uppercase = 1;
		else if(c >= 97 && c <= 122)
			lowercase = 1;
		else
			special = 1;		
	}

	var len			= pw.length;
	var points		= 0;
	
	if(numbers)
		points += 1;
	if(uppercase)
		points += 1;
	if(lowercase)
		points += 1;
	if(special)
		points += 1;

	if(len >= 10)
		points += 3;
	if(len < 10 && len >= 8)
		points += 2;
	if(len < 8 && len >= 6)
		points += 1;

	var type = '';
	if(points >= 6)
		type = 'strong';
	else if(points < 6 && points > 3)
		type = 'medium';
	else if(points <= 3 && points > 0)
		type = 'weak';
	
	if(type == 'weak')
		pwWeak.style.backgroundColor	= '#fa6363';
	else if(type == 'medium')
		pwMedium.style.backgroundColor	= '#fcf143';
	else if(type == 'strong')
		pwStrong.style.backgroundColor	= 'lightgreen';
}


