﻿/* 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: "3A2F0E4D-74C5-4F16-93D2-E43E8BD450C5", analyticsID: "UA-7199156-1", phone: "970-259-3417" };

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#btnReservationsMainNav').bind('click', function(event)
    {
        showComp();
    });
    $('a#btnReservationsFooterNav').bind('click', function(event)
    {
        showComp();
    });
});

// Menu Tabs

function appetizersPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Appetizers/Clicked');
}
function entreesPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Entrees/Clicked');
}
function dessertsPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Desserts/Clicked');
}
function wineListPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Wine List/Clicked');
}
function lunchPanelClick(sender, e)
{
    pageTracker._trackPageview('/Menu/Lunch/Clicked');
}

// Submit Button Clicked

function btnSubmitContactUs(sender, e)
{
    pageTracker._trackPageview('/Contact-Us/SubmitButton/Clicked');
}

// Reservation Popup

function popReservationWindow()
{
    window.open("https://reservations.themagellannetwork.com/reservations/iframe.aspx?rsname=snapper", "resWindow", "height = 500, width = 455, location = no, menubar = no, resizable = yes, scrollbars = yes, status = no, toolbar = no");
}