﻿

var Events = null;
var EventsCount = 0;

var _gOverlayDialogTitle = "";
var _gUpcomingEventDetails = null;
var _gUpcomingEventTopics = null;


function GetEvents() {
    jQuery.ajax({
        type: "GET",
        url: "/service.svc/events/",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            Events = msg.Events;
            EventsCount = msg.TotalCount;

            $("#panel_body_photoalbum").load("pages/PhotoAlbumBox.aspx");
            $("#panel_body_videoalbum").load("pages/VideoAlbumBox.aspx");

        },
        error: function(xhr, msg, e) {
        }
    });

}

$(function() {
    DD_roundies.addRule('.roundie', '7px', true);
    DD_roundies.addRule('.edgy', '5px', true);
    DD_roundies.addRule('.roundbottom', '0px 0px 7px 7px', true);
    DD_roundies.addRule('.roundtop', '6px 6px 0px 0px', true);

    $(".scrollable").scrollable({ size: 6, loop: true, speed: 600, easing: 'easeInOutBack' })
                            .circular()
                            .autoscroll()
                            .find("a").overlay(
            {
                target: '#gallery', // each trigger uses the same overlay with id "gallery"
                expose: '#222',
                closeOnClick: false // clicking outside the overlay does not close it

            }).gallery(
            {
                disabledClass: 'inactive'  // do not use the same disabled class name as scrollable
            });

    /************************ UPCOMING EVENT ***************************************/
    _gUpcomingEventDetails = $("#UpcomingEventDetailsOverlay").overlay(
            {
                expose:
                {
                    color: '#333',
                    loadSpeed: 200,
                    opacity: 0.9
                },
                onBeforeLoad: function() {

                    $("#UpcomingEventDetailsOverlayBody").html('<iframe id="bite_me_safari_' + new Date().getTime() + '" src="pages/UpcomingEventDetails.aspx" width="608px" height="410px" frameborder="0"></iframe>');
                },
                closeOnClick: false
            });
    _gUpcomingEventTopics = $("#UpcomingEventTopicsOverlay").overlay(
            {
                expose:
                {
                    color: '#333',
                    loadSpeed: 200,
                    opacity: 0.9
                },
                onBeforeLoad: function() {

                    $("#UpcomingEventTopicsOverlayBody").html('<iframe id="bite_me_safari_' + new Date().getTime() + '" src="pages/UpcomingEventTopics.aspx" width="608px" height="410px" frameborder="0"></iframe>');
                },
                closeOnClick: false
            });


    $('.event_details_links').click(function() {
        switch ($(this).attr("id")) {
            case "amore_about":
                {
                    window.location = "/EventArch.aspx";
                    //_gUpcomingEventDetails.overlay().load();
                    break;
                }
            case "a_event_info":
                {
                    _gUpcomingEventTopics.overlay().load();
                    break;
                }

        }

    });

    //$('#playerDiv').append('<img alt="" src="Images/Thumbnails/IMG_5337.jpg">').css("backgroundColor", "#000");
    
    //$('#playerDiv img').css({ opacity: 0.6 });

//    $('#playme').hover(function() {
//        $(this).removeClass("playme_off").addClass("playme_on");
//        $('#playerDiv img').animate({ opacity: 1 }, 700);
//    }, function() {
//        $(this).removeClass("playme_on").addClass("playme_off");
//        $('#playerDiv img').animate({ opacity: 0.6 }, 700);
//    });

//    $('#playme').click(function() {
//        var MessagePlayer = '<object width="515" height="338" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"' +
//                            'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="FlexPlayer">' +
//                            '<param value="/players/SharekPlayer2.swf" name="movie" />' +
//                            '<param value="high" name="quality" />' +
//                            '<param value="transparent" name="wmode" />' +
//                            '<param value="#000000" name="bgcolor" />' +
//                            '<param value="sameDomain" name="allowScriptAccess" />' +
//                            '<param value="true" name="AllowFullScreen" />' +
//                            '<param value="videourl=http://sharek.eg/service.svc/player/playlist" name="flashVars" />' +
//                            '<embed height="338" align="middle" width="515" type="application/x-shockwave-flash" ' +
//                            'src="/players/SharekPlayer2.swf" flashvars="videourl=http://sharek.eg/service.svc/player/playlist" ' + 
//                            'quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" ' +
//                            'play="true" name="FlexPlayer" loop="false" bgcolor="#000000" allowscriptaccess="sameDomain" ' +
//                            'allowfullscreen="true" wmode="transparent" /></object>';

//        $('#playerDiv').html(MessagePlayer);


//    });
    /************************ END UPCOMING EVENT ***************************************/

});


