
$(document).ready(function () {
    $('a[name=modal]').click(function (e) {
        e.preventDefault();
        var id = $(this).attr('href');

        id = id.replace("javascript:", "");
        id = id.replace(";", "");
        id = id.replace("#", "");

        if (id == "UyeOl")
            id = "#dialog2";
        if (id == "UyeGiris")
            id = "#dialog222";

        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        $('#mask').css({ 'width': maskWidth, 'height': maskHeight });


        $('#mask').fadeIn(1000);
        $('#mask').fadeTo("slow", 0.8);

        var winH = $(window).height();
        var winW = $(window).width();

        if (document.getElementById("dvReklamUst") != null)
        document.getElementById("dvReklamUst").style.display = "none";


        $(id).css('top', winH / 2 - $(id).height() / 2);

        $(id).css('left', winW / 2 - $(id).width() / 2);

        $(id).fadeIn(2000);

    });
    $('.window .close').click(function (e) {

        e.preventDefault();
        $('#mask').hide();
        $('.window').hide();

        $('#mask2').hide();
        $('.window2').hide();
    });
    $('#mask').click(function () {

        if (document.getElementById("spnUyeGirisMsj") != null)
            document.getElementById("spnUyeGirisMsj").innerHTML = "";

        if (document.getElementById("ctl00_txtMailGiris") != null)
            document.getElementById("ctl00_txtMailGiris").value = "";
        if (document.getElementById("ctl00_txtSifreGiris") != null)
            document.getElementById("ctl00_txtSifreGiris").value = "";


        if (document.getElementById("dvReklamUst") != null)
            document.getElementById("dvReklamUst").style.display = "block";

        $(this).hide();
        $('.window').hide();
        $('.window2').hide();
    });

    $('.window2 .close2').click(function (e) {

        e.preventDefault();
        $('#mask2').hide();
        $('.window2').hide();

        $('#mask').hide();
        $('.window').hide();
    });
    $('#mask2').click(function () {

        $(this).hide();
        $('.window2').hide();
    });
});
