
function initialize() {
jQuery.noConflict();
jQuery('#dlgComp').hide().addClass('smoothness').dialog(
{ autoOpen: false, modal: true, resizable: false, width: 766, height: 465, close:
function(event, ui) {
jQuery('#dlgComp').html(''); jQuery('#res_container').hide()
}
});
jQuery('#res_container').hide();
checkForAction();
}

 google.load("jquery", "1.3.2");
 google.load("jqueryui", "1.7.2");
 google.load("swfobject", "2.2");
 google.setOnLoadCallback(initialize);

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: "79d798a4-8e83-4de5-bd4b-9f5b132bcad8", analyticsID: "XXXX", phone: "212-967-1919" };

function showComp(useQueryString) {
if (!useQueryString) {
flashvars["action"] = null;
flashvars["confirm"] = null;
}
jQuery('#res_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(' ').dialog("open").parents(".ui-dialog:first").find(".ui-dialog-titlebar").hide();
jQuery('#modalIframeId').attr('src', htmlURL);}
}

function hideComponent() {
jQuery('#res_container').hide();
swfobject.removeSWF("ReservationWidget");
jQuery('#res_container').append("<div id='rescompcontainer' />");
}


function getQuerystring(key) {
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]").toLowerCase();
var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
var qs = regex.exec(window.location.href.toLowerCase());
if (qs == null)
return "";
else
return qs[1];
}

function checkForAction() {
var action = getQuerystring("action");
var confirm = getQuerystring("confirm");
//if no flash and an action, show alt message
if (action.length > 0) {
if (swfobject.hasFlashPlayerVersion("6.0.65")) {
flashvars["action"] = action;
flashvars["confirm"] = confirm;
showComp(true);
}
else {
var notSupportedDiv = document.getElementById("notSupported");
var btnLaunch = document.getElementById("btnLaunch");
btnLaunch.style.display = "none";
notSupportedDiv.style.display = "block";
}
}
}