﻿function popUp(e)
{
    if (!e) {
        e = window.event;
    }

    // --> onClick-Event abbrechen (für Popup-Links innerhalb von Teasern)
    if (e.stopPropagation) {
        e.stopPropagation();
    } else {
        e.cancelBubble = true;
    } // <--

    var internal = window.open(
        this.getAttribute('href'), 
        "internal_b"+ (++popupNo_b),
        "width=480, height=640, top=40, left=80, scrollbars=yes, resizable=yes, status=yes"
    );
    internal.focus();
 
    return false;
}

function popUpExternal(e)
{
    if (!e) {
        e = window.event;
    }

    // --> onClick-Event abbrechen (für Popup-Links innerhalb von Teasern)
    if (e.stopPropagation) {
        e.stopPropagation();
    } else {
        e.cancelBubble = true;
    } // <--

    var external = window.open(
        this.getAttribute('href'), 
        "external_b"+ (++popupNo_b)
    );
    external.focus();

    return false;
}

function popAttach()
{
    var popList = document.getElementsByTagName('a');
    var i = -1;
    for (var i = 0; i < popList.length; i++) {
        if (popList[i].className.search(/\bpopup\b/) != -1) {
            popList[i].onclick = popUp;
        } else if (popList[i].className.search(/\bexternal\b/) != -1) {
            popList[i].onclick = popUpExternal;
        }
    }
}

function init()
{
    popAttach();
}

var popupNo_b = 0;
window.onload = init;

