// Land Rover Coffee

var LRC = {

    /**
     * Init functions
     */         
    init: function () {
       
        LRC.rollovers();
        LRC.preloadImages(["/images/buttons/buy-this-product_over.gif", 
                           "/images/buttons/make-enquiry_over.gif", 
                           "/images/buttons/sign-up-now_over.gif" 
                           ]);
        LRC.initSIFR(); 
        if ($.browser.opera) {
             $('body').addClass("opera");
        }
    },
    
    /**
     * sIFR
     */         
    initSIFR: function () {
        if (typeof sIFR == "function") {
            sIFR.replaceElement(named({sSelector: "#content h1.sifr", 
                                       sFlashSrc: "/flash/fonts/zurich-bt.swf", 
                                       sColor: "#002840", 
                                       sWmode: "transparent",
                                       sCase: "upper",
                                       nPaddingTop: "10",
                                       nPaddingRight: "12",
                                       nPaddingBottom: "4",
                                       nPaddingLeft: "12"}));
            sIFR.replaceElement(named({sSelector: ".main-image p", 
                                       sFlashSrc: "/flash/fonts/zurich-bt.swf", 
                                       sColor: "#ffffff", 
                                       sWmode: "transparent",
                                       nPaddingTop: "5",
                                       nPaddingRight: "9",
                                       nPaddingBottom: "4",
                                       nPaddingLeft: "9"}));                                       
        }
    },

    
    /**
     * Rollovers buttons
     */
    rollovers: function () {
        $('.rollover').hover(
            function () {
                $(this).attr('src', $(this).attr('src').replace(/.gif/, '_over.gif'));
            },
            function () {
                $(this).attr('src', $(this).attr('src').replace(/_over.gif/, '.gif')); 
            }
        );
     },
     
   /**
     * Preload images
     * @param {Array} images array with names of images   
     */               
    preloadImages: function (images) {
        for (var i = 0; i < images.length; i++) {
            var image = new Image();
            image.src = images[i];
        }
    }
}

$(document).ready(function () {
    LRC.init();
});
