// Grundlegende Funktionen und Tools

// Fehlermeldungen nur auf testserver zulassen, sonst unterdruecken
if (window.location.href.indexOf(".test") == -1  &&  window.location.href.indexOf("localhost") == -1) {
	onerror = new Function ("","return true");
}



/**
* Formular funktionen
*
* /param  name des Formulars
*/
function Form (name)
{
	this.name = name;

	/**
	* focus automatisch auf erstes Textfeld setzen
	*
	* /param  action die mitgesendet werden soll
	* /param  id die mitgesendet werden soll
	*/
	this.focus = function ()
	{
		var elements;

		if (top.scrollPos) {
			document.getElementsByTagName ('body')[0].scrollTop = top.scrollPos;
			top.scrollPos = 0;
		}

		for (var j=0; document.forms[j]; j++) {
			elements = document.forms[j].elements;
			for (var i=0; elements[i]; i++) {
				if (elements[i].type == "text") {
					elements[i].focus ();
					return;
				}
			}
		}
		
		if (top.focusElement) {
			document.getElementById (top.focusElement).scrollIntoView ();
			top.focusElement = "";
		}
	}
	
	/**
	* Formular absenden mit zus�tzlichen parametern
	*
	* /param  action die mitgesendet werden soll
	* /param  id die mitgesendet werden soll
	*/
	this.submit = function (action, id, rememberScrollPos)
	{
		this.set (action, id);
		document.forms[this.name].submit ();
		
		top.scrollPos = (rememberScrollPos) ? document.body.scrollTop : 0;
	}
	
	/**
	* Formular parameter setzen
	*
	* /param  action die mitgesendet werden soll
	* /param  id die mitgesendet werden soll
	*/
	this.set = function (action, id)
	{
		if (action) {
			document.forms[this.name].elements[this.name+"[action]"].value = action;
		}
		if (id) {
			document.forms[this.name].elements[this.name+"[id]"].value = id;
		}
	}
}

function newEvent (obj, event, aktion)
{
	if (obj.attachEvent)
		obj.attachEvent (event, aktion);
	else
		obj.addEventListener (event.substr (2), aktion, false);
}

/*
// findet ein Objekt
function objekt (objid)
{
	return document.getElementById (objid);
}

// Zeigt, verbirgt ein Objekt
function showObj (objid, sichtbar)
{
	var obj = objekt (objid);
	obj.style.visibility = sichtbar ? "visible" : "hidden";
}

// Setzt die Position eines Objektes (angabe von false als position �ndert den Wert nicht)
function posObj (objid, left, top)
{
	var obj = objekt (objid);
	if (!isNaN(String(left)))
		obj.style.left = left;
	if (!isNaN(String(top)))
		obj.style.top = top;
}

// Setzt den Inhalt eines Objektes (div-Tag)
function setObj( objid, text )
{
	var obj = objekt(objid);
	obj.innerHTML = text;
}

// Liest den Inhalt eines Objektes (div-Tag)
function getObj( objid )
{
	var obj = objekt(objid);
	return obj.innerHTML;
}
*/
