﻿(function ($) {
    var cache = [];
    // Arguments are image paths relative to the current page.
    $.preLoadImages = function () {
        var args_len = arguments.length;
        for (var i = args_len; i--; ) {
            var cacheImage = document.createElement('img');
            cacheImage.src = arguments[i];
            cache.push(cacheImage);
        }
    }
})(jQuery)
/*  preload and mouseovers  */
$(document).ready(function () {
    $('img[class^=imageOver]').each(function () {
        var img = $(this);

        var src_orig = img.attr('src');
        var src_over = img.attr('class').split(":")[1];

        img.attr('src_orig', src_orig);
        img.attr('src_over', src_over);

        $.preLoadImages(src_over);
        img.bind('mouseout', function () {
            img.attr('src', src_orig);
            img.ifixpng();
        });
        img.bind('mouseover', function () {
            img.attr('src', src_over);
            img.ifixpng();
        });
    });
});
/*  carousel callback   */
function carousel_callback(carousel) {
    $('#carousel li').bind('mouseover', function () {
        carousel.stopAuto();
        return false;
    });
    $('#carousel li').bind('mouseout', function () {
        carousel.startAuto();
        return false;
    });
    $('#carousel li').css('cursor', 'pointer');
    $('#carousel li').click(function () {
        window.location = $(this).find('a').attr('href'); return false;
    });
    $('#carousel li').each(function () {
        var itm = $(this);
        var img = itm.find('img[class^=imageOver]');

        img.unbind('mouseover');
        img.unbind('mouseout');

        itm.bind('mouseout', function () {
            img.attr('src', img.attr('src_orig'));
            img.ifixpng();
        });
        itm.bind('mouseover', function () {
            img.attr('src', img.attr('src_over'));
            img.ifixpng();
        });
        img.ifixpng();
    });
    $('#carousel *').ifixpng();
    $('#footer').css('display', 'block'); //IE6 footer fix
}
