
window.onerror = new Function("return true");

function CheckBrowser() { // v 1.2
	var b = navigator.appName;
	if (b == "Netscape") this.b = "ns";
	else if (b == "Microsoft Internet Explorer") this.b = "ie";
	else if (b == "Opera") this.b = "op";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v   = parseInt(this.version);
    this.dom = document.getElementById ? true : false;
	this.ns  = (this.b == "ns" && this.v >= 4);
	this.ns4 = (this.b == "ns" && this.v == 4 && !this.dom);
	this.ns5 = (this.b == "ns" && this.v == 5 && this.dom);
	this.ie  = (this.b == "ie" && this.v >= 4);
	this.ie4 = (this.version.indexOf('MSIE 4') > 0 && !this.dom);
	this.ie5 = (this.version.indexOf('MSIE 5') > 0 && this.dom);
	this.ie6 = (this.version.indexOf('MSIE 6') > 0 && this.dom);
    this.op5 = (this.b == "op" && this.v == 5 && this.dom);
    this.op6 = (this.b == "op" && this.v == 6 && this.dom);
    this.mac = (navigator.userAgent.indexOf("Mac") != -1);
}
is = new CheckBrowser();

var minPlayer = 6;

// fuer Scrollbalken-Bug bei Mac IE 5.0
if ((navigator.userAgent.indexOf("MSIE 5.0") != -1) && (navigator.userAgent.indexOf("Mac_PowerPC") != -1)) {
   window.resizeBy(-1,-1);
}

function init() {
    refresh();

    if (tickerobj != null) {
        startscroll();
    }
}

function refresh() {
    var objLay = objC = objC1 = objLayCoord = objImg = objImgPos = null;
    var h = w = null;
    w = getWidth();
    h = getHeight();

    /* Platzierung Ticker nur Startseite */
    objImg = getImageRef('img_ticker');
    if (objImg != null) {
        objImgPos = getImagePos(objImg);
        objLay = getLayerRef('main2');
        if (objLay != null) {
            objC = getLayerCanvas('main2');
            objLayCoord = new Coord( (objImgPos.x) - objC.width/2, objImgPos.y);
            setLayerPos(objLay,objLayCoord);
            setLayerVisibility(objLay, true);
        }
    }
    /* Platzierung Impressum */
    objLay = getLayerRef('div_impressum');
    if (objLay != null) {
        objC = getLayerCanvas('div_impressum');
        objLayCoord = new Coord( 0, (h - objC.height));
        setLayerPos(objLay,objLayCoord);
        setLayerVisibility(objLay, true);
    }
}

function reloadPage(init) {
    if (init==true) {
        if (is.ns4 || is.op5) {
            document.pgW=document.innerWidth;
            document.pgH=document.innerHeight;
            onresize=reloadPage;
        }
    } else if (document.innerWidth!=document.pgW || document.innerHeight!=document.pgH) {
        location.reload();
    }
}
reloadPage(true);


function DumpObj(Obj,Name,ausgabe) {
    var text = a = b = "";
    for (var Attr in Obj) {
      text += '.' + Attr + '=' + Obj[Attr]
      text += (ausgabe == 'n') ? '\n' : '\t';
    }
    alert(text);
}

function ChangeW3Cbg(obj, Color)
{
  if (!document.getElementById) return;
	obj.style.backgroundColor = Color
}
function ChangeW3Ccolor(obj, Color)
{
  if (!document.getElementById) return;
	obj.style.color = Color
}

function checkForFlashPlugIn() {
  var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if (plugin) {
    var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
    if(pluginversion >= minPlayer) {return true;}
  }
  return false;
}

if(is.ie) {
  document.write(
    '<script language=VBScript>' + '\n' +
    'Function checkForFlashActiveX()' + '\n' +
    'Dim hasPlayer, playerversion' + '\n' +
    'hasPlayer = false' + '\n' +
    'playerversion = 10' + '\n' +
    'Do While playerversion >= minPlayer' + '\n' +
    'On Error Resume Next' + '\n' +
    'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion & \"\")))' + '\n' +
    'If hasPlayer = true Then Exit Do' + '\n' +
    'playerversion = playerversion - 1' + '\n' +
    'Loop' + '\n' +
    'checkForFlashActiveX = hasPlayer' + '\n' +
    'End Function' + '\n' +
    '<\/script>'
  );
}

function checkForFlashMinPlayer() {
  if(is.ie) return checkForFlashActiveX();
  if(is.ns || is.op5) return checkForFlashPlugIn();
}

/* ######################################################################### */


function getWidth() {
  if (is.ns4 || is.op5) {
    var w = window.innerWidth;
  } else if (is.ie) {
    w = document.body.clientWidth;
  } else if (is.dom) {
    // w = document.width;
    w = document.body.parentNode.scrollWidth;
  }
  return w;
}
function getHeight() {
  if (is.ns4 || is.op5) {
    var h = window.innerHeight;
  } else if (is.ie) {
    h = document.body.clientHeight;
  } else if (is.dom) {
    // dont work with Firefox h = document.height;
    h = document.body.parentNode.scrollHeight;
  }
  return h;
}


function replaceIt(string,suchen,ersetzen) {
    var ausgabe = "" + string;
    var pos = null;
    while (ausgabe.indexOf(suchen)>-1)   {
        pos = ausgabe.indexOf(suchen);
        ausgabe = "" + (ausgabe.substring(0, pos) + ersetzen + 
        ausgabe.substring((pos + suchen.length), ausgabe.length));
    }
    return ausgabe;
}

function objToString() {
    var ret = "";
    for(p in this) {
    if (typeof this[p] == "function") continue;
    if (ret.length >0)
        ret += ";";
    ret += p + "->" + this[p];
    }
    return ret;
}

function /*object*/ getLayerRef(/* String*/ id, /*String [optional]*/ document) {
    if(!document)
        document = window.document;
      
    if (document.all) {
        return document.all[id];
    }
    else if (document.getElementById) {
        return document.getElementById(id);
    }
}

function setLayerPos(/*Object*/ objLayer, /*Object*/ coords) {
    if (window.opera) {
        objLayer.style.top = coords.y;
        objLayer.style.left = coords.x;
    }
    else if (document.all) {
        objLayer.style.top = coords.y + document.body.scrollTop;
        objLayer.style.left = coords.x + document.body.scrollLeft;
    }
    else if (document.getElementById) {
        objLayer.style.top = coords.y + 'px';
        objLayer.style.left = coords.x + 'px';
    }
}

function setLayerZIndex(/*String*/ id, /*String*/ z) {
    var oL = getLayerRef(id);
    var oLzIndex = oL.style.zIndex;
    oLzIndex = z;
}

function setLayerVisibility(/*Object*/ objLayer, /*String*/ visible) {
    objLayer.style.visibility = (visible == true) ? 'visible' : 'hidden';
}

function setLayerVisibilityByPrefix(/*String*/ prefix, /*String*/ visible, /*String [optional]*/ d) {
    if (!d)
        d = window.document;
      
    if (document.all) {
        var layers = document.all.tags("div");
        for (var i=0; i <layers.length; i++) {
        if (layers[i].id.substr(0, prefix.length) == prefix)
            setLayerVisibility(document.all.tags("div")[i], visible)
        }
    }
    else if (document.getElementByTagName) {
        var layers = document.getElementByTagName("div");
        for (var i=0; i <layers.length; i++) {
        if (layers[i].id.substr(0, prefix.length) == prefix)
            setLayerVisibility(layers[i], visible)
        }
    }
}

function getLayerCanvas(/*String*/ id) {
    var objLayer = getLayerRef(id);
    var objC = new Canvas();
      
    if (window.opera) {
        objC.x = objLayer.style.left;
        objC.y = objLayer.style.top;
        objC.width = objLayer.style.width;
        objC.height = objLayer.style.height;
    }
    else if (document.all) {
        var o = objLayer;
        objC.width = objLayer.offsetWidth;
        objC.height = objLayer.offsetHeight;
        while(o.offsetParent) {
        objC.y += parseInt(o.offsetTop);
        objC.x += parseInt(o.offsetLeft);
        o = o.offsetParent;
        }
    }
    else if (document.getElementById) {
        var o = document.defaultView.getComputedStyle(objLayer, '');
        objC.x = parseInt(o.getPropertyValue('left'));
        objC.y = parseInt(o.getPropertyValue('top'));
        objC.width = parseInt(o.getPropertyValue('width'));
        objC.height = parseInt(o.getPropertyValue('height'));
    }
    return objC;  
}

function getImageRef(/*String*/ id, /*String [optional]*/ document) {
    if(!document)
        document = window.document;
      
    if (document.images) {
        return document.images[id];
    }
    else if (document.getElementById) {
        return document.getElementById(id);
    }
    else {
        return null;
    }
}

function getImagePos(/*Object*/ img) {
    var canvas = new Canvas(0, 0, img.width, img.height);
    while (img) {
        canvas.x += img.offsetLeft;
        canvas.y += img.offsetTop;
        img = img.offsetParent;
    }
    if (document.all && !window.opera) {
        canvas.x = canvas.x - document.body.scrollLeft;
        canvas.y = canvas.y - document.body.scrollTop;
    }
    return canvas;
}

function Coord(/*Int*/ x, /*Int*/ y) {
    this.x = (!x) ? 0 : x;
    this.y = (!y) ? 0 : y;
    this.toString = objToString;
}

function Canvas(/*Int*/ x, /*Int*/ y, /*Int*/ width, /*Int*/ height) {
    this.Coord = Coord;
    this.Coord(x, y);
    this.width = (!width) ? 0 : width;
    this.height = (!height) ? 0 : height;
}

function changeLayerContent(/*Object*/objLayer, /*String*/content) {
	if(navigator.appName.indexOf("Netscape") >= 0 && document.getElementById) {
		var rng	= document.createRange();
		rng.setStartBefore(objLayer);
		var newContent = rng.createContextualFragment(content);

		while(objLayer.hasChildNodes())
			objLayer.removeChild(objLayer.lastChild);
			objLayer.appendChild(newContent);
	}
	if(document.getElementById) {
		objLayer.innerHTML = content;
	}
}

function swapImage(IDImage, objImage) {
    if (!document.images) return
    document.images[IDImage].src = objImage;
}
