﻿// Image Preload (Custom)

function preloadImages()
{
    if (document.images)
    {
        imageObject = new Image();

        imagePath = new Array();
        imagePath[0] = "../../App_Themes/Eatery-Custom/Images/makeareservation.png";
        imagePath[1] = "../../App_Themes/Eatery-Custom/Images/makeareservationover.png";
        imagePath[2] = "../../App_Themes/Eatery-Custom/Images/twitter.png";
        imagePath[3] = "../../App_Themes/Eatery-Custom/Images/twitter-over.png";
        imagePath[4] = "../../App_Themes/Eatery-Custom/Images/facebook.png";
        imagePath[5] = "../../App_Themes/Eatery-Custom/Images/facebook-over.png";

        var i = 0;
        for (i = 0; i <= 5; i++)
        {
            imageObject.src = imagePath[i];
        }
    }
    else
    {
        return;
    }
}

// Image Rollovers (Standard)

function rollImage(imgName, imgSrc)
{
    document[imgName].src = imgSrc;
}

/* Begin MOR Reservation System */
google.load("jqueryui", "1.7.2");
google.load("swfobject", "2.2");

var urlStr = "http://www.myonlinereservations.com:82/component/";
var attrs = { id: "ReservationWidget", name: "ReservationWidget", align: "middle" };
var params = { wmode: "transparent", bgcolor: "#000000", allowscriptaccess: "always", quality: "high" };
var flashvars = { rid: "41C97DC3-EAFC-4EB1-A5C7-8527536372BF", analyticsID: "UA-8275525-1", phone: "212-765-7080" };

function initialize()
{
    jQuery('#dlgComp').hide().addClass('smoothness').dialog
            ({
                autoOpen: false,
                modal: true,
                resizable: false,
                width: 766,
                height: 465,
                close: function(event, ui)
                {
                    jQuery('#dlgComp').html('');
                    jQuery('#container').hide();
                }
            });
    jQuery('#container').hide();
}
function showComp()
{
    jQuery('#container').show();
    if (swfobject.hasFlashPlayerVersion("6.0.65"))
    {
        swfobject.embedSWF(urlStr + "ReservationWidget.swf", "rescompcontainer", "100%", "100%", "6.0.65", "", flashvars, params, attrs);
    }
    else
    {
        var htmlURL = urlStr + "HTMLComponentHolder.aspx?rid=" + flashvars.rid;
        jQuery('#dlgComp').html('<iframe id="modalIframeId" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" />').dialog("open").parents(".ui-dialog:first").find(".ui-dialog-titlebar").hide();
        jQuery('#modalIframeId').attr('src', htmlURL);
    }
}
function hideComponent()
{
    jQuery('#container').hide();

    setTimeout(function()
    {
        swfobject.removeSWF("ReservationWidget");
        jQuery('#container').append("<div id='rescompcontainer' />");
    }, 100);
}

google.setOnLoadCallback(initialize);

/* End MOR Reservation System */

$(document).ready(function()
{
    preloadImages();

    $('a#btnReservationSidebar').colorbox({ width: "500", height: "650", iframe: true });
    $('a#lnkReservationSidebar').colorbox({ width: "500", height: "650", iframe: true });
    $('a#lnkReservationFooter').colorbox({ width: "500", height: "650", iframe: true });   
    
    // ----- Begin MOR Reservations Event Handler ----- //
//    $('a#btnReservationSidebar')
//        .bind('click', function(event)
//        {
//            alert("Our reservation system is in the process of being upgraded.  Please call to make a reservation at this time.");
//            showComp();
//        });
//    $('a#lnkReservationSidebar')
//        .bind('click', function(event)
//        {
//            alert("Our reservation system is in the process of being upgraded.  Please call to make a reservation at this time.");
//            showComp();
//        });
//    $('a#lnkReservationFooter')
//        .bind('click', function(event)
//        {
//            alert("Our reservation system is in the process of being upgraded.  Please call to make a reservation at this time.");
//            showComp();
//        });
    // ----- End MOR Reservations Event Handler ----- //

    // ----- Begin jQuery Photo Gallery ----- //
    $(function()
    {
        $('#gallery a').lightBox();
    });
    // ----- End jQuery Photo Gallery ----- //
    // ----- Begin jQueryUI Tabs ----- //
    $('#tabs').tabs();
    // ----- End jQueryUI Tabs ----- //    
    // ----- Begin jQuery qTip ----- //
    $('#main a[rel]').each(function()
    {
        $(this).qtip(
      {
          content: {
              // Set the text to an image HTML string with the correct src URL to the loading image you want to use
              text: '<img src="../../App_Themes/Eatery-Custom/Images/eatery-logo.png" alt="Loading..." />',
              url: $(this).attr('rel') // Use the rel attribute of each element for the url to load
              //              title: {
              //                  text: 'Delivery' // Give the tooltip a title using each elements text                  
              //              }
          },
          position: {
              corner: {
                  target: 'bottomMiddle', // Position the tooltip above the link
                  tooltip: 'topMiddle'
              },
              adjust: {
                  screen: true // Keep the tooltip on-screen at all times
              }
          },
          show: {
              when: 'click',
              solo: true // Only show one tooltip at a time
          },
          hide: 'unfocus',
          style: {
              tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
              border: {
                  width: 0,
                  radius: 4,
                  color: '#6D6F9D'
              },
              name: 'light', // Use the default light style
              width: 570 // Set the tooltip width                           
          }
      });
    });
    // ----- End jQuery qTip ----- //

    $('img#GalleryImage1')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage1', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-1-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage1', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-1.png');
        });
    $('img#GalleryImage2')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage2', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-2-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage2', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-2.png');
        });
    $('img#GalleryImage3')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage3', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-3-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage3', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-3.png');
        });
    $('img#GalleryImage4')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage4', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-4-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage4', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-4.png');
        });
    $('img#GalleryImage5')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage5', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-5-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage5', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-5.png');
        });
    $('img#GalleryImage8')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage8', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-8-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage8', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-8.png');
        });
    $('img#GalleryImage9')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage9', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-9-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage9', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-9.png');
        });
    $('img#GalleryImage10')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage10', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-10-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage10', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-10.png');
        });
    $('img#GalleryImage11')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage11', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-11-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage11', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-11.png');
        });
    $('img#GalleryImage12')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage12', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-12-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage12', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-12.png');
        });
    $('img#GalleryImage13')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage13', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-13-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage13', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-13.png');
        });
    $('img#GalleryImage14')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage14', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-14-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage14', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-14.png');
        });
    $('img#GalleryImage15')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage15', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-15-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage15', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-15.png');
        });
    $('img#GalleryImage16')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage16', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-16-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage16', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-16.png');
        });
    $('img#GalleryImage17')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage17', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-17-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage17', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-17.png');
        });
    $('img#GalleryImage18')
        .bind('mouseover', function(event)
        {
            rollImage('GalleryImage18', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-18-rollover.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('GalleryImage18', '/App_Themes/Eatery-Custom/ImagesGallery/eatery-slideshow-18.png');
        });
    $('img#twitter')
        .bind('mouseover', function(event)
        {
            rollImage('twitter', '/App_Themes/Eatery-Custom/Images/twitter-over.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('twitter', '/App_Themes/Eatery-Custom/Images/twitter.png');
        });
    $('img#facebook')
        .bind('mouseover', function(event)
        {
            rollImage('facebook', '/App_Themes/Eatery-Custom/Images/facebook-over.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('facebook', '/App_Themes/Eatery-Custom/Images/facebook.png');
        });
    $('img#visitwhym')
        .bind('mouseover', function(event)
        {
            rollImage('visitwhym', '/App_Themes/Eatery-Custom/Images/visit-whym-link-over.png');
        })
        .bind('mouseout', function(event)
        {
            rollImage('visitwhym', '/App_Themes/Eatery-Custom/Images/visit-whym-link.png');
        });
});

// Google Analytics Tracking (Standard)


function specialsMouseover(offer)
{
    pageTracker._trackPageview("/Specials/" + offer + "/Mouseover");
}
function specialsClicked(offer)
{
    pageTracker._trackPageview("/Specials/" + offer + "/Clicked");
}

// Google Analytics Tracking (Custom)

function menu1Click(sender, e)
{
    pageTracker._trackPageview('/Menu/Lunch/Clicked');
}
function menu1Mouseover(sender, e)
{
    pageTracker._trackPageview('/Menu/Lunch/Mouseover');
}
function menu2Click(sender, e)
{
    pageTracker._trackPageview('/Menu/Dinner/Clicked');
}
function menu2Mouseover(sender, e)
{
    pageTracker._trackPageview('/Menu/Dinner/Mouseover');
}

// Menu Tabs

function lunchPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Lunch/Clicked');
}
function brunchPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Brunch/Clicked');
}
function dinnerPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Dinner/Clicked');
}
function dessertPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Dessert/Clicked');
}
function drinksPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Drinks/Clicked');
}
function wineListPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/WineList/Clicked');
}
function prixFixePanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Delivery/Clicked');
}

// Submit Button Clicked

function btnSubmitContactUs(sender, e)
{
    pageTracker._trackPageview('/Contact-Us/SubmitButton/Clicked');
}