function OpenHelp(elm, text)
{
	var help = document.getElementById('helper');
	help.innerHTML = '<div id="subHelper" style="width:280px; height:98px; overflow:auto;">'+text+'</div>';
	var left = GetLeft(elm);
	left -= 15;
	help.style.left = left+'px';
	var top = GetTop(elm);
	top -= 115;
	help.style.top = top+'px';
	help.style.display = 'block';
}

function CloseHelp()
{
	if (document.getElementById('helper') != null)
	{
		document.getElementById('helper').style.display = 'none';
		document.getElementById('helper').innerHTML = '';
	}
}

function GetLeft(elm)
{
	var left = elm.offsetLeft;
	while (elm = elm.offsetParent)
	{
		left += elm.offsetLeft;
	}
	
	return left;
}

function GetTop(elm)
{
	var top = elm.offsetTop;
	while (elm = elm.offsetParent)
	{
		top += elm.offsetTop;
	}
	
	return top;
}

document.onmouseup = function()
{
	if (document.getElementById('helper').style.display == "block")
		setTimeout("CloseHelp()", 33);
}

function nextBox(elm)
{
	if (elm.value.length == elm.maxLength)
	{
		var tag = elm.id.substring(0, elm.id.length-1);
		if (tag == "ccn")
			elm.type = "password";
		var num = parseInt(elm.id.substr(elm.id.length-1));
		num++;
		document.getElementById(tag + num).focus();
	}
}

function AJAX(url, elmId)
{
	if (elmId != null)
	{
		var elm = document.getElementById(elmId);
		elm.style.display = "block";
	}

	var texthttp;
	if (window.XMLHttpRequest)
		texthttp = new XMLHttpRequest();
	else
		texthttp = new ActiveXObject("Microsoft.XMLHTTP");
	
	texthttp.onreadystatechange = function()
	{
		if (texthttp.readyState == 4 && texthttp.status == 200)
		{
			if (elmId != null)
				elm.innerHTML = texthttp.responseText;
		}
	}
	
	texthttp.open("GET", url, true);
	texthttp.send();
}

function InputText(elm, text, compare, focused)
{
	if (!focused)
		if (elm.id == "searchBox" && elm.value == "")
			document.getElementById("quikSearch").style.display = "none";

	if (elm.value == "")
	{
		elm.style.color="#7D7D7D";
		elm.value = text;
	}
	else
	{
		if (elm.value == compare)
		{
			if (text == '')
			{
				elm.style.color="#000000";
				elm.value = text;
			}
		}
	}
}

function HoverFade(isFull, elm)
{
	if (isFull)
	{
		elm.style.opacity = "1";
		elm.style.filter = "alpha(opacity=100)";
	}
	else
	{
		elm.style.opacity = "0.75";
		elm.style.filter = "alpha(opacity=75)";
	}
}

Get = function()
{
	this.TopOffset = function(elm)
	{
		var top = elm.offsetTop;
		while (elm = elm.offsetParent)
		{
			top += elm.offsetTop;
		}
		
		return top;
	}
	
	this.LeftOffset = function (elm)
	{
		var left = elm.offsetLeft;
		while (elm = elm.offsetParent)
		{
			left += elm.offsetLeft;
		}
		
		return left;
	}
}

function getDocHeight()
{
    var D = document;
    return Math.max(Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight));
}
