﻿$(document).ready(function() {

    $("#leer").click(function() {
        if ($(".condiciones").is(":hidden")) {
            $(".condiciones").slideDown("slow");
        }
        else {
            $(".condiciones").slideUp("slow");
        }



    });




    $(".lightBoxMeytel").click(function() {

        var hRef = $(this).attr("href");
        var width = $(this).attr("name");
        var height = $(this).attr("rel");
        window.scroll(500, 20);
        $(".lightBoxInner").show();
        //        $(".lightBoxContent").css('padding-top', '20px');
        //        $(".lightBoxContent").css('background', 'url(/images/500top.png) no-repeat');

        $(".lightBoxContent").html('<img id="top" src="/images/500top.png"  style="float: left; display:block; width:' + width + 'px;   margin-top:-11px; height:13px;  "/><iframe id="mylightbox"  width=' + width + ' height=' + height + ' src=' + hRef + ' frameborder=0 style="margin-left:0px;"></iframe><img src="/images/500bottom.png" id="bottom"  style="float: left; width:' + width + 'px;    height:13px; margin-bottom:-12px; "/>');
        $(".lightBoxInner").css('width', '100%');
        $(".lightBoxInner").css('height', document.body.offsetHeight + 120);

        $(".lightBoxContent").css('left', (document.body.clientWidth / 2) - (width / 2));
        $(".lightBoxContent").css('top', '30%');
        $(".lightBoxContent").css('width', width + 'px');
        var alto = parseInt(height) + 2;
        $(".lightBoxContent").css('height', alto + 'px');

        return false;
    });


    $("#lightBoxMeytelclose").click(function() {


        var padre = $(window.parent.document);
        $(padre).find(".lightBoxInner").hide();
        $(padre).find(".lightBoxContent").css('width', '0px');
        $(padre).find(".lightBoxContent").css('height', '0px');
        $(padre).find(".lightBoxContent").html('');

        window.parent.document.location.href = window.parent.document.location.href;


        return false;
    });


    $("#lightBoxMeytelcloseopen").click(function() {




        var hRef = $(this).attr("href");
        var width = $(this).attr("name");
        var height = $(this).attr("rel");

        var padre = $(window.parent.document);
        $(padre).find(".lightBoxContent").css('width', width + 'px');


        var alto = parseInt(height) + 2;
        $(padre).find(".lightBoxContent").css('left', (screen.width / 2) - (width / 2));
        $(padre).find(".lightBoxContent").css('height', alto + 'px');
        $(padre).find("#top").css('width', width + 'px');
        $(padre).find("#bottom").css('width', width + 'px');
        $(padre).find("iframe").attr('width', width + 'px');
        $(padre).find("iframe").attr('height', height + 'px');
        $(padre).find("iframe").attr('src', hRef);




        return false;
    });

    $("#lightBoxMeytelrecuperar").click(function() {




        var hRef = $(this).attr("href");
        var width = $(this).attr("name");
        var height = $(this).attr("rel");
  
        var padre = $(window.parent.document);
        var alto = parseInt(height) + 2;
        $(padre).find(".lightBoxContent").css('left', (screen.width / 2) - (width / 2));
        $(padre).find(".lightBoxContent").css('height', alto + 'px');
        $(padre).find("#top").css('width', width + 'px');
        $(padre).find("#bottom").css('width', width + 'px');

        $(padre).find("iframe").attr('width', width + 'px');
        $(padre).find("iframe").attr('height', height + 'px');
        $(padre).find("iframe").attr('src', hRef);




        return false;
    });






});

function resize() {

    var padre = $(window.parent.document);

    $(padre).find("iframe").attr('width', 540 + 'px');
    $(padre).find("iframe").attr('height', 350 + 'px');





    return false;
}

function CloseOnReload() {
    alert("El registro se ha efectuado correctamente");
    window.parent.document.location.href = window.parent.document.location.href;
   
    return false;
}
function CloseOnReloadModificar() {
    alert("Los datos se han modificado correctamente");
    window.parent.document.location.href = window.parent.document.location.href;

    return false;
}
function CloseaccesoOnReload() {
  
    
    window.parent.document.location.href = window.parent.document.location.href;

    return false;
}
function CloseOnReloadeliminar() {
    alert("El usuario se ha eliminado correctamente");
    window.parent.document.location.href = window.parent.document.location.href;

    return false;
}




