// FEHLER UNTERDRUECKEN
//window.onerror=cancelError; function cancelError() { return true; }

function swap_image(itm, num)
{
    if(!document.getElementById) { return(true); }
    
    document.getElementById(itm).src = images_tn[num].src;;

    return(false);
}

function scd(k, l)
{
    if(l.href.indexOf("~") == -1)
    {
        l.href = l.href.replace(/.html/, "~"+k+".html");
    }
}

function bookmark_car(u, k, title, hint)
{
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
    {
        u = u.replace(/.html/, "~"+k+".html"); window.external.AddFavorite(u, title);
    }
    else if (navigator.appName == "Netscape")
    {
        alert(hint);
    }
}

function fahrzeug_versenden(k, lng, width, height, winname)
{   
    open_win("emailcar-"+k+"-"+lng+".html", width, height, winname); return false;
}

function fahrzeug_bilder(k, lng, width, height, winname)
{   
    open_win("gallerycar-"+k+"-"+lng+".html", width, height, winname); return false;
}

function fahrzeug_details(k, lng, width, height, winname)
{   
    open_win("fahrzeugdetails/detailscar-"+k+"-"+lng+".html", width, height, winname); return false;
}

function open_win(ur, width, height, winname)
{
    sWidth  = screen.width;
    sHeight = screen.height;

    xPos  = (sWidth  - width)  / 2;
    yPos  = (sHeight - height) / 2;
    yPos  = 30;

    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=1,";
    prob += "locationbar=0,";
    prob += "directories=0";

    win = window.open(ur, winname, prob);
    win.focus();
    
    return false;
}

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);
}
