/**/
<!--
function setFocus( elemId ) {
    getElement( elemId ).focus( )
}

function selectAll( elemId ) {
    getElement( elemId ).select( )
}

function hideElement( elemId ) {
    getElement( elemId ).style.visibility = "hidden"
}

function showElement( elemId ) {
    getElement( elemId ).style.visibility = "visible"
}

function capitalizeMe( val ) {
	newVal = '';
	val = val.split(' ');
	for(var c=0; c < val.length; c++) {
		newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' ';
	}
	return newVal
}

function trim(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function showDialog( url, name, w, h) { 
	props = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no"
	coords = calculateToCenterInScreen( w, h )
	return createWindow( url, name, coords[ 0 ], coords[ 1 ], w, h, props )
}

function createWindow( url, name, x, y, w, h, props) { 
   var _props = "width=" + w + ", height=" + h + ", left=" + x + ", top=" + y
   if ( props != null && props.length > 0 ) {
   		_props += ", " + props
   }
   var _window = window.open(url, name, _props)
   return _window
}

function calculateToCenterInScreen( w, h ) {
	var x = ( screen.width - w ) / 2;
    var y = ( screen.height - h ) / 2;
    return new Array( x, y )
}

function calculateToCenterWindow( w, h ) {
	var x = 0;
	var y = 0;

  	var myWidth = 0, myHeight = 0;
  	if( typeof( window.innerWidth ) == 'number' ) {
    	//Non-IE
    	myWidth = window.innerWidth;
    	myHeight = window.innerHeight;
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
  	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    	//IE 4 compatible
    	myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
  	}
  	x = ( myWidth - w ) / 2;
  	y = ( myHeight - h ) / 2;
	return new Array(x,y);
}

function showErr( id, err ) {
	alert( "Error\nID:[" + id + "]\n" + "Message:[" + err + "]" )
}

function findPosX( obj ) {
	var curleft = 0;
    if(obj.offsetParent) {
        while(1) {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent) {
            break;
          }
          obj = obj.offsetParent;
        }
    }
    else if(obj.x) {
        curleft += obj.x;
    }
    return curleft;
}

function findPosY( obj ) {
	var curtop = 0;
    if(obj.offsetParent) {
        while(1) {
          curtop += obj.offsetTop;
          if(!obj.offsetParent) {
            break;
           }
          obj = obj.offsetParent;
        }
    }
    else if(obj.y) {
        curtop += obj.y;
    }
    return curtop;
}

function whichElement( event ) {
	var targ
	if ( !event ) {
		var event = window.event
	}
	if ( event.target ) {
		targ = event.target
	}
	else if ( event.srcElement ) {
		targ = event.srcElement
	}
	// defeat Safari bug
	if ( targ.nodeType == 3 ) {
   		targ = targ.parentNode
   	}
   	return targ
}

function getElementPosition( id ) {
        var offsetTrail = getElement( id );
        var offsetLeft = 0;
        var offsetTop = 0;
        while (offsetTrail) {
            offsetLeft += offsetTrail.offsetLeft;
            offsetTop += offsetTrail.offsetTop;
            offsetTrail = offsetTrail.offsetParent;
        }
        if (navigator.userAgent.indexOf("Mac") != -1 && 
            typeof document.body.leftMargin != "undefined") {
            offsetLeft += document.body.leftMargin;
            offsetTop += document.body.topMargin;
        }
        //alert( "A:" + left:offsetLeft + " : " + top:offsetTop );
        return {left:offsetLeft, top:offsetTop};
}

function setImageSrc( elemId, source ) {
	try {
		var now = new Date( )
		getElement( elemId ).src = source + '?' + now.getTime();
	}
	catch( err ) {
		alert( "Error\n[setImageSrc]\n[" + err + "]" )
	}
}

function getSelectedValue(  element_id ) {
        var elem = getElement( element_id )
        if ( isElementOfType( type.selectone,  elem ) ) {
		  return elem.options[ elem.selectedIndex ].value
		}
		return null
}

function setSelected( element_id, value ) {
	var list = getElement( element_id )
	var length = list.length
	var option
	for ( i = 0; i < length; i++ ) {
		option = list.options[ i ]
		if ( option.value == value ) {
				option.selected = true;
				break
		}
	}
}

function countChar( id ) {
    var elem = getElement( id )
    if ( isElementOfType( type.textarea, elem ) || isElementOfType( type.text, elem ) ) {
	   return elem.value.length
	}
	return 0
}

function isElementOfType( type, element ) {
    return element.type == type
}

function createArrayOfFormElementsValues( theForm ) {
	var element
	var length = theForm.elements.length
	var values = new Array( )
	for ( i = 0; i < length; i++ ) {
		element = theForm.elements[i]
		//alert("value=" + element.value + ", name=" + element.name + ", type=" + element.type)
		if ( element.type == type.checkbox ) {
			if ( element.checked ) {
				value = 1
			}
			else {
				value = 0
			}
		}
		else {
			value = element.value
		}
		
		if ( i > 0 ) { 
			values[ i ] = "&" + element.name + "=" + escape( value )
		}
		else {
			values[ i ] = element.name + "=" + escape( value )
		}
	}
	return values
}

function createQueryStringOfFormElementsValues( theForm ) {
    var values = createArrayOfFormElementsValues( theForm )
    var qstring = ""
	for( i = 0; i < values.length; i++ ) {
		if ( values[ i ] ) {
			qstring += values[ i ]
		}
	}
	return qstring
}

function getElement( id ) {
    return document.getElementById( id )
}

function writeInnerHtml( element_id, html ) {
	getElement( element_id ).innerHTML = html 
}

function getInnerHtml( element_id ) {
	return getElement( element_id ).innerHTML
}

function ElementType( ) {
    this.selectone = "select-one"
    this.selectmultiple = "select-multiple"
    this.textarea = "textarea"
    this.text = "text"
    this.checkbox = "checkbox"
    this.radiobutton = "radiobutton"
}

var type = new ElementType( );

/*
	This is used to animate a loading message. This is used primarly for http calls (ajax). Ideally
	I would like to put this functionallity into an object but to this point when ever I try I run out
	of memory when that object is called.
	*/
var load_timer_id = 0;
var load_msg
var load_msg_elem_id
var load_step = -1
var load_tag_props
var load_tag_props_default ='text-align:left;margin-top:25px;font-weight:bold;font-size:14px'

function UpdateLoadMessage() {
   if(load_timer_id) {
      clearTimeout(load_timer_id);
      clockID  = 0;
   }

	load_step += 1
	
	if ( load_step > 6 ) {
		load_step = 0
	}
	
	lbl = ""
	for( i = 0; i < load_step; i++ ) {
		lbl += "."
	}
	
   writeInnerHtml( load_msg_elem_id, "<div " + load_tag_props + ">" + load_msg + lbl + "</div>" )
   
   load_timer_id = setTimeout("UpdateLoadMessage()", 250);
}

function ShowLoadMessage( element_id, message, addtionalload_tag_props ) {
	ShowLoadMessageWithInitialDelay( element_id, message, addtionalload_tag_props, 250 );
}

function ShowLoadMessageWithInitialDelay( element_id, message, addtionalload_tag_props, initDelay ) {
	 if ( load_msg_elem_id ) {
   		writeInnerHtml( load_msg_elem_id, "" )
   }
	load_msg_elem_id = element_id
	load_msg = message
   	load_step = -1
   	if ( addtionalload_tag_props != null ) {
   		load_tag_props = addtionalload_tag_props
   	} else {
   		load_tag_props = load_tag_props_default
   	}
   	writeInnerHtml( load_msg_elem_id, "<div " + load_tag_props + "></div>" )
   	load_timer_id  = setTimeout("UpdateLoadMessage()", initDelay);
}

function StopLoadMessage() {
   if(load_timer_id) {
      clearTimeout(load_timer_id);
      load_timer_id  = 0;
   }
   load_msg_elem_id = null;
}

function PageQuery( url ) {
	
	this.q = url.split( "?" );
	
	if( this.q.length > 1 ) {
		this.q = this.q[ 1 ];
	}
	else {
		this.q = null;
	}
	
	this.keyValuePairs = new Array();
	
	if( this.q ) {
	 	for( var i=0; i < this.q.split( "&" ).length; i++ ) {
	 		this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	
	this.getKeyValuePairs = function() { 
		return this.keyValuePairs; 
	}
	
	this.getValue = function(s) {
		for( var j=0; j < this.keyValuePairs.length; j++ ) {
			if( this.keyValuePairs[ j ].split( "=" )[ 0 ] == s )
				return this.keyValuePairs[ j ].split( "=" )[ 1 ];
			}
			return false;
		}
		
	this.getParameters = function() {
		var a = new Array( this.getLength( ) );
			for( var j=0; j < this.keyValuePairs.length; j++ ) {
				a[ j ] = this.keyValuePairs[ j ].split( "=" )[ 0 ];
			}
			return a;
		}
		
	this.getLength = function() { 
		return this.keyValuePairs.length; 
	} 
}

function queryString( key ) {
	var page = new PageQuery( window.location + "" ); 
	var value = page.getValue( key );
	if ( ! value ) {
		return value;
	}
	else {
		return unescape( value );
	}
}

-->

