function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function cOn(td, col){
	if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor=col;
	}
}

function checkinteger(object_value) {

    if (object_value.length == 0)
        return true;

	var decimal_format = ".";
	var check_char;

	check_char = object_value.indexOf(decimal_format)

    if (check_char < 1)
		return checknumber(object_value);
    else
		return false;
}

function checknumber(object_value) {

    if (object_value.length == 0)
        return true;

	var start_format = ".0123456789";
	var number_format = ".0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;

	check_char = start_format.indexOf(object_value.charAt(0))

	if (check_char == 1)
	    decimal = true;
	else if (check_char < 1)
		return false;
        
	for (var i = 1; i < object_value.length; i++) {
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1) {
			if (decimal)
				return false;
			else
				decimal = true;
		}
		else if (check_char == 0) {
			if (decimal || digits)	
				trailing_blank = true;
		}
	        else if (trailing_blank)
				return false;
		else
			digits = true;
	}	
    return true
}

function ClearOptions(OptionList) {
   // Always clear an option list from the last entry to the first
   for (x = OptionList.length; x >= 0; x = x - 1) {
      OptionList[x] = null;
   }
}

function AddToOptionList(OptionList, OptionValue, OptionText) {
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

function getRealLeft(el) {
    if (arguments.length==0) el = this;
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    if (arguments.length==0) el = this;
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

function highlightff(ff, toggle) {
	hdffonclass = "frm_focus";
	hdffoffclass = "frm";
	if (toggle) ff.className = hdffonclass;
	else ff.className = hdffoffclass;
}

function showStatusMessage(msg) {
	status=msg;
	setTimeout("clearStatusBar()", 5000);
	return true
}

function clearStatusBar() {
	status="";
	return true;
}

// Extended string functions

function strltrim() {
	return this.replace(/^\s+/,'');
}

function strrtrim() {
	return this.replace(/\s+$/,'');
}

function strtrim() {
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;


