<!--
var current;
var infoboxid;
var neu = null;
var changed=false; // Flag, ob die Suchbegriffe veraendert wurden

// Noneditable variables
var navi;			// Count on layerelements
var offset = 21;	// Width of one colum

var ie = document.all ? true : false;
var ns = document.layers ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function fixNetscape() {
	if (!LyrObj("fixnetscape")) document.location.reload();
}

function initonload() {
	load = true;
	if (ie) {
		if (navigator.platform.match("Mac")) {
//			screenwidth = Math.floor(document.body.offsetWidth/2-530);
			screentop = 106;
		}
		else {
//			screenwidth = Math.floor(document.body.offsetWidth/2-542);
			screentop = 106;
		}
	}
	else {
//		screenwidth = Math.floor(document.body.offsetWidth/2-531);
		screentop = 106;
	}
	screenwidth = 1
	if (document.layers) { // Netscape
	    document.captureEvents(Event.MOUSEMOVE);
	    document.onmousemove = captureMousePosition;
	} else if (document.all) { // Internet Explorer
	    document.onmousemove = captureMousePosition;
	} else if (document.getElementById) { // Netcsape 6
	    document.onmousemove = captureMousePosition;
	}
	resetall();
}

/*
 * resetfunction to disable all layers
*/
function resetall() {
	oldspace = screenwidth;
	var spacer = offset;
	spacer = (document.body.clientWidth - 930)/2;
	for (i=0;i<navi;i++) {
		b = new LyrObj("layer"+i);
		document.getElementById("layer"+i).style.filter = "alpha(opacity="+fadefrom+")";
		document.getElementById("layer"+i).style.opacity = "."+fadefrom+"";

		b.setPos("left", spacer);
		b.setPos("top", screentop);
		b.setVisibility(false);
		c = new LyrObj("naviblock"+i);
		spacer += c.getWidth()+1;
		if (i != activelyr)
		{
			setbackground("layer"+i, "#BBCACD", "#ffffff");
		}
	}
	screenwidth = oldspace;
}

//  Steiler Contructor
function LyrObj(lyrName) {
	
	function LyrObjGetRef(layerName){
		if (ns) return eval("document." + layerName);
		if (ie) return eval("document.all." + layerName);
		if (ns6) return document.getElementById(layerName);
	}
	
	function LyrObjGetPos(which) {
		if (ns) {
			return this.ref[which];
		}
		if (ie || ns6){
			return this.ref[which].split("px")[0];
		}
	}	
	
	function LyrObjSetPos(which, pos) {
		this.ref[which] = pos;
	}
	
	
	function LyrObjGetClip(which) {
		if (ns) { return this.ref.clip[which]; }
		
		if (ie || ns6){
			var myclip = this.ref.clip;
			myclip = myclip.replace(/,/g,"");
			var clipPos = myclip.split("rect(")[1].split(")")[0].split("px");
			switch (which) {
				case "top" : return Number(clipPos[0]);
				case "right" : return Number(clipPos[1]);
				case "bottom" : return Number(clipPos[2]);
				case "left" : return Number(clipPos[3]);
			}
		}
	}
	
	function LyrObjSetClip(top, right, bottom, left){
		if (ns){
			this.ref.clip.top = top;
			this.ref.clip.right = right;
			this.ref.clip.bottom = bottom;
			this.ref.clip.left = left;
		}
		if (ie || ns6)
			this.ref.clip = "rect(" + top +"px " + right +"px " + bottom +"px " + left +"px)";
	}
	
	function LyrObjGetVisibility() {
		if (this.ref.visibility == "visible" || this.ref.visibility == "show")
			return true;
		else
			return false;
	}
	
	function LyrObjSetVisibility(visible){
		if (ns)
			this.ref.visibility = visible ? "show" : "hide";
	
		if (ie || ns6)
			this.ref.visibility = visible ? "visible" : "hidden";
	}
	
	
	function LyrObjGetzIndex() {
		return this.ref.zIndex;
	}
	
	function LyrObjSetzIndex(zIndex){
		this.ref.zIndex = zIndex;
	}
	
	function LyrObjSetText(what){
		if (ie){
			this.ref = LyrObjGetRef(lyrName);
			this.ref.innerHTML = what;
			this.ref = LyrObjGetRef(lyrName).style;
		}
		if (ns){
			this.ref.document.open();
			this.ref.document.write(what);
			this.ref.document.close();
		}
	}
	
	function LyrObjGetHeight() {
		if (ie || ns6){
			this.ref = LyrObjGetRef(lyrName);
			var height = this.ref.offsetHeight;
			this.ref = LyrObjGetRef(lyrName).style;
			return height;
		}
		if (ns){
			return "";
		}
	}

	function LyrObjGetWidth() {
		if (ie || ns6){
			this.ref = LyrObjGetRef(lyrName);
			var width = this.ref.offsetWidth;
			return width;
			this.ref = LyrObjGetRef(lyrName).style;
		}
		if (ns){
			return "";
		}
	}


	this.ref = ns ? LyrObjGetRef(lyrName) : LyrObjGetRef(lyrName).style;
	
	this.getPos = LyrObjGetPos;
	this.setPos = LyrObjSetPos;
	
	this.getClip = LyrObjGetClip;
	this.setClip = LyrObjSetClip;
	
	this.getVisibility = LyrObjGetVisibility;
	this.setVisibility = LyrObjSetVisibility;
	
	this.getzIndex = LyrObjGetzIndex;
	this.setzIndex = LyrObjSetzIndex;

	this.setText = LyrObjSetText;

	this.getHeight = LyrObjGetHeight;
	this.getWidth = LyrObjGetWidth;

	return this;
}

if (!suchfenster) {
	var suchfenster;
}

function seite(url)
{
    document.location.href= url;
}

function popup_einfach (url,windowname,xsize,ysize)
{
    if (neu != null)
    {
        if (neu.closed != true)
        {
            neu.window.close();
        }
    }
    neu = window.open(url,windowname,'scrollbars,resizable,width='+xsize+',height='+ysize+'');
    if (navigator.appName == "Microsoft Internet Explorer")
    neu.moveTo((screen.width-xsize)/2,100);
}

function popup_vollbild (url,windowname,xsize,ysize)
{
    if (neu != null)
    {
        if (neu.closed != true)
        {
            neu.window.close();
        }
    }
    neu = window.open(url,windowname,'scrollbars,resizable,width='+xsize+',height='+ysize+'');
    if (navigator.appName == "Microsoft Internet Explorer")
    neu.moveTo((screen.width-xsize)/2,100);
}

function popup_nocontrol(url,windowname,xsize,ysize)
{
    if (neu != null)
    {
        if (neu.closed != true)
        {
            neu.window.close();
        }
    }
    neu = window.open(url,windowname,'resizable,width='+xsize+',height='+ysize+'');
    if (navigator.appName == "Microsoft Internet Explorer")
    neu.moveTo((screen.width-xsize)/2,100);
}

function popup_scroll(url,windowname,xsize,ysize)
{
    if (neu != null)
    {
        if (neu.closed != true)
        {
            neu.window.close();
        }
    }
    neu = window.open(url,windowname,'scrollbars,resizable,width='+xsize+',height='+ysize+'');
    neu.moveTo((screen.width-xsize)/2,100);
}

function popup_fullscreen(url, windowname)
{
var str = "left=0,screenX=0,top=0,screenY=0";
    if (window.screen)
    {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;
        str += ",height=" + ah;
        str += ",width=" + aw;
        str += ",scrollbars,resizable,location,menubar,status,tiltebar,toolbar";
    }
    neu =  window.open(url, windowname, str);
    neu.moveTo(0,0);
    neu.focus();
}

function showinfobox(id) {
	if (infoboxid) {
		document.getElementById("infobox"+infoboxid).style.display = "none";
	}
	if (id) {
		document.getElementById("infobox"+id).style.display = "block";
	}
	infoboxid = id;
}

function suchen() {
	if (!suchfenster || suchfenster.closed || changed) {
		mysuche = escape(document.suche.suchfeld.value);
		suchfenster = window.open("./pop_suche_fs.php?suchbegriffe="+mysuche,"suchen","width=616,height=500");
		
		if (navigator.appName == "Microsoft Internet Explorer") {
			suchfenster.moveTo((screen.width-616)/2,100);
		}
		if (!suchfenster.opener) {
			suchfenster.opener=window;
		}
	}
	else if (suchfenster.focus) {
		suchfenster.focus();
	}
}
  
function required (formname)
{
    var feldname=new RegExp("^"+formname+"_*","gi");
    var ok=true;
    for (i=0;i<document.formular.length;i++)
    {
        if (document.formular[i].name.match(feldname)==(formname+"_"))
        {
            if (document.formular[i].name.match(/_required$/gi)) // Feld required
            {
                if (document.formular[i].type=="checkbox")
                {
                    if (document.formular[i].checked==false)
                    {
                        ok=false;
                    }
                }
                else if (document.formular[i].type=="radio")
                {
                    var radioname = document.formular[i].name;
                    var radiook = false;
                    var radiolength=eval("document.formular."+radioname+".length");
                    for (i2=0;i2<radiolength;i2++)
                    {
                        radiook = radiook || (eval("document.formular."+radioname+"["+i2+"].checked"));
                    }
                    if (radiook==false)
                    {
                        ok=false;
                    }
                }
                else if (document.formular[i].type.match(/^select/gi))
                {
                    if ((document.formular[i].value=="undefined") || (document.formular[i].value==""))
                    {
                        ok=false;
                    }
                }
				else if (document.formular[i].name.match(/mail/gi) == "mail") {
					 var mail = document.formular[i].value;
					 if (mail.search(/^[_a-z0-9A-Z+-]+(\.[_a-z0-9A-Z+-]+)*@[a-z0-9A-Z-]+(\.[a-z0-9A-Z-]+)$/) == -1)
						ok = false;
				}
                else
                {
                    if (document.formular[i].value=="")
                    {
                        ok=false;
                    }
                }
            }
        }
    }
    if (ok==false)
    {
        alert ("Sie haben leider nicht alle zur Bearbeitung notwendigen Angaben gemacht,\nbitte versuchen Sie es noch einmal.");
    }
    return ok;
}

function formular_auswerten(name)
{
    var split=name.split("|");
    for (var i=split.length;i<4;i++)
    {
        split.push("");
    }
    var formname=split[0];

    if (required(formname))
    {
        var empfaenger=split[1];
        var subject=split[2];
        var absender=split[3];

        var feldname=new RegExp("^"+formname+"_*","gi");

        var name;
        var str="formularname="+escape(formname)+"&";
        str += "&empfaenger="+empfaenger;
        str += "&subject="+subject;
        str += "&absender="+absender;
        str += "&";
        for (i=0;i<document.formular.length;i++)
        {
            if (document.formular[i].name.match(feldname)==(formname+"_"))
            {

                name=document.formular[i].name.replace(feldname,"");
                name=name.replace(/_required$/gi,"");
                if ((document.formular[i].type=="radio") || (document.formular[i].type=="checkbox"))
                {
                    if (document.formular[i].checked==true)
                    {
                        str+= name+"="+escape(document.formular[i].value)+"&";
                    }
                }
                else if (document.formular[i].type.match(/^select/gi))
                {
                    var selectname = document.formular[i].name;
                    str+= name+"="+escape(eval("document.formular."+selectname+"[document.formular."+selectname+".selectedIndex].value"))+"&";
                }
                else
                {
                    str+= name+"="+escape(document.formular[i].value)+"&";
                }
            }
        }
        popup_nocontrol ("./formularauswertung.php?"+str,"mail",400,200);
    }
}

function formular_auswertung(name)
{
    var split=name.split("|");
    for (var i=split.length;i<4;i++)
    {
        split.push("");
    }
    var formname=split[0];

    if (required(formname))
    {
        var empfaenger=split[1];
        var subject=split[2];
        var absender=split[3];

        var feldname=new RegExp("^"+formname+"_*","gi");

        var name;
        var str="formularname="+escape(formname)+"&";
        str += "&empfaenger="+empfaenger;
        str += "&subject="+subject;
        str += "&absender="+absender;
        str += "&";
        for (i=0;i<document.formular.length;i++)
        {
            if (document.formular[i].name.match(feldname)==(formname+"_"))
            {

                name=document.formular[i].name.replace(feldname,"");
                name=name.replace(/_required$/gi,"");
                if ((document.formular[i].type=="radio") || (document.formular[i].type=="checkbox"))
                {
                    if (document.formular[i].checked==true)
                    {
                        str+= name+"="+escape(document.formular[i].value)+"&";
                    }
                }
                else if (document.formular[i].type.match(/^select/gi))
                {
                    var selectname = document.formular[i].name;
                    str+= name+"="+escape(eval("document.formular."+selectname+"[document.formular."+selectname+".selectedIndex].value"))+"&";
                }
                else
                {
                    str+= name+"="+escape(document.formular[i].value)+"&";
                }
            }
        }
//        ajax_load("anfragemail", "./formularauswertung.php?"+str);
        ajax_load("anfragemail", str);
    }
}

function popup_kontakt()
{
  window.open('kontakt.php','kontakt','width=794,height=515');
}

function popup_popup(url,windowname,xsize,ysize)
{
    var popupwinres;
    if (popupwinres != null)
    {
        if (popupwinres.closed != true)
        {
            popupwinres.window.close();
        }
    }
    popupwinres = window.open(url,windowname,'scrollbars=yes,resizable,width='+xsize+',height='+ysize+'');
    popupwinres.moveTo((screen.width-xsize)/2,100);
}

function changeAnzeigeBild(bildID)
{
  document.getElementById("anzeigeBild").innerHTML = "<img src=\"./vfs_showpic.php?id=" + bildID + "&xsize=235\" style=\"border:1px solid #C4C1BC\" onmouseover=\"javascript:setcontent(" + bildID + ")\" onmouseout=\"javascript:closecontent(" + bildID + ")\">";
}

function setcontent(object)
{
	var value = object;
	if (value)
	{
		if (current)
			document.getElementById(current).style.visibility="hidden";
		document.getElementById(value).style.visibility="visible";
		current = value;
	}
	else
	{
		if (current)
			document.getElementById(current).style.visibility="hidden";
	}
}

function closecontent (object)
{
	var value = object;
	document.getElementById(value).style.visibility="hidden";
}

// aendert die Icons, von Aktiv in Inaktiv
function chgAktivInaktiv(id)
{
	var obj = document.getElementById("addAnfrage"+id);
	if (obj)
	{
		document.getElementById("addAnfrage"+id).innerHTML = "<span id='greyColor'>Bereits ausgew&auml;hlt</span>";
	}
}

// war eigentlich gedacht als PopUp, wenn man die Seite verlaesst, das noch Artikel in der Anfrageliste sind
function chkAnfrageliste()
{
	if (absolutCount != 0)
	{
		popup_scroll('anfrageListeReminder.php', 'Reminder', 400, 400);
	}
}

function eingabefeld_aktion(objekt, wenn, dann) {
	if(objekt.value == wenn) {
		objekt.value = dann;
	}
}

function bild_wechsel(nr, anz)
{
	for(i=1; i<=anz; i++)
	{
		if(nr != i)
		{
			document.getElementById('bild_vorschau'+i).style.display = 'none';
		}
		else
		{
			document.getElementById('bild_vorschau'+i).style.display = 'block';
		}
	}
}

function tab_wechsel(nr)
{
	for(i=0; i<tab_anzahl; i++)
	{
		if(nr != i)
		{
			document.getElementById('reiter_'+i).className = 'tab_inaktiv';
			document.getElementById('tab_content_'+i).style.display = 'none';
		}
		else
		{
			document.getElementById('reiter_'+i).className = 'tab_aktiv';
			document.getElementById('tab_content_'+i).style.display = 'block';
		}
	}
}

function bildwechsel(dateiname, obj_id)
{
	if(obj_id==undefined)
	{
		obj_id = "anfahrt_skizze";
	}
	document.getElementById(obj_id).src = dateiname;
}

function changeBlankoImage(lang)
{
	if(document.getElementById("blanco_rows_id").value == '0')
		document.getElementById("label_img_id").src = '../picts/etickets_1.png';
	if(document.getElementById("blanco_rows_id").value == '1')
		document.getElementById("label_img_id").src = '../picts/etickets_4.png';
	if(document.getElementById("blanco_rows_id").value == '2')
		document.getElementById("label_img_id").src = '../picts/etickets_9.png';
	if(document.getElementById("blanco_rows_id").value == '3')
		document.getElementById("label_img_id").src = '../picts/etickets_16.png';
}


// AJAX
var xMousePos = 0; // Horizontal position of the mouse on the screen
var yMousePos = 0; // Vertical position of the mouse on the screen
var http_request = false;
var timer;
document.onmousemove = captureMousePosition;

function captureMousePosition(e)
{
    if (document.all)
	{
        xMousePos = window.event.x + document.body.scrollLeft;
        yMousePos = window.event.y + document.body.scrollTop;
    }
	else
	{
        xMousePos = e.pageX;
        yMousePos = e.pageY;
    }

	// wenn die Glossarbox existiert, dann wird sie am Mauszeiger positionieren
	if(document.getElementById("glossartext")) {
		document.getElementById("glossartext").style.left = xMousePos + 10 + "px";
		document.getElementById("glossartext").style.top = yMousePos - document.getElementById("glossartext").offsetHeight + "px";
	}
}

function glossar_aus()
{
	timer = setTimeout( "glossar_ausblenden()", 500 );
}

function glossar_ausblenden()
{
	document.getElementById("glossartext").style.display = "none";
}

function inhalt(id_name)
{
    if (http_request.readyState == 4)
	{
        if (http_request.status == 200)
		{
            var text   = http_request.responseText;
            document.getElementById(id_name).innerHTML = text;
			div_height("navigation_links", "drei_spalten_rechts");
        }
    }
}

function glossar_laden(id)
{
	clearTimeout(timer);
	document.getElementById("glossartext").style.display = "block";
	var scriptURL = "glossar_js.php?glossar_link=" + id + '&z=' + Math.random();
	http_request = false;
    if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
			{
                http_request.overrideMimeType('text/xml');
            }
        }
		else if (window.ActiveXObject)
		{ // IE
            try
			{
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
			catch (e)
			{
                try
				{
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e)
				{}
            }
        }

        if (!http_request)
		{
            return false;
        }
        http_request.open('POST', scriptURL, true);
		http_request.onreadystatechange = function() { inhalt("glossartext") }
        http_request.send(null);
}

// Anfrageliste
function ajax_load(id_name, werte)
{
	if(id_name==undefined)
	{
		id_name = "anfrageliste";
	}
	var scriptURL = id_name+"_js.php?z=" + Math.random() + werte;
	http_request = false;
    if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
			{
                http_request.overrideMimeType('text/xml');
            }
        }
		else if (window.ActiveXObject)
		{ // IE
            try
			{
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
			catch (e)
			{
                try
				{
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e)
				{}
            }
        }

        if (!http_request)
		{
            return false;
        }
        http_request.open('POST', scriptURL, true);
		http_request.onreadystatechange = function() { inhalt(id_name) }
        http_request.send(null);
}

// Anfrageliste
function load_ajax(id_name, datei_name)
{
	if(id_name==undefined)
	{
		id_name = "anfrageliste";
	}
	var scriptURL = datei_name+"&z=" + Math.random();
	http_request = false;
    if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
			{
                http_request.overrideMimeType('text/xml');
            }
        }
		else if (window.ActiveXObject)
		{ // IE
            try
			{
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
			catch (e)
			{
                try
				{
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e)
				{}
            }
        }

        if (!http_request)
		{
            return false;
        }
        http_request.open('POST', scriptURL, true);
		http_request.onreadystatechange = function() { inhalt(id_name) }
        http_request.send(null);
}

function div_height(hoehe_div, soll_hoehe_div) {
	if(document.getElementById(hoehe_div).offsetHeight < document.getElementById(soll_hoehe_div).offsetHeight && document.getElementById("drei_spalten_mitte").offsetHeight < document.getElementById(soll_hoehe_div).offsetHeight) {
		document.getElementById(hoehe_div).style.height = document.getElementById(soll_hoehe_div).offsetHeight+"px";
	}
}
//-->
