

function IsEmpty(inputStr, FormName, ElementName, Label)
{
	if (Trim(inputStr) == "")
	{ 
		alert(Label + " is required.");
		eval("self.parent.document." + FormName+ "." + ElementName + ".focus();")
		eval("self.parent.document." + FormName+ "." + ElementName + ".select();")
		return true;
	}  
	return false;
}

 
function Trim(str)
{
	return RTrim(LTrim(str));
}

function LTrim(str)
{
	var whitespace = new String(" \t\n\r");

	var s = new String(str);

	if (whitespace.indexOf(s.charAt(0)) != -1) 
	{
		var j=0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
		{
			j++;
		}
		s = s.substring(j, i);
	}

	return s;
}

function RTrim(str)
{
	var whitespace = new String(" \t\n\r");

	var s = new String(str);

	if (whitespace.indexOf(s.charAt(s.length-1)) != -1) 
	{
		var i = s.length - 1;       // Get length of string
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
		i--;
		s = s.substring(0, i+1);
	}

	return s;
}

function chgBg(obj,color)
{
if (document.all || document.getElementById)
  obj.style.backgroundColor=color;
else if (document.layers)
  obj.bgColor=color;
}	

var imove = 0;
var currentObject = '';
var objectPosition = '';
var offsetX = 0;
var offsetY = 0;		

function pickUp(o) {
	inDragMode = true;
	currentObject = o;
	imove = 1;
	X = o.style.left.indexOf('px');
	X = o.style.left.substring(o.style.left, X);
	X = X.valueOf();
	Y = o.style.top.indexOf('px');
	Y = o.style.top.substring(o.style.top, Y);
	Y = Y.valueOf();
	offsetX = event.x - X;
	offsetY = event.y - Y;
	}
			
function putDown() {	
	if (currentObject != '') {
		inDragMode = false;
		currentObject = '';
		imove = 0;
		}
	}

function moveObject(x, y) {
	if (imove == 1) {
		if (currentObject.style.position != "absolute") {
			// Change positioning to aboslute so we can move it around.
			currentObject.style.position = "absolute";
			}
			
			currentObject.style.left = x - offsetX;
			currentObject.style.top = y - offsetY;
		}
	}

