function getStyleObject(objectId) 
{
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
        // W3C DOM
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers
        return document.layers[objectId];
    } else {
        return false;
    }
}

function preload() 
{

// swapImg new implemented - preload not necessary anymore
// just call init()

init();
}

function swapImg(num,imgname)
{
var strImgSrc = imgname.src;
//window.alert(strImgSrc);

var idx = strImgSrc.lastIndexOf("\/");

if (-1<idx)
    {
    var strImgName = strImgSrc.substring(idx+1);
    var strImgPath = strImgSrc.substring(0,idx);
    }
    else
    {
    strImgName = strImgSrc;
    strImgPath = "";
    }

idx = -1;
idx = strImgName.lastIndexOf(".");

if(-1 < idx)
    {
    var name = strImgName.substring(0,idx);
    var ext = strImgName.substring(idx,strImgName.length);
    }
    else
    {
    location.reload(true);
    }

idx = -1;
idx = name.lastIndexOf("_on");

if(-1 < idx)
    {
    name = name.substring(0, idx);
    }
    else
    {
    name = name + "_on";
    }
    
// build image path
strImgSrc = strImgPath + "/" + name + ext;

// set new image
imgname.src = strImgSrc;

}

function init()
{

    // find file name
    var strFilename;
    var strHref = document.title;
    var idx = strHref.lastIndexOf("Startseite");

// define layers - set visibility
if(menuLayer = getStyleObject("menu"))
{
menuLayer.top = 165;
menuLayer.left = 601;
menuLayer.width = 200;
menuLayer.height = 150;
menuLayer.visibility = 'visible';
}

if(textLayer = getStyleObject("text"))
{
textLayer.top = 0;
textLayer.left = 0;
textLayer.width = 800;
textLayer.height = 600;
textLayer.visibility = "visible";
}

if(logoLayer = getStyleObject("logo"))
{
    logoLayer.top = 20;
    logoLayer.left = 560;
    logoLayer.width = 275;
    logoLayer.height = 100;
    
    // logo only visible if document is not index.html
    if(idx > -1)
    {
    logoLayer.visibility = "hidden";
    }
    else
    {
    logoLayer.visibility = "visible";
    }
}

if(sub1Layer = getStyleObject("sub1"))
{
sub1Layer.top = 215;
sub1Layer.left = 401;
sub1Layer.width = 200;
sub1Layer.height = 100;
sub1Layer.visibility = "hidden";
}

if(sub2Layer = getStyleObject("sub2"))
{
sub2Layer.top = 240;
sub2Layer.left = 401;
sub2Layer.width = 200;
sub2Layer.height = 75;
sub2Layer.visibility = "hidden";
}
}
