// JavaScript Document
function dropGo(oThis)
{
	window.location.href = oThis.options[oThis.options.selectedIndex].value
}

function openMini(url,wHeight,wWidth)
{
windowprops = "height=" + wHeight + "," + "width=" + wWidth + "," +"scrollbars=yes,menubar=no,toolbar=no,resizable=yes,status=yes,location=no";
sName = new Date().getTime().toString();
window.open(url, sName, windowprops);
}

function refreshPage(e)
{
if (!e) var e = window.event;
window.location.href = window.location.href
}

function returnChecked(sName)
{
oObject = document.getElementsByName(sName)
for(g=0;g<oObject.length;g++)
	{
		if(oObject[g].checked)
			{
				break;
			}
	}
return oObject[g].value
}

function getTop(oThis)
{
iTop = oThis.offsetHeight
do {
	iTop += oThis.offsetTop
	oThis = oThis.offsetParent
	} while (oThis.offsetParent)
return iTop
}

function getLeft(oThis)
{
iLeft = 0
do {
	iLeft += oThis.offsetLeft
	oThis = oThis.offsetParent
	} while (oThis.offsetParent)
	return iLeft
}

function getElement(sElementID)
{
if (document.all)
	{
		var oReturn = document.all(sElementID)	
	} else {
		var oReturn = document.getElementById(sElementID)
	}
if (!oReturn)
	{
		return null
	} else {
		return oReturn
	}
}

function StrReverse(sString)
{
var RevString = ""
if (sString.length > 0)
	{
		for (i = parseInt(sString.length - 1); i > -1; i--)
			{
			cIn = sString.charAt(i)
			RevString = RevString + cIn
			}
	}
return RevString
}

function strTrim(sString)
{
if (sString.length > 0)
	{
		for (i=0;i<sString.length;i++)
			{
			if(sString.charCodeAt(i) != 160)
				{	
					break;
				}
			}
		sString = sString.substr(i);
	}
return sString
}

function submitForm(sFormName)
{
if (sFormName != "")
	{
		oForm = getElement(sFormName)
		if (oForm != null && oForm.tagName == "FORM")
			{
				oForm.submit()
			}
	}
}

function InitDrops(sObjectName, sValue)
{
var oObject = getElement(sObjectName)
if (oObject)
	{
	for (k=0;k<oObject.options.length;k++)
		{
		if (oObject.options[k].value == sValue)
			{
				oObject.options[k].selected = true
				break;
			}
		}
	}
}

function InitDrops_bitCheck(sObjectName, iBit)
{
var oObject = getElement(sObjectName)
if (oObject)
	{
	for (k=0;k<oObject.options.length;k++)
		{
		if (parseInt(oObject.options[k].value) & iBit)
			{
				oObject.options[k].selected = true
			}
		}
	}
}

function decode(str)
{
     return unescape(str.replace(/\+/g, " "));
}

function checkForm(sFormName)
{
fieldBG = "#FFF099";
fieldText = "#000";
sAlert = "";
for (i=0;i<aCheckFields1.length;i++)
	{
		if (aCheckFields1[i] == "user_password")
			{
				if(getElement(aCheckFields1[i]).value == "")
					{
						getElement(aCheckFields1[i]).style.background = fieldBG;
						getElement(aCheckFields1[i]).style.color = fieldText;
						sAlert = sAlert + "\n" + aAlertTxt1[i];	
					} else {
						sPassword2 = getElement("user_password2").value
						if (getElement(aCheckFields1[i]).value != sPassword2)
							{
								sAlert = sAlert + "\n" + "Password and Verify Password fields do not match, please check these fields.";
							}
					}
			} else {
				if (getElement(aCheckFields1[i]).value == "")
					{
						getElement(aCheckFields1[i]).style.background = fieldBG;
						getElement(aCheckFields1[i]).style.color = fieldText;
						sAlert = sAlert + "\n" + aAlertTxt1[i];
					} else {
						getElement(aCheckFields1[i]).style.background = "";
						getElement(aCheckFields1[i]).style.color = "";
					}	
			}
	}
if (sAlert != "")
	{
		sAlert =  "The following fields need to be filled in before you can submit this form:" + sAlert;
		alert(sAlert);
	} else {
		getElement(sFormName).submit();
	}
}