/*
==================================================================
Browser Version
==================================================================
*/
var agt = navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) ||
                  (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);

var is_ie      = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3     = (is_ie && (is_major < 4));
var is_ie4     = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up   = (is_ie && (is_major >= 4));
var is_ie5     = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5   = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up   = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6     = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up   = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
//------------------------------------------------------------------



/*
==================================================================
Printing functions
==================================================================
*/
function showElem(o) {
	if (o!=null)
		o.style.display='';
}
function hideElem(o) {
	if (o!=null)
		o.style.display='none';
}

/*
==================================================================
Validation functions
==================================================================
*/
var defaultEmptyOK = false;
var decimalPointDelimiter = ".";

// Returns true if character c is a digit 
// (0 .. 9).
function isDigit (c) {  
	return ((c >= "0") && (c <= "9"))
}

// Check whether string s is empty.
function utIsEmpty(s) {   
	return ((s == null) || (s.length == 0))
}

// utIsFloat (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is an unsigned floating point (real) number. 
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isInteger, then call isFloat.
//
// Does not accept exponential notation.
function utIsFloat (s)  {
	var i;
    var seenDecimalPoint = false;

    if (utIsEmpty(s)) 
       if (utIsFloat.arguments.length == 1) 
	   	   return defaultEmptyOK;
       else 
	   	   return (utIsFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);
		
		if ( (c=='-' || c=='+') && i == 0)
			; //Sign is ok
        else if ((c == decimalPointDelimiter) && !seenDecimalPoint) 
			seenDecimalPoint = true;
        else if (!isDigit(c)) 
			return false;
    }

    // All characters are numbers.
    return true;
}

// utIsInteger (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is an integer number. 
function utIsInteger (s)  {
	var i;

    if (utIsEmpty(s)) 
       if (utIsInteger.arguments.length == 1) 
	   	   return defaultEmptyOK;
       else 
	   	   return (utIsInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);
		
		if ( (c=='-' || c=='+') && i == 0)
			; //Sign is ok
        else if (!isDigit(c)) 
			return false;
    }

    // All characters are numbers.
    return true;
}

/*
==================================================================
Visual functions
==================================================================
*/
var glVObj=null;
function blink_Input_Element(o) {
	glVObj = o;
	glVObj.style.backgroundColor = 'gray';
	window.setTimeout("glVObj.style.backgroundColor = '';", 1000);
}


/*
==================================================================
Misc. Math functions
==================================================================
*/
function utGenerateRandomNumber(maxnumber) {
	var generatornum;
	var r;
	if (maxnumber == null)
		maxnumber = 1000;
	generatornum=Math.random();
	var r=Math.round(generatornum*maxnumber);
	return (r);
}



/*
==================================================================
String manipulation functions
==================================================================
*/
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;
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }

   return s;
}

function Trim(str) {
   return RTrim(LTrim(str));
}
function utTrim(str) {
   return RTrim(LTrim(str));
}

function utMax(a, b) {
	if (a > b)
		return(a);
	return (b);
}
function utMin(a, b) {
	if (a < b)
		return(a);
	return (b);
}
//----------------------------------------------------------------------------
//ReplaceString function
function replaceString(s, s1, s2) {
	var t = s;
	if (s1=='') {
		return (t);
	}

	var k = t.toUpperCase().indexOf(s1.toUpperCase(), 0);
	var i = 0;
	while (k >= 0 && i < 100) {
		t = t.substring(0, k) + s2 + t.substring(k+s1.length, t.length);

		k = t.toUpperCase().indexOf(s1.toUpperCase(), k+s2.length);
		i++;
	}
	return (t);
}
//------------------------------------------------------------------------------
function utJSEncode(s) {
	var t = s;
	t = replaceString(t, "\\", "\\\\");
	t = replaceString(t, "\'", "\\\'");
	t = replaceString(t, "\"", "\\\"");
	return (t);
}
//------------------------------------------------------------------------------
function utHtmlEncode(s) {
	var str = new String(s);
	str = str.replace(/&/g, "&amp;");
	str = str.replace(/</g, "&lt;");
	str = str.replace(/>/g, "&gt;");
	str = str.replace(/"/g, "&quot;");
	return str;
}
//------------------------------------------------------------------------------
function utUrlEncode(s) {
	var t = s;
	t = escape(t);
	return (t);
}
//------------------------------------------------------------------------------
function utXmlEncode(s) {
	var t = s;
	t = replaceString(t, "&", "&amp;");
	t = replaceString(t, ">", "&gt;");
	t = replaceString(t, "<", "&lt;");
	t = replaceString(t, "\"", "&quot;");
	t = replaceString(t, "\'", "&apos;");
	return (t);
}
//------------------------------------------------------------------------------
function utFormatCurrency(n) {
	var num = n;
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		return(n);
	if (!utIsFloat(num))
		return(n);

	var sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	var cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function utParseInt(s) {
	return (parseInt(s, 10));
}
//----------------------------------------------------------------------------------
function utClose() {
	self.close();
}
//----------------------------------------------------------------------------------
function utReplaceURL(url) {
	var r1= utGenerateRandomNumber(1000);
	var r2= utGenerateRandomNumber(1000);
	if ( url.indexOf('?') < 0 )
		url += '?';
	else
		url += '&';
	url += 'r1=' + r1 + '&r2=' + r2;
	window.location.href = url;
}
//----------------------------------------------------------------------------------
function utGetLeftPos(o) {
	if (o == null) {
		return(0);
	} else {
		return(o.offsetLeft + utGetLeftPos(o.offsetParent));
	}
}
//----------------------------------------------------------------------------------
function utGetTopPos(o) {
	if (o == null) {
		return(0);
	} else {
		return(o.offsetTop + utGetTopPos(o.offsetParent));
	}
}
//----------------------------------------------------------------------------------
function utPopUp(a, b, c, leftPos, topPos, windowName, options) {
	var en = (b == 0) ? 300 : ((b < 200) ? 200 : ((b > 1000) ? 1000 : b));
	var boy = (c == 0) ? 400 : ((c < 200) ? 200 : ((c > 1000) ? 1000 : c));

	var w = '_blank';

	if (windowName != null && windowName != "")
		w = windowName;

	var left = window.screenLeft + 10;
	var top = window.screenTop + 10;
	if (leftPos != null && leftPos > 0)
		left = leftPos;
	if (topPos != null && topPos > 0)
		top = topPos-30;

	var valScrollbars = "yes";
	var valResizable = "yes";
	var valStatus = "no";
	var valMenubar = "no";
	var valToolbar = "no";
	var valLocation = "no";

	if (options != null) {
		if (options.toUpperCase().indexOf("SCROLLBARS=N") >= 0)
			valScrollbars = "no";
		if (options.toUpperCase().indexOf("RESIZABLE=N") >= 0)
			valResizable = "no";
		if (options.toUpperCase().indexOf("STATUS=Y") >= 0)
			valStatus= "yes";
		if (options.toUpperCase().indexOf("MENUBAR=Y") >= 0)
			valMenubar = "yes";
		if (options.toUpperCase().indexOf("TOOLBAR=Y") >= 0)
			valToolbar = "yes";
		if (options.toUpperCase().indexOf("LOCATION=Y") >= 0)
			valLocation = "yes";
	} /* if */

	options =	"scrollbars=" + valScrollbars +
				",resizable=" + valResizable +
				",status=" + valStatus +
				",menubar=" + valMenubar +
				",toolbar=" + valToolbar +
				",location=" + valLocation;

	var yeni = window.open(a, w, options + ",left="+left+",top="+top+",width="+en+",height="+boy);
	try {
		var temp = yeni.name;
	} catch(e) {
		glHndlError('window.open failed, possible popup blocker.', '', '');
	}

	if(navigator.appName == "Microsoft Internet Explorer" &&
		parseInt(navigator.appVersion) >= 4) {
		yeni.focus();
	} else {
		if(navigator.appName != "Microsoft Internet Explorer")
			yeni.focus();
	}
}
//----------------------------------------------------------------------------------
function utOpenInIFrame(url) {
	document.getElementById('glFrmBrowser').src = url;
}
//----------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Context Menu functions
////////////////////////////////////////////////////////////////////////////////////////////////////////
var glContextMenuTimeoutId = null; // To keep reference to the context menu timeout
function utDisplayContextMenu(innerHTML, w, linkedO, funcOnClick) {
	utHideMenu();
	menuC.innerHTML = innerHTML;

	//assign onmouseout and onmouseover events to all rows 
	var oTbl = menuC.childNodes[0];
	for (var i = 0; i  < oTbl.rows.length; i++) {
		var R = oTbl.rows[i];
		utAttachEvent(R.childNodes[0], "mouseover", utSwitchMenu);
		utAttachEvent(R.childNodes[0], "mouseout", utSwitchMenu);
		R.childNodes[0].className = 'glMenuItem';
	}		

	if (w != null)
		menuC.style.width = w;

	if (linkedO == null) {
		menuC.linkedObject = null;
	} else {
		menuC.linkedObject = linkedO;
//		if (linkedO.style._borderStyle == null) {
//			linkedO.style._borderStyle = linkedO.style.borderStyle;
//			linkedO.style._borderColor = linkedO.style.borderColor;
//			linkedO.style._backgroundColor = linkedO.style.backgroundColor;
//		}
//		linkedO.style.borderStyle = "inset";
//		linkedO.style.borderColor = "activeborder";
//		linkedO.style.backgroundColor = "activeborder";
	} /* else */

	if (funcOnClick == null)
		menuC.onclick = null;
	else
		menuC.onclick = funcOnClick;

	//Find out how close the mouse is to the corner of the window
	var rightedge = utWindowGetFrameWidth() - event.clientX;
	var bottomedge = utWindowGetFrameHeight() - event.clientY;

	//if the horizontal distance isn't enough to accomodate the width of the context menu
	if (rightedge < menuC.offsetWidth)
		//move the horizontal position of the menu to the left by it's width
		menuC.style.left = utWindowGetScrollX() + event.clientX - menuC.offsetWidth;
	else
		//position the horizontal position of the menu where the mouse was clicked
		menuC.style.left = utWindowGetScrollX() + event.clientX;

	//same concept with the vertical position
	if (bottomedge < menuC.offsetHeight)
		menuC.style.top = utWindowGetScrollY() + event.clientY - menuC.offsetHeight;
	else
		menuC.style.top = utWindowGetScrollY() + event.clientY;

	menuC.style.display = "";

	utKillContextMenuTimeOut();
	glContextMenuTimeoutId = setTimeout("utHideMenu();", 3000); 
} /* function utDisplayContextMenu( */

function utSwitchMenu(e) {
	utKillContextMenuTimeOut();
	var o = utGetEventTarget(e, window.event);
	event.cancelBubble=true;
	if (o.className=="glMenuItem") {
		o.className="glhighlightItem";
	} else if (o.className=="glhighlightItem") {
		o.className="glMenuItem";
	}
} /* function utSwitchMenu( */

function utHideMenu() {
	menuC.style.display="none";
	utKillContextMenuTimeOut();
} /* function utHideMenu( */

function utKillContextMenuTimeOut() {
	if (glContextMenuTimeoutId != null) {
		clearTimeout(glContextMenuTimeoutId);
		glContextMenuTimeoutId = null;
	}
} /* function utKillContextMenuTimeOut( */

function utUrlRemoveQueryParam(url, param) {
	var cUrl = url;

	var pQ = cUrl.indexOf("?");
	var baseUrl = cUrl;
	var query = "";
	if (pQ >= 0) {
		baseUrl = cUrl.substring(0, pQ);
		query = cUrl.substring(pQ+1);
	}
	cUrl = baseUrl;
	
	if (query == "")
		return (cUrl);
	
	cUrl += "?";
	
	var arrParams = query.split('&');
	for (var i = 0; i < arrParams.length; i++) {
		var p = arrParams[i];
		if (p != '') {
			if (p.toUpperCase().indexOf(param.toUpperCase() + '=') < 0) {
				cUrl += p + '&';
			}
		}
	}
	cUrl = cUrl.substring(0, cUrl.length-1);
	
	return (cUrl);
}

function utUrlAddQueryParam(url, param, val) {
	var cUrl = url;
	cUrl = utUrlRemoveQueryParam(cUrl, param);
	if (cUrl.indexOf('?') < 0)
		cUrl = cUrl + '?';
	if (cUrl.substring(cUrl.length-1, 1) != '?')
		cUrl = cUrl + '&';
	cUrl += param + '=' + utUrlEncode(val);
	return(cUrl);
}

// Set & Get Attribute functions
function utSetAttribute(obj, prop, val) {
	obj.setAttribute(prop, val);
} /* function utSetAttribute */
function utGetAttribute(obj, prop) {
	if (obj.getAttribute == null)
		return(null);

	if (obj.getAttribute(prop) != null)
		return (obj.getAttribute(prop));

	//Traverse through all attributes
	for(var i=0;i < obj.attributes.length;i++)
		if(obj.attributes[i].nodeName == prop)
			return obj.attributes[i].nodeValue;
	return (null);
} /* function utGetAttribute( */

//Gets attribute on the first element in the event bubble that is the same type as nodename
//and value exists on that node
//ex. var id = utGetAttributeOnNode(oEventTarget, "_id", "TABLE");
function utGetAttributeOnNode(obj, prop, nodeName) {
	if (obj == null)
		return (null);

	if (obj.nodeName.toUpperCase() == nodeName.toUpperCase()) {
		var t = utGetAttribute(obj, prop);
		if (t == null || t == undefined)
			return(utGetAttributeOnNode(obj.parentNode, prop, nodeName));
		else
			return (t);
	} else {
		return (utGetAttributeOnNode(obj.parentNode, prop, nodeName));
	}
} /* function utGetAttributeOnNode( */

// Event related functions
// Should be called as utGetEvent(e, window.event)
function utGetEvent(evt, wEvent) {
	if (!evt) evt = wEvent;
	return (evt);
}
// Should be called as utGetEventTarget(e, window.event)
function utGetEventTarget(evt, wEvent) {
	var obj = null;
	evt = utGetEvent(evt, wEvent);
	if (evt == null)
		return (null);
	if (evt.target)
		obj = evt.target;
	else if (evt.srcElement)
		obj = evt.srcElement;
	if (obj != null) {
		if (obj.nodeType == 3) // defeat Safari bug
			obj = obj.parentNode;
	}
	if (obj == null && evt != null) //if the element itself was passed as a parameter to hangle for ns browser which do not support fireevent
		obj = evt;
	return (obj);
}
function utGetEventType(evt, wEvent) {
	evt = utGetEvent(evt, wEvent);
	if (evt == null)
		return ('');
	return (evt.type);
}

// executed as: utCancelEventBubble(e, window.event);
function utCancelEventBubble(evt, wEvent) {
	evt = utGetEvent(evt, wEvent);
	evt.cancelBubble = true;
	if (evt.stopPropagation)
		evt.stopPropagation();
}

function utAttachChangeEvent(obj, func) {
	if (obj.addEventListener){
		obj.addEventListener('change', func, false); 
	} else if (obj.attachEvent){
		obj.attachEvent('onchange', func);
	} else {
		glHndlError('Error in utAttachChangeEvent: unable to attach event listener to form element.');
	}
}

function utAttachEvent(obj, eventType, func) {
	if (obj.addEventListener){ //Mozilla, Netscape, FireFox
		obj.addEventListener(eventType, func, false); 
	} else if (obj.attachEvent){ //IE
		obj.attachEvent('on'+eventType, func);
	} else {
		glHndlError('Error in utAttachEvent: unable to attach event listener to form element.');
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
// AJAX related functions
////////////////////////////////////////////////////////////////////////////////////////////////////////
//function utGetXMLRoot(xml) {
//	var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
//	xmlDoc.async="false";
//	xmlDoc.loadXML(xml);
//	var root = xmlDoc.getElementsByTagName('root').item(0);
//	return(root);
//}
function utGetXMLRoot(xml) {
	var xmlDoc;
	try {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = false;
		xmlDoc.loadXML(xml);
	} catch (error) {
		try {
			var parser = new DOMParser();
			xmlDoc = parser.parseFromString(xml, "text/xml");
			delete parser;
		} catch (error2) {
			glHndlError('XML parsing failed - ' + error.description + ' - ' + error2.description, '', '');
			return(null);
		}
	}
	var root = xmlDoc.getElementsByTagName('root').item(0);
	return(root);
}
function utGetXMLNodeValue(root, nodeName) {
	var retVal = "";
	if (root.getElementsByTagName(nodeName).item(0).firstChild != null)
		retVal = root.getElementsByTagName(nodeName).item(0).firstChild.data;
	return (retVal);
}
function utMakeAjaxRequest(url, whatToCallNext) {
	var http_request = false;
	url = utUrlAddQueryParam(url, "r1", utGenerateRandomNumber(1000));
	url = utUrlAddQueryParam(url, "r2", utGenerateRandomNumber(1000));

	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		glHndlError('Cannot create an XMLHTTP instance', '', '');
		return false;
	}
	if (whatToCallNext == undefined || whatToCallNext == '')
		http_request.onreadystatechange = function() { utHandleAjaxResponse(http_request); };
	else
		http_request.onreadystatechange = function() { utHandleAjaxResponse(http_request, whatToCallNext); };
	http_request.open('GET', url, true);
	http_request.send(null);
}

function utHandleAjaxResponse(http_request, whatToCallNext) {
	try {
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
				if (whatToCallNext != undefined && whatToCallNext != '') {
					var R = http_request.responseText;
					eval(whatToCallNext + "('" + utJSEncode(R) + "');");
				}
			} else {
				glHndlError('Util.js:utHandleAjaxResponse AJAX request could not be completed.', '', '');
			}
		}
	} catch(e) {
		glHndlError('Util.js:utHandleAjaxResponse Caught Exception: ' + e.description, '', '');
	}
}

////////////////////////////////////////////////////////////////////////////////////////
// Auto Complete
///////////////////////////////////////////////////////////////////////////////////////
function utAutoComplete(objF, valArr, forcematch) {
	if (objF.value == '') return;

	var found = false;
	for (var i = 0; i < valArr.length; i++) {
		if (valArr[i].toUpperCase().indexOf(objF.value.toUpperCase()) == 0) {
			found=true;
			break;
		}
	}

	if (objF.createTextRange) {
		if (forcematch && !found) {
			objF.value=objF.value.substring(0,field.value.length-1);
			return;
		}
		var cursorKeys =",8,46,37,38,39,40,33,34,35,36,45,";
		if (cursorKeys.indexOf(","+event.keyCode+",") < 0) {
			var r = objF.createTextRange();
			var oldValue = r.text;
			var newValue = found ? valArr[i] : oldValue;
			if (newValue != objF.value) {
				objF.value = newValue;
				var rNew = objF.createTextRange();
				rNew.moveStart('character', oldValue.length) ;
				rNew.select();
			}
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////
// Window size functions
///////////////////////////////////////////////////////////////////////////////////////
function utWindowGetSize() {
	var xWithScroll = 0;
	var yWithScroll = 0;
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}
	return [xWithScroll,yWithScroll];
}
function utWindowGetWidth() {
	return (utWindowGetSize()[0]);
}
function utWindowGetHeight() {
	return (utWindowGetSize()[1]);
}
//-----------------------------------------------------
function utWindowGetScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
function utWindowGetScrollX() {
	return(utWindowGetScrollXY()[0]);
}
function utWindowGetScrollY() {
	return(utWindowGetScrollXY()[1]);
}
//-----------------------------------------------------
function utWindowGetFrameSize() {
	var x = 0, y = 0;
	if (self.innerWidth) {
		x = self.innerWidth;
		y = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	} else if (document.body) {
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [ x, y ];
}
function utWindowGetFrameWidth() {
	return(utWindowGetFrameSize()[0]);
}
function utWindowGetFrameHeight() {
	return(utWindowGetFrameSize()[1]);
}
//-----------------------------------------------------
function utWindowGetObjectSize(obj) {
	var x = 0, y = 0;
	if( obj.clip ) {
		//Netscape compliant
		x = obj.clip.width;
		y = obj.clip.height;
	} else {
		x = obj.clientWidth;
		y = obj.clientHeight;
	}
	return [ x, y ];
}
function utWindowGetObjectWidth(obj) {
	return(utWindowGetObjectSize(obj)[0]);
}
function utWindowGetObjectHeight(obj) {
	return(utWindowGetObjectSize(obj)[1]);
}
//-----------------------------------------------------
function utWindowScroll(x, y) {
	if (document.documentElement && document.documentElement.scrollTop) {
		document.documentElement.scrollLeft = x;
		document.documentElement.scrollTop = y;
	} else if (document.body) {
		if (window.navigator.appName == 'Netscape')
			window.scroll(x, y);
		else {
			document.body.scrollLeft = x;
			document.body.scrollTop = y;
		}
	} else {
		window.scroll(x, y);
	}
}
//-----------------------------------------------------
function utWindowGetScrollXY() {
	var x = 0, y = 0;

	if (document.documentElement && document.documentElement.scrollTop) {
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	} else if (document.body) {
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	} else {
		x = 0;
		y = 0;
	}
	return [ x, y ];
}
function utWindowGetScrollX() {
	return(utWindowGetScrollXY()[0]);
}
function utWindowGetScrollY() {
	return(utWindowGetScrollXY()[1]);
}
//-----------------------------------------------------
function utFireEvent(obj, eventName) {
	obj.fireEvent('on' + eventName);
}
//-----------------------------------------------------
function utValidateTextArea(e) {
	var oT = utGetEventTarget(e, window.event);
	var maxChars = utGetAttribute(oT, "_maxChars");
	var m = 0;
	if (maxChars != null && maxChars != "")
		m = utParseInt(maxChars);
	if (m > 0) {
		if (oT.value.length > m) {
			alert('Textarea allows up to ' + m + ' characters.');
			oT.value = oT.value.substring(0, m);
		}
	}
}
//-----------------------------------------------------