$(document).ready(function() {
    /*
    $("#click-do-you-know").fancybox({
    'overlayOpacity': 0.7,
    'overlayColor': '#000000',
    'padding': 20,
    'width': 620,
    'height'            : '70%',
    'autoScale'         : false,
    'transitionIn': 'none',
    'transitionOut': 'none',
    'type': 'iframe',
    'callbackOnClose': function() { location.refresh(); }

    });
    */

    $("#click-do-you-know").click(function() {

        $.ajax({
            type: "POST",
            url: "/DoYouKnow.aspx/GetGetDoYouKnowItemAJAX",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                var message = "<div id='doyouknowitem'>" + msg.d + "<div style='clear:both;'></div></div>";

                $.fancybox(message, {
                    'autoScale': false,
                    'scrolling': 'no',
                    'padding': 0,
                    'margin': 0,
                    'overlayOpacity': 0.7,
                    'overlayColor': '#000000', 
                    'onComplete': function() {
                        height = $('#doyouknowitem').height() + 60;
                        $('#fancybox-wrap').height(height);
                    }
                });
            }
        });

    });

    /*
    $.ajax({
    type: "POST",
    url: "DoYouKnow.aspx/GetDate",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
    // Replace the div's content with the page method's return.
    $("#doyouknow-item").text(msg.d);
    }
    });
    */


    /*
    $('.fancybox').fancybox({
    'autoScale': false,
    'scrolling': 'no'
    });
    <a href="DoYouKnow.aspx" class="fancybox">Open Ajax.php</a>

*/

    /* http://www.dropthenerd.com/updated-resizing-fancybox-height-dynamically/ */

});
