﻿/* 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: "46B33625-5D1B-4597-88B2-C0969767A31C", analyticsID: "UA-8048064-1", phone: "212-315-0088" };

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 */

// JQuery Functions (Custom)

$(document).ready(function()
{
    $('input#btnLaunch').bind('click', function(event)
    {
        showComp();
    });
    $('a#btnReservationsFooterNav').bind('click', function(event)
    {
        showComp();
    });    
});

// 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/Prix-Fixe/Clicked');
}

// Submit Button Clicked

function btnSubmitContactUs(sender, e)
{
    pageTracker._trackPageview('/Contact-Us/SubmitButton/Clicked');
}

// Photo Gallery

function makeInitialImageVis(imageID)
{
    var x = document.getElementById(imageID);
    x.style.visibility = "visible";    
}
function makeInitialImageInvis(imageID)
{
    var x = document.getElementById(imageID);
    x.style.visibility = "hidden";
}

// Reservation Popup

function popReservationWindow()
{
    window.open("https://reservations.themagellannetwork.com/reservations/iframe.aspx?rsname=whym", "resWindow", "height = 500, width = 455, location = no, menubar = no, resizable = yes, scrollbars = yes, status = no, toolbar = no");
}
