﻿///<reference path="jquery-1.3.2-vsdoc.js"  />

function abrirVentana(ruta, nueva)
{


    /*var e = GE("enlace");
    alert(e.click);
    e.click();
    return;*/
    /*var f = GE("form2");
    f.action = ruta;
    //alert(f.action);
	f.submit();
    return;
    */
    //var tam = "width=400,height=300,";
    var tam = "width="+(screen.width-50)+",height="+(screen.height-100)+",";
    var n = "v";
    if(nueva)
    {
        var a = new Date();
        n += ((n.indexOf("?")>0)?"&":"?") + a.getUTCMilliseconds();
    }
	ventanaDescargas = window.open(ruta, n, tam+"scrollbars,resizable,top=100,left=100");
	ventanaDescargas.focus();
}

function abrirVentanaFlotante(url, nueva) {
    var o = $("#iframeFicha");
    if (nueva) {
        var a = new Date();
        url += ((url.indexOf("?") > 0) ? "&" : "?") + a.getUTCMilliseconds();
    }

    o.height(screen.height / 2 + 100);
    o.width(FlotanteWidth);
    $("#panelframe").css("visibility", "visible");
    $("#capaT").css("visibility", "visible");
    o.attr("src", url);
}

function hola()
{
    var capa= GE("panelframe");
    capa.style.visibility="hidden";
    capa= GE("capaT");
    capa.style.visibility="hidden";
    var o = GE("iframeFicha");
    o.src = "loading.htm";
}

function q(obj)
{
    var s = "";
    for(i in obj)
    {
        s += i+"\t";
    }
    alert(s);
}
                   
function GE(id)
{
    return document.getElementById(id);
}

function devolverDecimales(valor, numDecimales)
{
	var n = Math.pow(10, numDecimales);
	var res = valor;
	res*=n;
	res=Math.round(res);
	res/=n;
	return res;
}

function mandarMail(titulo)
{
    var n = $get(titulo).innerHTML;
    var b = "Vea la ficha de '"+n+"': "+window.location;
    mail("Medioambiente - "+n, b);
}

function mail(subject, body)
{
    window.open("mailto:?subject="+subject+"&amp;body="+body);
}
function iprint()
{
    window.frames['iframeFicha'].focus(); 
    window.frames['iframeFicha'].print(); 
} 
