﻿/// <reference path="~/desktopmodules/intevista/js/jquery-1.3.2.min.vsdoc.js"/>

$(document).ready(function () {

    $("input[type=button].iv_rsvp").live("click", function () {
        var oParent = $(this).parent("div");
        var oSibling = $(oParent).siblings("#RSVP");
        var oEvent = $("a[href='/desktopmodules/intevista/public/listings/schedule.aspx?" + $(this).attr("qs") + "']").parent("div");
        var exe = $(this).attr("execute");
        $.get("/desktopmodules/intevista/public/listings/rsvp.aspx?" + $(this).attr("qs"), null, function (e) {
            if (e == "true") {
                if (exe != undefined) {
                    var frm = "<form target='_blank' action='" + exe + "' id='rsvpform'></form>";
                    $("body").append(frm);
                    $("#rsvpform").submit().remove();
                }
                oParent.hide();
                oSibling.show();
                oEvent.addClass("iv_calendarevent_rsvp");
            }
        });
        return false;
    });

    $("#Active > input[type=button]").live("click", function () {
        var url = $(this).attr("qs");
        var frm = "<form target='_blank' action='" + url + "' id='activeform'></form>";
        $("body").append(frm);
        $("#activeform").submit().remove();
        //var oWindow = window.open($(this).attr("qs"));
        //if (oWindow.length == 0)
        //    window.location = $(this).attr("qs");
        return false;
    });


});