function UtilFunctions() 
{

    /**
     * is the browser IE?
     * @return true or false indicating if browser is IE
     * @type boolean
     */
    this.isIE = function() { return this.fIsIE; }

    /**
     * is the browser Safari?
     * @return true or false indicating if browser is Safari
     * @type boolean
     */
    this.isSafari = function() { return this.fIsSafari; }

    /**
     * is the browser Opera?
     * @return true or false indicating if browser is Opera
     * @type boolean
     */
    this.isOpera = function() { return this.fIsOpera; }

    /**
     * is the browser firefox?
     * @return true or false indicating if browser is firefox
     * @type boolean
     */
    this.isFirefox = function() { return this.fIsFirefox; }

    /**
     * given an event received by a keyboard input handler, get the character
     * @param {Event} e		event received by a keyboard input handler
     *
     * @return the character code of the character corresponding to the key
     * @type int
     */
    this.getCharFromEvent = function(e)
    {
	var cc = 0;
	if( e && e.which ) cc = e.which; // NS
	else if( e.keyCode ) cc = e.keyCode;
	return cc;
    }

    /**
     * insert/add a cell to table-row (method used depends on browser since
     * safari doesnt like the method that seems kkosher and works on both
     * firefox and IE - particularly if you have contents))
     *
     * @param 	{DOMElement_TR}  tr		the table row DOM element
     * @param   {DOMElement} contents 	object to add inside the td (null for no obj)
     * @param   {int} nCols	the column span
     * @param   {int} cellidx	the cell index (optional - add to end if not
     *				provided)
     */
    this.addTableCell = function(tr, contents, nCols, cellidx ) {
	if( cellidx == null ) cellidx = tr.cells.length;
	var td;
	// on safari, we create a td independently, insert the
	// contents and THEN append to tr - if we try the
	// insertCell approach it doesnt work well. For IE
	// only insertCell works. Firefox seems fine with
	// either.
	if( this.isSafari() ) {
	    td = document.createElement("td"); 
	    td.colSpan = nCols;
	    if( contents ) td.appendChild(contents);
	    if( !cellidx ) 
		tr.appendChild(td);
	    else
	    	tr.insertBefore(td,tr.cells[cellidx])
	}
	else {
	    td = tr.insertCell(cellidx);
	    td.colSpan = nCols;
	}
	if( !this.isSafari() )
	    if( contents ) td.appendChild(contents);
	return td;
    }

    /**
     * set the opacity
     * @param {DOMElement} elem	the element whose opacity should be set
     * @param {float} 	val 	a value between 0 and 1.0
     */
    this.setOpacity = function(elem, val) {
	if( this.isSafari() && val >= 1.0)
	    val = 0.999999;
	if( this.isIE() ) {
	    elem.style.filter = "alpha(opacity=" + parseInt(val*100) + ")";
	}
	else
	    elem.style.opacity = val;
    }

    /**
     * represents the user agent string (browser)
     * @private
     */
    this.userAgent = navigator.userAgent.toLowerCase();
    this.fIsIE = ((this.userAgent.indexOf("msie") >= 0 ) ? true : false);
    this.fIsSafari = ((this.userAgent.indexOf("safari") >= 0 ) ? true : false);
    this.fIsOpera = ((this.userAgent.indexOf("opera") >= 0 ) ? true : false);
    this.fIsFirefox = ((this.userAgent.indexOf("firefox") >= 0 ) ? true : false);

    /**
     * find a child node whose className is className
     * @type DOMElement
     */
    this._findNodeByClass = function(node, className) {
	if(!node ) return null;
	if( node.className && node.className == className)
	    return node;
	else if( !node.hasChildNodes || !node.hasChildNodes() )
	    return null;

	var c = node.firstChild;
	var n;
	while(c) {
	    n = this._findNodeByClass(c, className);
	    if( n ) return n;
	    c = c.nextSibling;
	}
	return  null;
    }

    /**
     * get the id map
     */
    this.getIdMap = function() { return this.fIdMap; }

    /**
     * get a new id for use in id-store of category "base"
     * @param	{String} base	category
     */
    this.getNewId = function( base ) {
	var o = this.fIdStore[base];
	if(o == null)
	    this.fIdStore[base] = 0;
	else
	    this.fIdStore[base] = o+1;
	o = this.fIdStore[base];
	return base + "_ " + o;
    }

    /**
     * add a dom-id <=> object element to the id store
     */
    this.addToIdMap = function(dom, obj) {
	if(dom.id)
	{
	    var o = new Object();
	    o.dom = dom;
	    o.obj = obj;
	    this.fIdMap[dom.id] = o;
	}
    }

    /**
     * given a dom elem, remove the associated dom-id <=> object element
     * from the id map
     */
    this.removeFromIdMap = function(dom)  {
	if(dom.id) {
	    this.removeFromIdMap2(dom.id);
	}
    }

    /**
     * given a dom id, remove the associated dom-id <=> object element
     * from the id map
     */
    this.removeFromIdMap2 = function(id)  {
	if(id) {
	    var o = this.fIdMap[id];
	    if( o ) this.fIdMap[id] = null;
	}
    }

    /**
     * get the view/related object for a dom elem if any by looking up
     * the dom-id <=> object id store
     */
    this.getObjForId = function(dom) {
	if(dom.id) {
	    var o = this.fIdMap[dom.id];
	    if( o ) return o.obj;
	}
	else
	    return null;
    }

    /**
     * clear the id store and id map that maintains map between DOM element ids
     * and view and related objects
     */
    this.clearIdStore = function() {
	if(this.fIdMap) {
	    var nMap = this.fIdMap.length;
	    for ( var i = 0; i < nMap; i++ ) {
		var o = this.fIdMap[o];
		if(o ) {
		    o.dom = null;
		    o.obj = null;
		}
	    }
	}
	this.fIdStore = new Array();
	this.fIdMap   = new Array();
    }

    /**
     * the id category store
     * @type String[]
     * @private
     */
    this.fIdStore = new Array();

    /**
     * the map of dom-id <=> view/related objects
     * @private
     */
    this.fIdMap   = new Array();

}
/**
 * @class
 * represents utility functions e.g. those related to browser specific
 * code
 */
@class
represents utility functions e.g. those related to browser specific
code
@class represents utility functions e . g . those related to browser specific code
function UtilFunctions() 
{
    this.isIE = function() { return this.fIsIE; }
    this.isSafari = function() { return this.fIsSafari; }
    this.isOpera = function() { return this.fIsOpera; }
    this.isFirefox = function() { return this.fIsFirefox; }
    this.getCharFromEvent = function(e)
    {
	var cc = 0;
	if( e && e.which ) cc = e.which; 
	else if( e.keyCode ) cc = e.keyCode;
	return cc;
    }
    this.addTableCell = function(tr, contents, nCols, cellidx ) {
	if( cellidx == null ) cellidx = tr.cells.length;
	var td;
	if( this.isSafari() ) {
	    td = document.createElement("td"); 
	    td.colSpan = nCols;
	    if( contents ) td.appendChild(contents);
	    if( !cellidx ) 
		tr.appendChild(td);
	    else
	    	tr.insertBefore(td,tr.cells[cellidx])
	}
	else {
	    td = tr.insertCell(cellidx);
	    td.colSpan = nCols;
	}
	if( !this.isSafari() )
	    if( contents ) td.appendChild(contents);
	return td;
    }
    this.setOpacity = function(elem, val) {
	if( this.isSafari() && val >= 1.0)
	    val = 0.999999;
	if( this.isIE() ) {
	    elem.style.filter = "alpha(opacity=" + parseInt(val*100) + ")";
	}
	else
	    elem.style.opacity = val;
    }
    this.userAgent = navigator.userAgent.toLowerCase();
    this.fIsIE = ((this.userAgent.indexOf("msie") >= 0 ) ? true : false);
    this.fIsSafari = ((this.userAgent.indexOf("safari") >= 0 ) ? true : false);
    this.fIsOpera = ((this.userAgent.indexOf("opera") >= 0 ) ? true : false);
    this.fIsFirefox = ((this.userAgent.indexOf("firefox") >= 0 ) ? true : false);
    this._findNodeByClass = function(node, className) {
	if(!node ) return null;
	if( node.className && node.className == className)
	    return node;
	else if( !node.hasChildNodes || !node.hasChildNodes() )
	    return null;
	var c = node.firstChild;
	var n;
	while(c) {
	    n = this._findNodeByClass(c, className);
	    if( n ) return n;
	    c = c.nextSibling;
	}
	return  null;
    }
    this.getIdMap = function() { return this.fIdMap; }
    this.getNewId = function( base ) {
	var o = this.fIdStore[base];
	if(o == null)
	    this.fIdStore[base] = 0;
	else
	    this.fIdStore[base] = o+1;
	o = this.fIdStore[base];
	return base + "_ " + o;
    }
    this.addToIdMap = function(dom, obj) {
	if(dom.id)
	{
	    var o = new Object();
	    o.dom = dom;
	    o.obj = obj;
	    this.fIdMap[dom.id] = o;
	}
    }
    this.removeFromIdMap = function(dom)  {
	if(dom.id) {
	    this.removeFromIdMap2(dom.id);
	}
    }
    this.removeFromIdMap2 = function(id)  {
	if(id) {
	    var o = this.fIdMap[id];
	    if( o ) this.fIdMap[id] = null;
	}
    }
    this.getObjForId = function(dom) {
	if(dom.id) {
	    var o = this.fIdMap[dom.id];
	    if( o ) return o.obj;
	}
	else
	    return null;
    }
    this.clearIdStore = function() {
	if(this.fIdMap) {
	    var nMap = this.fIdMap.length;
	    for ( var i = 0; i < nMap; i++ ) {
		var o = this.fIdMap[o];
		if(o ) {
		    o.dom = null;
		    o.obj = null;
		}
	    }
	}
	this.fIdStore = new Array();
	this.fIdMap   = new Array();
    }
    this.fIdStore = new Array();
    this.fIdMap   = new Array();
}
function UtilFunctions ( ) { this . isIE = function ( ) { return this . fIsIE ; } this . isSafari = function ( ) { return this . fIsSafari ; } this . isOpera = function ( ) { return this . fIsOpera ; } this . isFirefox = function ( ) { return this . fIsFirefox ; } this . getCharFromEvent = function ( e ) { var cc = 0 ; if ( e && e . which ) cc = e . which ; else if ( e . keyCode ) cc = e . keyCode ; return cc ; } this . addTableCell = function ( tr , contents , nCols , cellidx ) { if ( cellidx == null ) cellidx = tr . cells . length ; var td ; if ( this . isSafari ( ) ) { td = document . createElement ( "td" ) ; td . colSpan = nCols ; if ( contents ) td . appendChild ( contents ) ; if ( ! cellidx ) tr . appendChild ( td ) ; else tr . insertBefore ( td , tr . cells [ cellidx ] ) } else { td = tr . insertCell ( cellidx ) ; td . colSpan = nCols ; } if ( ! this . isSafari ( ) ) if ( contents ) td . appendChild ( contents ) ; return td ; } this . setOpacity = function ( elem , val ) { if ( this . isSafari ( ) && val >= 1.0 ) val = 0.999999 ; if ( this . isIE ( ) ) { elem . style . filter = "alpha(opacity=" + parseInt ( val * 100 ) + ")" ; } else elem . style . opacity = val ; } this . userAgent = navigator . userAgent . toLowerCase ( ) ; this . fIsIE = ( ( this . userAgent . indexOf ( "msie" ) >= 0 ) ? true : false ) ; this . fIsSafari = ( ( this . userAgent . indexOf ( "safari" ) >= 0 ) ? true : false ) ; this . fIsOpera = ( ( this . userAgent . indexOf ( "opera" ) >= 0 ) ? true : false ) ; this . fIsFirefox = ( ( this . userAgent . indexOf ( "firefox" ) >= 0 ) ? true : false ) ; this . _findNodeByClass = function ( node , className ) { if ( ! node ) return null ; if ( node . className && node . className == className ) return node ; else if ( ! node . hasChildNodes || ! node . hasChildNodes ( ) ) return null ; var c = node . firstChild ; var n ; while ( c ) { n = this . _findNodeByClass ( c , className ) ; if ( n ) return n ; c = c . nextSibling ; } return null ; } this . getIdMap = function ( ) { return this . fIdMap ; } this . getNewId = function ( base ) { var o = this . fIdStore [ base ] ; if ( o == null ) this . fIdStore [ base ] = 0 ; else this . fIdStore [ base ] = o + 1 ; o = this . fIdStore [ base ] ; return base + "_ " + o ; } this . addToIdMap = function ( dom , obj ) { if ( dom . id ) { var o = new Object ( ) ; o . dom = dom ; o . obj = obj ; this . fIdMap [ dom . id ] = o ; } } this . removeFromIdMap = function ( dom ) { if ( dom . id ) { this . removeFromIdMap2 ( dom . id ) ; } } this . removeFromIdMap2 = function ( id ) { if ( id ) { var o = this . fIdMap [ id ] ; if ( o ) this . fIdMap [ id ] = null ; } } this . getObjForId = function ( dom ) { if ( dom . id ) { var o = this . fIdMap [ dom . id ] ; if ( o ) return o . obj ; } else return null ; } this . clearIdStore = function ( ) { if ( this . fIdMap ) { var nMap = this . fIdMap . length ; for ( var i = 0 ; i < nMap ; i ++ ) { var o = this . fIdMap [ o ] ; if ( o ) { o . dom = null ; o . obj = null ; } } } this . fIdStore = new Array ( ) ; this . fIdMap = new Array ( ) ; } this . fIdStore = new Array ( ) ; this . fIdMap = new Array ( ) ; }
@class
 represents utility functions e.g.
@class represents utility functions e . g .
/**
     * is the browser IE?
     * @return true or false indicating if browser is IE
     * @type boolean
     */ /**
     * is the browser Safari?
     * @return true or false indicating if browser is Safari
     * @type boolean
     */ /**
     * is the browser Opera?
     * @return true or false indicating if browser is Opera
     * @type boolean
     */ /**
     * is the browser firefox?
     * @return true or false indicating if browser is firefox
     * @type boolean
     */ /**
     * given an event received by a keyboard input handler, get the character
     * @param {Event} e		event received by a keyboard input handler
     *
     * @return the character code of the character corresponding to the key
     * @type int
     */ // NS
 /**
     * insert/add a cell to table-row (method used depends on browser since
     * safari doesnt like the method that seems kkosher and works on both
     * firefox and IE - particularly if you have contents))
     *
     * @param 	{DOMElement_TR}  tr		the table row DOM element
     * @param   {DOMElement} contents 	object to add inside the td (null for no obj)
     * @param   {int} nCols	the column span
     * @param   {int} cellidx	the cell index (optional - add to end if not
     *				provided)
     */ // on safari, we create a td independently, insert the
 // contents and THEN append to tr - if we try the
 // insertCell approach it doesnt work well. For IE
 // only insertCell works. Firefox seems fine with
 // either.
 /**
     * set the opacity
     * @param {DOMElement} elem	the element whose opacity should be set
     * @param {float} 	val 	a value between 0 and 1.0
     */ /**
     * represents the user agent string (browser)
     * @private
     */ /**
     * find a child node whose className is className
     * @type DOMElement
     */ /**
     * get the id map
     */ /**
     * get a new id for use in id-store of category "base"
     * @param	{String} base	category
     */ /**
     * add a dom-id <=> object element to the id store
     */ /**
     * given a dom elem, remove the associated dom-id <=> object element
     * from the id map
     */ /**
     * given a dom id, remove the associated dom-id <=> object element
     * from the id map
     */ /**
     * get the view/related object for a dom elem if any by looking up
     * the dom-id <=> object id store
     */ /**
     * clear the id store and id map that maintains map between DOM element ids
     * and view and related objects
     */ /**
     * the id category store
     * @type String[]
     * @private
     */ /**
     * the map of dom-id <=> view/related objects
     * @private
     */