

<!-- script -->
<!--

document.loading = true;


function imageByName(name)
{
	var		img;
	if( ! document.images  ) return(null);
	for(img = 0; img < document.images.length; img++)
	{
		if(document.images[img].name == name)
			return(document.images[img]);
	}

	return(null);
}

function elementByName(form, name)
{
	var		elem, element;

	for(elem = 0; elem < form.elements.length; elem++)
	{
		element = form.elements[elem];

		if(element.name == name)
		{
			return(element);
		}
	}

	return(null);
}

function getElementValue(element)
{
	var		value;

//	alert("getElementValue");

	if(element.value)
	{
		value = element.value;
	}
	else 	if(element.type.substring(0,6) == "select")
	{
		value = element.options[element.selectedIndex].value;
	}
	else 
	{
		value = "";
	}

	return(value);
}

function selectValue(element, value)
{
	var		itemno;

	for(itemno = 0; itemno < element.length; itemno++)
	{

		if(element.options[itemno].value == value)
			element.options[itemno].selected =true;

	}

	return(value);
}

function getFormValue(form, name)
{
	var		element, value;

	if((form == null) ||
	   ((element = elementByName(form, name)) == null))
	{
		return(null);
	}

	value = getElementValue(element);
	return(value);
}


function itemNotDefined(name)
{
	alert("Item '" + name + "' not defined.");
}

//
// Loading used to control interface clicks before all data available
//
function Loading(status)
{
	if(status != null)
	{
		document.loading = status;
		return(status);
	}

	if(document.loading)
	{
		alert("Document is still loading!");
		return(true);
	}

	return(false);
}


function Hash()
{
	this.token	= new Array();

	Hash.prototype.getValue			= Hash_getValue;
	Hash.prototype.setValue			= Hash_setValue;
	Hash.prototype.getKeys			= Hash_getKeys;
}

function Hash_getValue(name)
{
	var		item, string;

	for(item = 0; item < this.token.length; item++)
	{
		string = this.token[item];

		if((delim = string.indexOf(name + "~")) != -1)
		{
			return(string.substring(delim + name.length + 1, string.length));
		}
	}

	return(null);
}

function Hash_setValue(name, value)
{
	var		item, string;

	for(item = 0; item < this.token.length; item++)
	{
		string = this.token[item];

		if((delim = string.indexOf(name + "~")) != -1)
		{
			this.token[item] = name + "~" + value;

			return;
		}
	}

	this.token[item] = name + "~" + value;
}

function Hash_getKeys()
{
	var		item, string, keys;

	keys = new Array();

	for(item = 0; item < this.token.length; item++)
	{
		string = this.token[item];

		if((delim = string.indexOf("~")) != -1)
		{
			keys[item] = string.substring(0, delim);
		}
	}

	return(keys);
}



function MImage(image)
{
	this.name	= new Array();
	this.src	= new Array();
	this.state	= '';

	this.image = image;

	MImage.prototype.addState			= MImage_addState;
	MImage.prototype.setState			= MImage_setState;
	MImage.prototype.refresh			= MImage_refresh;
}



function MImage_addState(name, src)
{
	var		imgno;

	for(imgno = 0; imgno < this.name.length; imgno++)
	{
		if(this.name[imgno] == null)
			break;
	}

	this.name[imgno]	= name;
	this.src[imgno]		= src;
}



function MImage_setState(name, src)
{
	var		imgno;

	//alert("setState: " + name + " src=" + src);

	for(imgno = 0; imgno < this.name.length; imgno++)
	{
		if(this.name[imgno] == name)
			break;
	}


	if(imgno == this.name.length)
	{
		alert("MImage.setState: " + name + " not found");
	}

	if(this.name[imgno] == null)
	{
		this.name[imgno]	= name;
		this.src[imgno]		= src;
	}
	if(this.image != null)
	{
		this.image.src = this.src[imgno];
	}

	this.state = name;
}




function MImage_refresh()
{
	this.setState(this.state);
}





function getboolean(formel)

{

	var 		flag;


	{
		if( (formel.type == 'checkbox') || (formel.type == 'radio')  )
	{
			flag = formel.checked;
//	alert ('getflag' + formel.checked)
	}
		else if ( formel.type == 'text' || formel.type == 'hidden' )	
			flag = (formel.value == 'true' );
	}

	return(flag);

}


function setboolean(formel, status)

{

	var 		flag;

	{
		if( (formel.type == 'checkbox') || (formel.type == 'radio')  )
	{

		formel.checked=status;

//	alert ('setflag' + formel.checked) ;
	}

		else if ( formel.type == 'text' || formel.type == 'hidden' )	
		
		formel.value=status;
	}


}



//-->

<!-- /script -->
