﻿$(document).ready(function() {
    $(".rollover").hover(
            function() {
                if ($(this).attr("src").indexOf("_on") == -1) {
                    var newSrc = $(this).attr("src").replace("_off.png", "_on.png");
                    $(this).attr("src", newSrc);
                }
            },
            function() {
                if ($(this).attr("src").indexOf("_on") != -1) {
                    var oldSrc = $(this).attr("src").replace("_on.png", "_off.png");
                    $(this).attr("src", oldSrc);
                }
            })
});

$.preloadImages = function() {
    for (var i = 0; i < arguments.length; i++) {
        img = new Image();
        img.src = arguments[i];
    }
}

$.preloadImages(
        "/images/menu/food_on.png",
        "/images/menu/gift_cards_on.png",
        "/images/menu/kids_on.png",
        "/images/menu/RR_eclub_on.png",
        "/images/rrfoundation/RRF_01_on.png",
        "/images/rrfoundation/RRF_02_on.png",
        "/images/rrfoundation/RRF_03_on.png",
        "/images/rrfoundation/RRF_04_on.png"
        );


/*
    Clear pre-populated fields in the find section.
*/
function clearTextbox(ele) {
if (ele.value == 'City Name') {
ele.value = "";
}
if (ele.value == 'Zip Code') {
ele.value = "";
}
}

/*
All Pages: Facebook and Find a location sections
Used to send information to double click via iframe
*/
function switchOnFloodLight(params) {
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.getElementById('floodlight').innerHTML = '<iframe src="http://fls.doubleclick.net/activityi;' + params + ';ord=' + a + '?" width="1" height="1" frameborder="0"></iframe>';
return true;
}

/*
Food : Burger Browser
Used on the burger browser page to associate the burgers found in the flash page with the customizer burgers.
*/
function customize(burgerIndex) {
    var burgers = new Array("11", "300", "10", "49", "298", "4517", "8", "50", "437", "1", "54", "553", "3252", "3439", "484", "7", "9");
    GB_customizer('', 'http://www.redrobin.com/customizer/customizer.asp?u=' + burgers[burgerIndex - 1], 850, 952);
}


/*
Used to launch 
*/
function burgerblaster() {
    GB_greyboxGame('', 'http://www.redrobin.com/games/burgerblaster/', 680, 950);
}