/* div-popup (Lexikon + Bildvergrößerung) */var divPopup = null;var divOverlay = null;var divLoading = null;function closePopup(){    if(divOverlay) {      divOverlay.parentNode.removeChild(divOverlay);      divOverlay = null;    }    if(divPopup) {      divPopup.parentNode.removeChild(divPopup);      divPopup = null;    }    if(divLoading) {      divLoading.parentNode.removeChild(divLoading);      divLoading = null;    }}function createPopup(){    var arrayPageSize = getPageSize();    var arrayPageScroll = getPageScroll();    closePopup();    divOverlay = document.createElement("div");    divOverlay.setAttribute('id','overlay');    divOverlay.onclick = function () {closePopup(); return false;}    divOverlay.style.height = (arrayPageSize[1] + 'px');    document.body.insertBefore(divOverlay, document.body.firstChild);    var div = document.createElement('div');    if(!div) return false;    var aClose = document.createElement('a');    var imgClose = document.createElement('img')    imgClose.src = "http://www.zweirad-springer.at/images/close.gif";    imgClose.height = imgClose.width = 15;    aClose.appendChild(imgClose);    aClose.href = "javascript:closePopup()";    aClose.className = "close";    div.appendChild(aClose);    div.style.visibility = 'hidden'; //erst verstecken um die höhe berechnen zu können    document.body.appendChild(div);    divPopup = div;    divLoading = document.createElement('div');    divLoading.id = 'popupLoading';    imgLoading = document.createElement('img');    imgLoading.src = loadingImage.src;    divLoading.appendChild(imgLoading);        var height = 100;    var width = 100;    var y = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - height) / 2);    var x = ((arrayPageSize[0] - 20 - width) / 2);    divLoading.style.top = y + "px";    divLoading.style.left = x + "px";    divLoading.style.height = height + "px";    divLoading.style.width = width + "px";    document.body.appendChild(divLoading);    return div;}var loadingImage = new Image();loadingImage.src = 'http://www.zweirad-springer.at/images/loading.gif'function openPic(href, text, width, height){    if(!document.createElement) return(true);    var arrayPageSize = getPageSize();    var arrayPageScroll = getPageScroll();    //allready one open?    closePopup();    if(text!="") var textHeight = 30; else textHeight = 0;    if(arrayPageSize[0]-30 < width || arrayPageSize[1]-30 < height) {        //wenn es sich um ein so kleines fenster handelt, dass das bild nicht platz hat        //und der ganze browser unabsichtlich geschlossen werden könnte (DAU) dann popup öffnen        window.open(href, 'picPopup', 'width='+width+',height='+height+',scrollbars=no,toolbar=no');        return;    }    var div = createPopup();    if(!div) return(true);    div.className = "popupPic";    div.onclick = function() { closePopup(); }    y = ((y-height)/2);    x = ((x-width)/2);    var y = arrayPageScroll[1] + ((arrayPageSize[3] - 15 - (height+textHeight)) / 2);    var x = ((arrayPageSize[0] - width) / 2);    div.style.top = (y) + "px";    div.style.left = (x) + "px";    div.style.width = (width)+"px";    div.style.height = (height+textHeight)+"px";    var img = document.createElement('img');    img.height = height;    img.width = width;    img.onload = function () {        divLoading.parentNode.removeChild(divLoading);        divLoading = null;    }    img.src = href;    div.appendChild(img);    if(text!='') {        var divText = document.createElement('div');        divText.style.top = (height)+"px";        divText.style.width = width+"px";        divText.style.height = textHeight+"px";        divText.className = "text";        p = document.createElement('p');        p.appendChild(document.createTextNode(text));        divText.appendChild(p);        div.appendChild(divText);    }    div.style.visibility = '';    return(false);}function switchPic(a, prefix, picSize, link, largeSize, largeText){    var i;    if(typeof prefix=="undefined") prefix="pic"    //bild ändern    document.getElementById(prefix+'Pic').src = a.href;    if(typeof picSize!="undefined") {        //bildgröße anpassen        document.getElementById(prefix+'Pic').width = picSize[0];        document.getElementById(prefix+'Pic').height = picSize[1];    }    //text ändern    if(a.title) i=a.title; else i="";    if(document.getElementById(prefix+'Text')) {        document.getElementById(prefix+'Text').innerHTML = i;    }    //link für large-bild ändern    if(typeof link!="undefined" && document.getElementById(prefix+'Link')) {        document.getElementById(prefix+'Link').href = link;        if(typeof largeText!="undefined") {            document.getElementById(prefix+'Link').title = largeText;        } else {            document.getElementById(prefix+'Link').title = i;        }    }    //wenn eigene größe, onclick ändern    if(typeof largeSize!="undefined" && document.getElementById(prefix+'Link'))    {        var link = document.getElementById(prefix+'Link');        //neue onclick funktion erstellen mit neuer größe        var onclick = function() {            openPic(this.href, this.title, largeSize[0], largeSize[1]);            return false;        };        if(link.oldOnClick) {            //wegen überschriebener onclick funktion (statistik):            link.oldOnClick = onclick;        } else {            //wenns das nicht gibt, ganz normal den onclick ändern            link.onclick = onclick;        }    }    //css-klasse für alle thumbnails "nicht-aktiv" setzen    for(i=0;i<a.parentNode.childNodes.length;i++) {        if(a.parentNode.childNodes[i].className) {            a.parentNode.childNodes[i].className = a.parentNode.childNodes[i].className.replace(" active", "");            a.parentNode.childNodes[i].className = a.parentNode.childNodes[i].className.replace("active", "");        }    }    //Bei FarbenStoffe sind die bilder in mehreren kategorien (css-klasse 'kat')    //diese müssen alle nicht-aktiv gesetzt werden    if(a.parentNode.className=='kat')    {        for(j=0;j<a.parentNode.parentNode.childNodes.length;j++)        {            if(a.parentNode.parentNode.childNodes[j].className=='kat')            {                for(i=0;i<a.parentNode.parentNode.childNodes[j].childNodes.length;i++) {                    if(a.parentNode.parentNode.childNodes[j].childNodes[i].className) {                        a.parentNode.parentNode.childNodes[j].childNodes[i].className = a.parentNode.parentNode.childNodes[j].childNodes[i].className.replace(" active", "");                        a.parentNode.parentNode.childNodes[j].childNodes[i].className = a.parentNode.parentNode.childNodes[j].childNodes[i].className.replace("active", "");                    }                }            }        }    }    //und für das angeklickt aktiv setzen    a.className = "active";    return(false);}//// getPageScroll()// Returns array with x,y page scroll values.// Core code from - quirksmode.org//function getPageScroll(){    var yScroll;    if (self.pageYOffset) {        yScroll = self.pageYOffset;    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict        yScroll = document.documentElement.scrollTop;    } else if (document.body) {// all other Explorers        yScroll = document.body.scrollTop;    }    arrayPageScroll = new Array('',yScroll)     return arrayPageScroll;}//// getPageSize()// Returns array with page width, height and window width, height// Core code from - quirksmode.org// Edit for Firefox by pHaez//function getPageSize(){        var xScroll, yScroll;        if (window.innerHeight && window.scrollMaxY) {          xScroll = document.body.scrollWidth;        yScroll = window.innerHeight + window.scrollMaxY;    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac        xScroll = document.body.scrollWidth;        yScroll = document.body.scrollHeight;    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari        xScroll = document.body.offsetWidth;        yScroll = document.body.offsetHeight;    }        var windowWidth, windowHeight;    if (self.innerHeight) { // all except Explorer        windowWidth = self.innerWidth;        windowHeight = self.innerHeight;    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode        windowWidth = document.documentElement.clientWidth;        windowHeight = document.documentElement.clientHeight;    } else if (document.body) { // other Explorers        windowWidth = document.body.clientWidth;        windowHeight = document.body.clientHeight;    }           // for small pages with total height less then height of the viewport    if(yScroll < windowHeight){        pageHeight = windowHeight;    } else {         pageHeight = yScroll;    }    // for small pages with total width less then width of the viewport    if(xScroll < windowWidth){          pageWidth = windowWidth;    } else {        pageWidth = xScroll;    }    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)     return arrayPageSize;}