﻿$(document).ready(function () {

    // Gizlilik politikası, kullanıcı sözleşmesi gibi dinamik içerikleri lightbox ile görüntülemekte kullanılıyor.
    $(".lightboxlink").bind("click", function () {
        var title = $(this).attr("title");
        $.ajax({
            type: "GET",
            dataType: "json",
            cache: true,
            aysnc: true,

            url: "/SecureSiteContent/GetContentFromAjax",
            data: { seoUrl: $(this).attr("href") },
            success: function (data) {
                $('.GPUyari1').html(title);
                $('.GPIcerik').html(data.Body);
                $.fancybox($('#infoContent').html(), {
                    'showCloseButton': false,
                    'autoScale': true,
                    // 'autoDimensions': false,
                    'titleShow': false,
                    'transitionIn': 'none',
                    'transitionOut': 'none',
                    'padding': 0,
                    'width': 798,
                    'onComplete': function () { $("#fancybox-wrap").width("0px"); }
                });
            },
            error: function (error) {   
               // alert(error);
            }
        });

        return false;
    });
});

function GetErrorFromAjax(key,replaceField,replaceText) {
    // Gizlilik politikası, kullanıcı sözleşmesi gibi dinamik içerikleri lightbox ile görüntülemekte kullanılıyor.
    $.ajax({
        type: "GET",
        dataType: "json",
        cache: true,
        aysnc: true,

        url: "/SiteContent/GetErrorFromAjax",
        data: { id: key },
        success: function (data) {
            showAlert(data.ContentBody.replace(replaceField, replaceText));
        },
        error: function (error) {
         
        }

    });
}

function GetShortErrorFromAjax(key, replaceField, replaceText) {
    // Gizlilik politikası, kullanıcı sözleşmesi gibi dinamik içerikleri lightbox ile görüntülemekte kullanılıyor.
    $.ajax({
        type: "GET",
        dataType: "json",
        cache: true,
        aysnc: true,

        url: "/SiteContent/GetErrorFromAjax",
        data: { id: key },
        success: function (data) {
            showShortAlert(data.ContentBody.replace(replaceField, replaceText));
        },
        error: function (error) {

        }

    });
}

function showShortAlert(message) {
    conf4 = new Confirmer();
    conf4.animatePopup = false;

    conf4.displayHtml = "<div class='PDFBoxTop390px'><div class='UyariKrsXV1'>Dikkat</div><div class='PDFBox3'><img alt='' style='cursor: pointer; margin-left: 30px' src='/Content/img/uye_giris_x_v1.jpg' onclick='conf4.Dispose();' /></div></div><div class='PDFBoxContent390px'><div class='UyariKrsIcerikSol'></div> <div class='UyariKrsIcerikSagV1'>" + message + "</div> <div class='UyariKrsIcerikLineSifre'><img src='/Content/img/btn_tamam.gif' alt='' style='cursor:pointer' onclick='conf4.Dispose();' /></div><div class='clearer'></div><br /></div><div class='PDFBoxBottom390px'></div>";
    var outerWidth = 406;  // Soldan uzaklığı verir
    var outerHeight = 300;  // Üstten uzaklığı verir

    conf4.top = (($(window).height() - outerHeight) / 2) + $(window).scrollTop() + "px"; //$(window).scrollTop() + 200 + "px";
    conf4.left = (($(window).width() - outerWidth) / 2) + $(window).scrollLeft() + "px"; /* 	INTERNAL-3574 */
    conf4.bgColor = "";
    conf4.borderLeft = "";
    conf4.borderTop = "";
    conf4.borderRight = "";
    conf4.borderBottom = "";
    conf4.borderBottom = "";
    conf4.width = "406px";
    conf4.height = "";
    conf4.Render();
}

function showAlert(message) {
    conf3 = new Confirmer();
    conf3.animatePopup = false;
    //conf3.displayHtml = "<div class='contentBoxTop406px'><span class='contentBoxIcerik'>Dikkat...</span><span style='padding-left:300px;height:70px;' ><img id='btnCloseWaitPanel' src='/content/img/1empty.gif' width='20' height='35' style='cursor: pointer;cursor: hand;' onclick='conf3.Dispose();'/></span></div><div class='contentBoxContent406px'><div class='content406Icerik'><br/>" + message + "<br /> <br /><img src='/Content/img/btn_tamam.gif' alt='' style='cursor:pointer' onclick='conf3.Dispose();' /></div></div><div class='clearer'></div><div class='content406'></div></div>";
    conf3.displayHtml = "<div class='PDFBoxTop390px'><div class='UyariKrsXV1'>Dikkat</div> <div class='UyariKrsX2'><img  style='cursor:pointer' src='/Content/img/uye_giris_x_v1.jpg' alt='' onclick='conf3.Dispose();' /></div></div><div class='PDFBoxContent390px'><div class='UyariKrsLoginSol'></div> <div class='UyariKrsLoginSag'>" + message + "</div> <div class='UyariKrsIcerikLineBtn'><img src='/Content/img/btn_tamam.gif' alt='' style='cursor:pointer' onclick='conf3.Dispose();' /></div><div class='clearer'></div><br />  </div><div class='PDFBoxBottom390px'></div>";
    var outerWidth = 406;  // Soldan uzaklığı verir
    var outerHeight = 300;  // Üstten uzaklığı verir
    conf3.top = (($(window).height() - outerHeight) / 2) + $(window).scrollTop() + "px"; //$(window).scrollTop() + 200 + "px";
    conf3.left = (($(window).width() - outerWidth) / 2) + $(window).scrollLeft() + "px"; /* 	INTERNAL-3574 */
    conf3.bgColor = "";
    conf3.borderLeft = "";
    conf3.borderTop = "";
    conf3.borderRight = "";
    conf3.borderBottom = "";
    conf3.borderBottom = "";
    conf3.width = "406px";
    conf3.height = "";
    conf3.Render();
}
