// FEHLER UNTERDRUECKEN
window.onerror=cancelError; function cancelError() { return true; }

// SELEKTION UNTERBINDEN
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")

if (typeof document.onselectstart!="undefined")
{
    document.onselectstart=new Function ("return false")
}
else
{
    document.onmousedown=disableselect
    document.onmouseup=reEnable
}

function disableselect(e)
{
    if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
    {
        return false
    }
}

function reEnable()
{
    return true
}

function popup(page, width, height, winname)
{
    sWidth = screen.width;
    sHeight = screen.height;

    xPos = (sWidth  - width)  / 2;
    yPos = (sHeight - height) / 2;
    yPos = 50;

    prob  = "left="+xPos+",";
    prob += "top="+yPos+",";
    prob += "screenX="+xPos+",";
    prob += "screenY="+yPos+",";
    prob += "width="+width+",";
    prob += "height="+height+",";
    prob += "menubar=0,";
    prob += "toolbar=0,";
    prob += "statusbar=0,";
    prob += "scrollbars=1,";
    prob += "resizable=0,";
    prob += "locationbar=0,";
    prob += "directories=0";

    win = window.open(page, winname, prob);
    win.focus();
    
    return false;
}

function highlight(item)
{
    document.getElementById(item).style.fontWeight = "bold";
}
function unhighlight(item)
{
    document.getElementById(item).style.fontWeight = "normal";
}

// IMAGEFADING
function show_image(num)
{
    if(!document.getElementById) { return(true); }
    
    cimg     = document.getElementById("mainimg");
    cbak.src = cimg.src; if(!cbak.src.length) { return(true); }
    
    if(cimg.filters)
    {
        if(ctim != null) { return(false); }
        
        ctyp = 0;
        cnum = num;
        ctim = setInterval("fd_IE()", 20);
    }
    else if(cimg.style.opacity)
    {
        if(ctim != null) { return(false); }
     
        ctyp = 0;
        cnum = num;
        cpac = 0.999;
        ctim = setInterval("fd_MOZ()", 50);
    }
    else if(cimg.style.MozOpacity)
    {
        if(ctim != null) { return(false); }
     
        ctyp = 0;
        cnum = num;
        cpac = 0.999;
        ctim = setInterval("fd_MOZo()", 50);
    }
    else
    {
        cimg.src = images[num].src;
    }
    
    return(false);
}

function fd_IE()
{
    if(ctyp == 0)
    {
        if(cpac > -100)
        {
            cpac -= 20;
            cimg.filters.alpha.opacity = cpac;
        }
        else
        {
            ctyp = 1;
            cimg.src = images[cnum].src;
            cbak.src = cimg.src;
            
        }
    }
    else if(ctyp == 1)
    {
        if(cpac < 100)
        {
            cpac += 20;
            cimg.filters.alpha.opacity = cpac;
        }
        else
        {
            ctyp = 0;
            clearInterval(ctim); ctim = null;
            if(cbak.src != cimg.src) { return(true); }
        }
    }
}

function fd_MOZ()
{
    if(ctyp == 0)
    {
        if(cpac > 0)
        {
            cpac -= 0.2;
            cimg.style.opacity = cpac;
        }
        else
        {
            ctyp = 1;
            cimg.src = images[cnum].src;
            cbak.src = cimg.src;
        }
    }
    else if(ctyp == 1)
    {
        if(cpac < 0.999)
        {
            cpac += 0.2;
            if(cpac > 0.999)
            {
                cpac = 0.999;
            }
            cimg.style.opacity = cpac;
        }
        else
        {
            ctyp = 0;
            clearInterval(ctim); ctim = null;
            
        }
    }
}

function fd_MOZo()
{
    if(ctyp == 0)
    {
        if(cpac > 0)
        {
            cpac -= 0.2;
            cimg.style.MozOpacity = cpac;
        }
        else
        {
            ctyp = 1;
            cimg.src = images[cnum].src;
            cbak.src = cimg.src;
        }
    }
    else if(ctyp == 1)
    {
        if(cpac < 0.999)
        {
            cpac += 0.2;
            if(cpac > 0.999)
            {
                cpac = 0.999;
            }
            cimg.style.MozOpacity = cpac;
        }
        else
        {
            ctyp = 0;
            clearInterval(ctim); ctim = null;
            
        }
    }
}

function elemGlowIn(elem)
{   
    if(elem.ctim && elem.ctim != null) { clearInterval(elem.ctim); }
    elem.ctim = window.setInterval(function callFunc() { glow_in(elem); }, 30);
}

function elemGlowOut(elem, min)
{
    if(elem.ctim && elem.ctim != null) { clearInterval(elem.ctim); }
    elem.ctim = window.setInterval(function callFunc() { glow_out(elem, min); }, 30);
}

function glow_in(elem)
{
    if(elem.filters)
    {
        opac = parseFloat(elem.filters.alpha.opacity) + 5; if(opac >= 100) { opac = 100; }
        elem.filters.alpha.opacity = opac; if(opac == 100) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }
    
    if(elem.style.opacity)
    {
        opac = parseFloat(elem.style.opacity) + 0.05; if(opac >= 1) { opac = 1; }
        elem.style.opacity = opac; if(opac == 1) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }

    if(elem.style.MozOpacity)
    {
        opac = parseFloat(elem.style.MozOpacity) + 0.05; if(opac >= 1) { opac = 1; }
        elem.style.MozOpacity = opac; if(opac == 1) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }
    
    clearInterval(elem.ctim);
}

function glow_out(elem, min)
{
    if(elem.filters)
    {
        opac = parseFloat(elem.filters.alpha.opacity) - 5; if(opac <= min) { opac = min; }
        elem.filters.alpha.opacity = opac; if(opac == min) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }
    
    if(elem.style.opacity)
    {
        opac = parseFloat(elem.style.opacity) - 0.05; if(opac <= min) { opac = min; }
        elem.style.opacity = opac; if(opac == min) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }
    
    if(elem.style.MozOpacity)
    {
        opac = parseFloat(elem.style.MozOpacity) - 0.05; if(opac <= min) { opac = min; }
        elem.style.MozOpacity = opac; if(opac == min) { clearInterval(elem.ctim); elem.ctim = null; }
        return;
    }
    
    clearInterval(elem.ctim);
}
