// JavaScript Document
if( document.getElementById ) {
	getElemById = function( id ) {
		return document.getElementById( id );
	}
} else if( document.all ) {
	getElemById = function( id ) {
		return document.all[ id ];
	}
} else if( document.layers ) {
	getElemById = function( id ) {
		return document.layers[ id ];
	}
}

function GetXmlHttpObject()
{
	var http_request = false;

	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) {}
		}
	}

	return http_request; // will be false if unable to create
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

function charCountIndicator( input_id, display_id, max_count ) {
	var the_string = document.getElementById( input_id ).value;
	if( the_string.length > max_count) {
		document.getElementById( input_id ).value = the_string.substring(0,max_count);
		document.getElementById( display_id ).innerHTML = max_count;
		return false;
	}
	else
	{
		document.getElementById( display_id ).innerHTML = the_string.length;
		return true;
	}
}

function showhide_swap( id) {
	if ( getElemById( id ).style.display == 'none' ) {
		getElemById( id ).style.display = '';
	}
	else
	{
		getElemById( id ).style.display = 'none';
	}
}

function hide_elem( id) {
	if(getElemById( id ).style.display == '')
	{
		getElemById( id ).style.display = 'none';
		return true;
	}
	else
	{
		return false;	
	}
}

function show_elem( id) {
	if(getElemById( id ).style.display == 'none')
	{
		getElemById( id ).style.display = '';
		return true;
	}
	else
	{
		return false;	
	}
}
