﻿
// window.onerror = function() {
//   return true;
//}

$(function() {

    $('.contentTip').bind("contextmenu", function(e) {
        e.preventDefault();
    });
    var asmxPage = "/WebService/WSAjaxPage.asmx/";
    $('.contentTip').bt({
        //contentSelector: "$('#hulu-content')",
        fill: 'rgba(100, 102, 102, .8)',
        strokeStyle: '#FFF',
        spikeLength: 15,
        spikeGirth: 10,
        width: '40%',
        closeWhenOthersOpen: true,
        centerPointY: 1,
        cornerRadius: 5,
        shrinkToFit: true,
        offsetParent: 'body',
        cssStyles: { color: '#FFF' },
        showTip: function(box) {
            try {
                var title = $(this).attr("bt-xtitle");
                if (title != "") {
                    //$('.bt-content').html(ReplaceAll($('.bt-content').html(), singleQuoteEncrypter, '\''));
                    $.ajax({
                        async: false,
                        type: "POST",
                        url: asmxPage + "DecodeHTMLText",
                        data: "{toolTip:'" + title + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function(resultReturn) {
                            var result = resultReturn.d;
                            $('.bt-content').html(result);
                            $(box).show();
                        }
                    });


                }
            }
            catch (err)
            { }

        }
    });
    //$('.contentTip').bt();
    $(".contentTip").click(function() {
        try {
            $('.contentTip').btOff();
        }
        catch (err) {
        }
    });


    $(".contentTip").fancybox({
        'titleShow': false,
        'padding': 10,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'width': '600px',
        'height': '600px',
        'scrolling': 'no',
        //    'type': 'iframe',

        onStart: function() {
            var href = $(this).attr("href");
            if (href == undefined || href == null || href == "")
                return false;
        }


    });


   // var fancybox = 
  
    $("a.iframeFancybox1").fancybox({
        'width': 760,
        'height': 400,
        'overlayOpacity': '0.4',
        'overlayColor': '#000',
        'hideOnContentClick': false,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'type': 'iframe'
    });


    // Function to replace all 'strReplace' with 'strReplaceWith'
    function ReplaceAll(str, strReplace, strReplaceWith) {

        var idx = str.indexOf(strReplace);

        while (idx > -1) {
            str = str.replace(strReplace, strReplaceWith);
            idx = str.indexOf(strReplace);
        }

        return str;
    }



});



//window.onerror = function() {
// //   alert('An error has occurred!');
//    return true;
//}
