﻿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 = GE("iframeFicha");
    if(nueva)
    {
        var a = new Date();
        url += ((url.indexOf("?")>0)?"&":"?") + a.getUTCMilliseconds();
    }
    //o.src = url;
    o.height = FlotanteHeight+"px";
    //alert(screen.height+"|"+document.documentElement.clientHeight+"|"+o.height);
    o.width = FlotanteWidth+"px";
    $get("Button1").click();
    o.src = url;
}

function hola()
{
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("Ciclo Hídrico - "+n, b);
}

function mail(subject, body)
{
    window.open("mailto:?subject="+subject+"&amp;body="+body);
}
function iprint()
{
    window.frames['iframeFicha'].focus(); 
    window.frames['iframeFicha'].print(); 
} 
