﻿try {
    window.alert = window.jqalert;
} catch (err) {
    window.alert('Your browser does not support overloading window.alert. ' + err);
}
/*-------------------------------------------------------------------*/
function alertJQuery(uyariYazisi) {
    $.prompt(uyariYazisi);
}
/*-------------------------------------------------------------------*/
function alertJQueryButton(buttonClientID, uyariYazisi) {
    $(function() {
        $(buttonClientID).click(function(e) {
            e.preventDefault();
            $.prompt(uyariYazisi);
        });
    });
}

/*
//MasterPage Kullanılıyorsa; alertJQueryButton için Client Tarafına Yazılacak Kod
//Hangi Butonda çalıştığını ve ekranda göstermek istediğimiz mesajı veriyoruz
//OnClientClick eventini çağırmaya gerek kalmadan <script language="javascript" type="text/javascript"> tagının içine fonksiyonu yazmak yeterli olacaktır..
$(function() {
alertJQueryButton('#<%= ButtonName.ClientID %>','Uyarı Mesajı');
});
*/
/*-------------------------------------------------------------------*/
function SilOnayJQuery(buttonClientID) {
    $(function() {
        $(buttonClientID).click(function(e) {
            e.preventDefault();
            $.prompt('Silinen kayıtlar geri alınamaz. Kaydı silmek istediğinizden emin misiniz ?', { buttons: { Ok: true, Cancel: false} });
        });
    });
}


function SilOnayJQueryOzelUyariMesajiIle(buttonClientID, uyariYazisi) {
    $(function() {
        $(buttonClientID).click(function(e) {
            e.preventDefault();
            $.prompt(uyariYazisi, { buttons: { Ok: true, Cancel: false} });
        });
    });
}

/*-------------------------------------------------------------------*/

function ModalPopUpJQuery() {
    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        //Get the A tag
        var id = $(this).attr('href');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({ 'width': maskWidth, 'height': maskHeight });

        //transition effect		
        $('#mask').fadeIn(1000);
        $('#mask').fadeTo("slow", 0.8);

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top', winH / 2 - $(id).height() / 2);
        $(id).css('left', winW / 2 - $(id).width() / 2);

        //transition effect
        $(id).fadeIn(2000);

    });

    //if close button is clicked
    $('.window .close').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').hide();
        $('.window').hide();
    });

    //if mask is clicked
    $('#mask').click(function() {
        $(this).hide();
        $('.window').hide();
    });
}


/*
//Client tarafına yazılacak code
    <!-- #dialog is the id of a DIV defined in the code below -->
    <a id="lnkSil" runat="server" href="#dialog" name="modal" visible="false">Sil</a>
    <div id="boxes">
        <!-- #customize your modal window here -->
        <div id="dialog" class="window">
            <b>Silinen kayıtlar geri alınamaz.
                <br />
                Silmek istediğinizden emin misiniz ? </b>
            <br />
            <br />
            <br />
            <!-- close button is defined as close class -->
            <asp:LinkButton ID="ButtonDevam" runat="server" OnClick="lnkSil_Click"><img src="../Images/tamam.jpg" /></asp:LinkButton>
            <asp:LinkButton ID="Cancel" runat="server" class="close"><img src="../Images/iptal.jpg" /></asp:LinkButton>
        </div>
        <!-- Do not remove div#mask, because you'll need it to fill the whole screen -->
        <div id="mask">
        </div>
    </div>
*/

/*-------------------------------------------------------------------*/
