﻿document.ddlToHide = new Array();

function bodyOnload()
{
	for(var i = 0; document.loadFunctions != null && i<document.loadFunctions.length; i++)
	{
		document.loadFunctions[i].call(document.body);
	}
	
	for(var i = 0; document.afterLoadFunctions != null && i<document.afterLoadFunctions.length; i++)
	{
		document.afterLoadFunctions[i].call(document.body);
	}
}

function addLoadHandler(handler)
{
	if(document.loadFunctions == null)
	{
		document.loadFunctions = new Array();
	}
	document.loadFunctions.push(handler);
}

function addAfterLoadHandler(handler)
{
	if(document.afterLoadFunctions == null)
	{
		document.afterLoadFunctions = new Array();
	}
	document.afterLoadFunctions.push(handler);
}

function infoFocused()
{
	if(this.value == this.tempValue)
	{
		this.value = "";
	}
	
	this.style.color = "#000000";
}

function infoBlured()
{
	if(this.value.trim().length == 0 || this.value == this.tempValue)
	{
		this.value = this.tempValue;
		this.style.color = "#AAAAAA";
	}
	else
	{
		this.style.color = "#000000";
	}
}

function processInfoTexts()
{
	var objects = document.getElementsByTagName("input");
	for(var i = 0; i<objects.length; i++)
	{
		if(objects.item(i).className == "infoText")
		{
			var txtInfo = objects.item(i);
			txtInfo.onfocus = infoFocused;
			txtInfo.onblur = infoBlured;
			txtInfo.tempValue = txtInfo.value;
			txtInfo.style.color = "#AAAAAA";
		}
	}
}

function processInfoTextsAfterLoad()
{
	var objects = document.getElementsByTagName("input");
	for(var i = 0; i<objects.length; i++)
	{
		if(objects.item(i).className == "infoText")
		{
			infoBlured.call(objects.item(i));
		}
	}
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}
