	var confirmtext = "";
	var inserttext = "NULL";
	var insertpushed = false;
	var returnflag = true;
	
	function check()
	{
		if(this.insertpushed == true)
		{
			this.insertpushed = false;
			if(this.inserttext == "NULL")
			{
				alert("Vorher muss ein Element ausgewählt werden!");
				return(false);
			}
			else
			{	
				this.inserttext = "NULL";
				return(true);
			}
		}
		else
		// falls immer false sein soll
		if(this.confirmtext == "false")
		{
			this.confirmtext = "";
			
			if( this.alerttext != "")
			{
				alert( this.alerttext);
				this.alerttext = "";
			}
			return(false);
		}
		else
		if(this.confirmtext != "")
		{
			temp = this.confirmtext;
			this.confirmtext = "";
			
			// wenn true gefordert, dann normal zurückgeben
			if( this.returnflag )
			{
				return(confirm(temp));
			}
			else
			{
				return(!confirm(temp));
			}
		}
		else
		{
			return(true);
		}
	}

	function checkForLogout()
	{
		if(textEl)		
		{
			activate('Wollen Sie sich wirklich ausloggen? Eventuell geänderte Daten wurden nicht gespeichert!');
		}
	}
	
	function activate(val)
	{
		this.returnflag = true;
		this.confirmtext = val;
	}
	
	function deactivate(val)
	{
		this.returnflag = false;
		this.confirmtext = val;
	}

	function alertfalse(alerttext)
	{
		this.confirmtext = "false";
		this.alerttext = alerttext;
	}

	function checkInsert(val)
	{
		// alert(val);
		this.inserttext = val;
		this.insertpushed = true;
	}
	

	function confirmChange(formname)
	{
		// if( document.getElementById(formname) )
		if( document.forms[0] )
		{
			// document.getElementById(formname).submit();	
			document.forms[0].submit(); // HACK
			//document.getElementById('preandeditview').click(); // HACK
			return true;
		}
		else
		{
			// alert('kein Formular mit Namen '+formname+' gefunden');
			return false;
		}
	}
