//to enable hovers for IE:
function jsHover()  {
    if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) {
        var hEls = document.getElementById("menu").getElementsByTagName("LI");
        for (var i=0, len=hEls.length; i<len; i++) {
            hEls[i].onmouseover=function() { this.className+=" jshover"; }
            hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", "");}
        }
    }
}

function preloadImages(images) {
    for (i = 1; i < images.length - 1; i++) {
        im = new Image();
        im.src = images[i];
    }
}

function autoRotateImages(images, rotationSelector, delay) {
    var photos = images;
    var photoIndex = 1;

    preloadImages(photos);

    $.timer(delay, function (timer) {
        $(rotationSelector)
            .css("background-image", "url(" + photos[photoIndex] + ")");

        photoIndex++;
        if (photoIndex >= photos.length-1)  {
            photoIndex = 0;
        }
    });
}

function autoRotateInnerBlock(selector, delay) {
    var rotateIndex = 0;

    $.timer(delay, function (timer) {
        $(selector + " > div").eq(rotateIndex).hide();
        rotateIndex++;
        if (!$(selector + " > div").eq(rotateIndex).length) {
            rotateIndex = 1;
        }
        $(selector + " > div").eq(rotateIndex).show();
    });
}