// Modal window
function onDocumentReady() {
    $(".callModal").click(function() {
        //$this = $(this);
        callModal($this.attr("href"));
        return false;
    })
}

function callModal(path) {
    var $modal = $('.jqmWindow');
	
    $modal.jqm({
        //modal : true,
        overlay : 70,
        toTop : true
    });
	
    $modal.jqmAddClose(".close");
    $modal.jqmShow();
    //$(".jqmWindow .title").attr("src", "../images/html/eng/tit_agregar_comentario.gif");
    $(".jqmWindow iframe").html("").attr("src", path);
	
    $modal
    .animate({
        opacity : 0
    }, {
        duration : 0,
        queue : false
    })
    .animate({
        opacity : 1
    }, {
        duration : 600,
        queue : false
    });
}

function callModal2(path, ancho, alto) {
    var $modal = $('.jqmWindow2');

    $modal.jqm({
        //modal : true,
        overlay : 70,
        toTop : true
    });

    var margenIzq = (ancho / 2) * -1;
    var margenArriba = (alto / 2) * -1;

    $("#content2").css({width: ancho+'px', height: alto+'px'});
    $("#cont_iframe2").css({width: ancho+'px', height: alto+'px'});
    $(".jqmWindow2").css({marginTop:margenArriba+'px', marginLeft: margenIzq+'px'});

    $modal.jqmAddClose(".close");
    $modal.jqmShow();
    //$(".jqmWindow .title").attr("src", "../images/html/eng/tit_agregar_comentario.gif");
    $(".jqmWindow2 iframe").html("").attr("src", path);

    $modal
    .animate({
        opacity : 0
    }, {
        duration : 0,
        queue : false
    })
    .animate({
        opacity : 1
    }, {
        duration : 600,
        queue : false
    });
}

function closeModal(param) {
    if (param == '1') {
        location.reload();
    } else {
        $('.jqmWindow').jqmHide();
    }
}

function closeModal2(param) {
    if (param == '1') {
        location.reload();
    } else {
        $('.jqmWindow2').jqmHide();
    }
}