function cs(el, cl)
{
    document.getElementById(el).className = cl;
}

function cb(el, bgcolor)
{
    document.getElementById(el).style.backgroundColor = bgcolor;
}

function cp(name, path)
{
    if (document.images) {
        document.images[name].src = path;
    }
}

function cv(el)
{
    if (document.getElementById(el).style.display == 'block') {
        document.getElementById(el).style.display = 'none';
    } else {
        document.getElementById(el).style.display = 'block';
    }
}


function popUp(url, features)
{
    var f = 'width=' + SGL_JS_WINWIDTH + ',height=' + SGL_JS_WINHEIGHT +
            ',location=no,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no';
    if (typeof features != "undefined") {
        f += ',' + features;
    }
    var date = new Date();
    var name = date.getTime();
    window.open(url, name, f);
}

function resizeWindowToFitImage()
{
    var width      = document.images[0].width;
    var height     = document.images[0].height;
    var extraWidth = 200, extraHeight = 200;
    var innerWidth = 0,   innerHeight = 0;

    if (!width || window.doneAlready) { // in case images are disabled
        return false;
    }
    window.doneAlready = true; // for Safari and Opera

    // image + extra
    window.resizeTo(width + extraWidth, height + extraHeight);

    var d = document.documentElement, b = document.body;
    if (window.innerWidth) {
        innerWidth  = window.innerWidth;
        innerHeight = window.innerHeight;
    } else if (d && d.clientWidth) {
        innerWidth  = d.clientWidth;
        innerHeight = d.clientHeight;
    } else if (b && b.clientWidth) {
        innerWidth  = b.clientWidth;
        innerHeight = b.clientHeight;
    }

    window.resizeTo(width + (width + extraWidth) - innerWidth, height + (height + extraHeight) - innerHeight);

    // center window
    var scrW = screen.availWidth  ? screen.availWidth  : screen.width;
    var scrH = screen.availHeight ? screen.availHeight : screen.height;
    if (!window.opera) {
        window.moveTo(Math.round((scrW - width) / 2), Math.round((scrH - height) / 2));
    }
}

function preloadImages()
{
    var aImages = new Array();
    for (var i = 0; i < preloadImages.arguments.length; i++) {
        aImages[i] = new Image();
        aImages[i].src = preloadImages.arguments[i];
    }
}