/**************************************************************
 * Setzt die Brwoservariablen
 * MS = InternetExplorer
 * NS = Netscape
 * OP = Opera
 * DOM = Document Object Model
 * DHTML = Ob DHTML mï¿½glich ist
 **************************************************************/
    var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
	function DHTML_init() {
        if (window.opera) {
            OP = 1;
        }
        if(document.getElementById) {
            DHTML = 1;
            DOM = 1;
        }
        if(document.all && !OP) {
            DHTML = 1;
            MS = 1;
        }
        if (window.netscape && window.screen && !DOM && !OP){
            DHTML = 1;
            NS = 1;
        }
	}

  
/**********************************************************
* Safari zeigte Zielflughafenliste nicht, da er das typeof 
* in getElem() nicht vertrug. Wir behandeln ihn dort extra
***********************************************************/
  function checkBrowserName(name){  
    var agent = navigator.userAgent.toLowerCase();  
    if (agent.indexOf(name.toLowerCase())>-1) {  
      return true;  
    }  
    return false;  
  }  
    
    
/**************************************************************
 * Event-Handling
 **************************************************************/
function addEvent( obj, type, fn ) {
	try {
	   if (obj.addEventListener) {
	      //obj.addEventListener( type, fn, false );
	      eval('obj.onclick = '+fn+';');
	   } else if (obj.attachEvent) {
	      obj["e"+type+fn] = fn;
	      obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
	      obj.attachEvent( "on"+type, obj[type+fn] );
	   }
	} catch (e) {
		alert(e);
	}
}

function removeEvent( obj, type, fn ) {
   if (obj.removeEventListener) {
      obj.removeEventListener( type, fn, false );
   } else if (obj.detachEvent) {
      obj.detachEvent( "on"+type, obj[type+fn] );
      obj[type+fn] = null;
      obj["e"+type+fn] = null;
   }
}

/**************************************************************
 * Holt ein Element aus dem document-Bereich
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 **************************************************************/
	function getElem(p1,p2,p3) {
        try {
            var Elem;
            if(DOM) {
                if(p1.toLowerCase()=="id") {
                    if (typeof document.getElementById(p2) == "object") {
                        Elem = document.getElementById(p2);
                    } else {
                        Elem = void(0);
                    }
                    return(Elem);
                } else if (p1.toLowerCase()=="name") {
                     // Safari vertraegt das typeof nicht
                    if (typeof document.getElementsByName(p2) == "object" || checkBrowserName('safari')) {
                        Elem = document.getElementsByName(p2)[p3];
                    } else {
                        Elem = void(0);
                    }
                    return(Elem);
                } else if (p1.toLowerCase()=="tagname") {
                    if (typeof document.getElementsByTagName(p2) == "object" ||
                    (OP && typeof document.getElementsByTagName(p2) == "function")) {
                        Elem = document.getElementsByTagName(p2)[p3];
                    } else {
                        Elem = void(0);
                    }
                    return(Elem);
                } else {
                    return void(0);
                }
            } else if(MS) {
                if(p1.toLowerCase()=="id") {
                    if (typeof document.all[p2] == "object")
                        Elem = document.all[p2];
                    else Elem = void(0);
                    return(Elem);
                }
                else if(p1.toLowerCase()=="tagname") {
                    if (typeof document.all.tags(p2) == "object")
                        Elem = document.all.tags(p2)[p3];
                    else Elem = void(0);
                    return(Elem);
                }
                else if(p1.toLowerCase()=="name") {
                    if (typeof document[p2] == "object")
                        Elem = document[p2];
                    else Elem = void(0);
                    return(Elem);
                }
                else return void(0);
            } else if(NS) {
                if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
                    if (typeof document[p2] == "object")
                        Elem = document[p2];
                    else Elem = void(0);
                    return(Elem);
                }
                    else if(p1.toLowerCase()=="index") {
                    if (typeof document.layers[p2] == "object")
                        Elem = document.layers[p2];
                    else Elem = void(0);
                    return(Elem);
                }
                else return void(0);
            }
        } catch (e) {
            alert (e + ' ('+p2+')');
            return null;
        }
	}

/**************************************************************
 * Gibt den Wert/Text den der Tag einschlieï¿½t zurï¿½ck
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 **************************************************************/
	function getCont(p1,p2,p3) {
        var Cont;
        if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
            if(getElem(p1,p2,p3).firstChild.nodeType == 3)
                Cont = getElem(p1,p2,p3).firstChild.nodeValue;
            else
                Cont = "";
            return(Cont);
        } else if(MS && getElem(p1,p2,p3)) {
            Cont = getElem(p1,p2,p3).innerText;
            return(Cont);
        } else return void(0);
	}

/**************************************************************
 * Gibt das Attribut eines Elements zurï¿½ck
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 * p4 = Attribut-Name
 **************************************************************/
	function getAttr(p1,p2,p3,p4) {
	   var Attr;
	   if((DOM || MS) && getElem(p1,p2,p3)) {
		Attr = getElem(p1,p2,p3).getAttribute(p4);
		return(Attr);
	   }
	   else if (NS && getElem(p1,p2)) {
		  if (typeof getElem(p1,p2)[p3] == "object")
		   Attr=getElem(p1,p2)[p3][p4]
		  else
		   Attr=getElem(p1,p2)[p4]
		    return Attr;
		  }
	   else return void(0);
	}

/**************************************************************
 * Gibt das Attribut eines Elements zurï¿½ck
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 * p4 = Attribut-Name
 **************************************************************/
	function getAttrObj(p1,p4) {
	   var Attr;
	   if(MS==1) {
			return p1.getAttribute(p4);
	   } else {
		  return eval("p1."+p4);
	   }
	   return '';
	}

	function setAttrObj(p1,p4,p5) {
	   var Attr;
	   if(MS==1) {
			return p1.setAttribute(p4,p5,0);
	   } else {
		  return eval("p1."+p4+"='"+p5+"';");
	   }
	   return '';
	}
/*
	function setStyleObj(p1,p4,p5) {
	   var Attr;
	   if(MS==1) {
			p1.getAttribute('style')[p4] = p5;
	   } else {
		  return eval("p1.style."+p4+"='"+p5+"';");
	   }
	   return '';
	}

	function getStyleObj(p1,p4) {
	    if(MS==1) {
	       var oStyle = p1.getAttribute('style');
	       return oStyle[p4];
	    } else {
	       return eval("p1.style."+p4+";");
	    }
	}
*/
/**************************************************************
 * Setzt den Wert/Text den der Tag einschlieï¿½t zurï¿½ck
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 * p4 = Wert/Text
 **************************************************************/
	function setCont(p1,p2,p3,p4) {
	   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
           getElem(p1,p2,p3).firstChild.nodeValue = p4;
	   else if(MS && getElem(p1,p2,p3))
           getElem(p1,p2,p3).innerText = p4;
	   else if(NS && getElem(p1,p2,p3)) {
           getElem(p1,p2,p3).document.open();
           getElem(p1,p2,p3).document.write(p4);
           getElem(p1,p2,p3).document.close();
	   }
	}

/**************************************************************
 * Setzt den innerHTML
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 * p4 = Wert/Text
 **************************************************************/
	function setHTML(p1,p2,p3,p4) {
		try {
	   		getElem(p1,p2,p3).innerHTML = p4;
		} catch (e) {

		}
	}

    function getHTML(p1,p2,p3) {
	   return getElem(p1,p2,p3).innerHTML;
	}

/**************************************************************
 * Setzt den innerHTML
 * p1 = Werte('id'/'name'/'tagname')
 * p2 = Name/ID/Tagname des Elementes (je nach p1)
 * p3 = Element-Nr (optional)
 * p4 = Wert/Text
 **************************************************************/
	function addHTML(p1,p2,p3,p4) {
	   getElem(p1,p2,p3).innerHTML += p4;
	}

/**************************************************************
 * ï¿½ffnet ein neues Fenster und gibt die Referenz auf dieses zurï¿½ck
 * sName = Werte('id'/'name'/'tagname')
 * sLink = Name/ID/Tagname des Elementes (je nach p1)
 * sStyle = Element-Nr (optional)
 **************************************************************/
    var aWindows = new Array();

    function openWindow(sLink, sName, sStyle) {
        var oWindow;
        try {
            LeftPosition = (screen.width) ? (screen.width-610)/2 : 0;
            TopPosition = (screen.height) ? (screen.height-800)/2 : 0;
            var settings = sStyle+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes';
            oWindow = window.open(sLink,sName,'scrollbars=yes,'+sStyle);
            oWindow.focus();
        } catch (e) {
            oWindow = window.open(sLink,'debug_new',sStyle);
       }
	}

/**************************************************************
 * Schlieï¿½t ein Fenster, dass zuvor durch openWindow() geï¿½ffnet wurde
 * iReferenz = Referenz auf das Fenster
 **************************************************************/
    function closeWindow(iReferenz) {
        if (iReferenz<=(aWindows.length-1)) {
            try {
                aWindows[iReferenz].close();
                return true;
            } catch (e) {
                return false;
            }
        }
        return false;
	}

/**************************************************************
 * Alias fï¿½r openWindow
 * sName = Werte('id'/'name'/'tagname')
 * sLink = Name/ID/Tagname des Elementes (je nach p1)
 * sStyle = Element-Nr (optional)
 **************************************************************/
    function openPopup(sLink, sName, sStyle) {
        return openWindow(sLink, sName, sStyle);
	}

/**************************************************************
 * ï¿½quivalent zu <a>-Tag in Html
 * sUrl = Ziel des Links
 **************************************************************/
    function gotoURL(sUrl) {
        document.location=sUrl;
    }

/**************************************************************
 * Sendet ein Formular ab.
 * oForm = Ist ein Formular-Objekt
 **************************************************************/
    function submitForm(oForm) {
        oForm.submit();
    }

/**************************************************************
 * Setzt alle Formularfelder zurï¿½ck
 * oForm = Ist ein Formular-Objekt
 **************************************************************/
    function clearForm(oForm) {
        if(oForm!=null && oForm.elements!=null) {
            for (var i = 0; i < oForm.elements.length; i++) {
                  if (oForm.elements[i].name.indexOf("outbound") != -1) {
                       oForm.elements[i].checked=false;
                  }
                  if (oForm.elements[i].name.indexOf("inbound") != -1) {
                       oForm.elements[i].checked=false;
                  }
             }
        }
    }

/**************************************************************
 * Lï¿½scht alle Formularfeld-Eingaben
 * oForm = Ist ein Formular-Objekt
 **************************************************************/
     function resetForm(oForm) {
         oForm.reset();
     }

/**************************************************************
 * Sucht ein Objekt
 * oForm = Ist ein Formular-Objekt
 **************************************************************/
    function findObj(n, d){
        var p,i,x;
        if(!d) {
            d=document;
        }
        if((p=n.indexOf("?"))>0 && parent.frames.length) {
            d=parent.frames[n.substring(p+1)].document;
            n=n.substring(0,p);
        }
        if(!(x=d[n])&&d.all) {
            x=d.all[n];
        }
        for (i=0;!x&&i<d.forms.length;i++) {
            x=d.forms[i][n];
        }
        for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
            x=findObj(n,d.layers[i].document);
        }
        if(!x && d.getElementById) {
            x=d.getElem('id',n);
        }
        return x;
    }

/**************************************************************
 * Gibt die aktuelle Position des Mauszeigers zurï¿½ck.
 * oEvent = Das Event.
 **************************************************************/
    function getMousePosition (oEvent) {
    	try {
	        if (!oEvent) {
	            oEvent = window.event;
	        }
	        if (MS==1) {
	            var sX = oEvent.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft);
	            var sY = oEvent.clientY + (document.documentElement.scrollTop || document.body.scrollTop);
	        } else {
	            var sX = oEvent.layerX;
	            var sY = oEvent.layerY;
	        }
	        //alert (sX+"+"+sY);
	        var aPoints = new Array(sX,sY);
	        return aPoints;
    	} catch (e) {
    		//alert(e);
    	}
    }

/**************************************************************
 * Prï¿½ft ob ein Plugin besteht
 * plgIn = Plugin (Flash, Java...)
 **************************************************************/
    function MM_checkPlugin(plgIn, theURL, altURL, autoGo) {
        var detflash = detectingFlash(7);
        if(detflash >= 7){
            var ok="autoGo";
            return ok;
        }
    }

    function detectingFlash(since_version) {

        if (since_version < 3) {
            since_version = 5;
        }
        var browser = navigator.userAgent.toLowerCase();
        var flashVersion = 0;
        if ( navigator.plugins != null && navigator.plugins.length > 0 ) {
            var flashPlugin = navigator.plugins['Shockwave Flash'];
            if ( typeof flashPlugin == 'object' ) {
                if ( (since_version <= 8) && (flashPlugin.description.indexOf('8.') != -1) ) return 8;
                else if ( (since_version <= 10) && (flashPlugin.description.indexOf('10.') != -1) ) return 10;
                else if ( (since_version <= 11) && (flashPlugin.description.indexOf('11.') != -1) ) return 11;
                else if ( (since_version <= 12) && (flashPlugin.description.indexOf('12.') != -1) ) return 12;
                else if ( (since_version <= 9) && (flashPlugin.description.indexOf('9.') != -1) ) return 9;
                else if ( (since_version <= 7) && (flashPlugin.description.indexOf('7.') != -1) ) return 7;
                else if ( (since_version <= 6) && (flashPlugin.description.indexOf('6.') != -1) ) return 6;
                else if ( (since_version <= 5) && (flashPlugin.description.indexOf('5.') != -1) ) return 5;
                else if ( (since_version <= 4) && (flashPlugin.description.indexOf('4.') != -1) ) return 4;
                else if ( (since_version <= 3) && (flashPlugin.description.indexOf('3.') != -1) ) return 3;
            }
        } else if (navigator.mimeTypes && navigator.mimeTypes.length != 0) {
            if (navigator.mimeTypes["application/x-shockwave-flash"]) {
                return 7
            }
        } else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
            return 7;
            try {
                document.write('<scr' + 'ipt language="VBScript"\> \n');
                document.write('on error resume next \n');
                document.write('DIM obFlash \n');
                document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
                document.write('IF IsObject(obFlash) THEN \n');
                document.write('flashVersion = 7 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
                document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 6 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
                document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 5 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
                document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 4 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
                document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 3 \n');
                document.write('END IF');
                document.write('</scr' + 'ipt\> \n');
            } catch (e) {
                return -1;
            }
            if (flashVersion < since_version) {
                return 0;
            }
        } else {
            return -1;

        }
        return -1;
    }

    function getFlash(sName, sPath, sFile, sBild, sLink, iWidth, iHeight) {
        var sProtokoll;
        if (document.URL.substring(0,5) == "https") {
            sProtokoll = "https";
        } else {
            sProtokoll = "http";
        }
        var bFlash = detectingFlash(6);
        var sHtml  = "";
        var sBgColor = '';
        if (bFlash>3) {
            sHtml  =    '<div id="mm'+sName+'FlashObject"><object id="mm'+sName+'Flash" style="display:inline;z-index:1;" classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + iWidth + '" height="' + iHeight + '" codebase="' + sProtokoll + '://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0">' +
                        '   <param name="movie"   value="' + sPath + sFile + '" />' +
                        '   <param name="quality" value="high" />' +
                        '   <param name="menu"    value="false">' +
                        '   <param name="wmode"   value="transparent">' +
                        '   <embed  src="' + sPath + sFile + '"' +
                        '       width="' + iWidth + '"' +
                        '       height="' + iHeight + '"' +
                        '       menu="false"' +
                        '       quality="high"' +
                        '       wmode="transparent"' +
                        '       name="' + sName + '"' +
                        '       type="application/x-shockwave-flash"' +
                        '       pluginspage="' + sProtokoll + '://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />' +
                        '</object></div>';
			sHtml += 	'<div id="mm'+sName+'FlashImg" style="display:none;">' +
                        '   <a class="none" href="' + sLink + '">' +
                        '       <img src="' + sPath + sBild + '" alt="' + sName + '" title="' + sName + '" style="border:0px;width:' + iWidth + 'px;height:' + iHeight + 'px;">' +
                        '   </a>' +
                        '</div>';
        } else {
            if (sLink != "") {
                sHtml = '<div>' +
                        '   <a class="none" href="' + sLink + '">' +
                        '       <img src="' + sPath + sBild + '" alt="' + sName + '" title="' + sName + '" style="border:0px;width:' + iWidth + 'px;height:' + iHeight + 'px;">' +
                        '   </a>' +
                        '</div>';
            } else {
                sHtml = '<div><img src="' + sPath + sBild + '" alt="' + sName + '" title="' + sName + '" style="border:0px;width:' + iWidth + 'px;height:' + iHeight + 'px;"></div>';
            }
        }
        return sHtml;
    }

    function showFlash(name, path, file, bild, link, width, height) {
        document.writeln(getFlash(name, path, file, bild, link, width, height));
    }

/**************************************************************
 * Fï¿½hre initialisierung durch
 **************************************************************/
	DHTML_init();
    //document.onmousemove = showPosition;

    function showPosition(oEvent) {
        if (!oEvent) {
            oEvent = window.event;
        }
        var sX = oEvent.layerX;
        var sY = oEvent.layerY;
        window.status= 'Layer('+sX+'+'+sY+') Client('+oEvent.clientX+'+'+oEvent.clientY+') Screen('+oEvent.screenX+'+'+oEvent.screenY+') Page('+oEvent.pageX+'+'+oEvent.pageY+')';
    }

    function SEA_filter_submit(oForm) {
        var sMonthYear = getElem('id','filterMonthYear',0).options[getElem('id','filterMonthYear',0).selectedIndex].innerHTML;
        getElem('id','filterYear',0).value = parseInt("20"+sMonthYear.substr((sMonthYear.length-2),2));
    }

/**************************************************************
 * Eigener Array-Handler
 **************************************************************/
    function LocoArray() {
        this.data   = new Array();

        this.push   = function(sKey,sVal) {
            this.data.push(new LocoPair(sKey,sVal));
        }

        this.get    = function(sKey) {
            for(var i=0;i<this.data.length;i++) {
                if (this.data[i].key==sKey) {
                    return this.data[i].value;
                }
            }
            return undefined;
        }
    }

 /**************************************************************
 * Datenhaltungsobjekt
 **************************************************************/
    function LocoPair(sKey,sValue) {
        this.key    = sKey;
        this.value  = sValue;
    }

/**************************************************************
 * Ändern der Klasse Array
 **************************************************************/
