﻿
function jsExecute(funct) {
    ejecuta =  funct.substring(funct.indexOf(":")+1);
    eval(ejecuta);
//    var x = GE("fila_30848");
//    x.click();
    
}
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 abrirVentanaFlotante(url, nueva) {
    
    //var capa = GE("ctl00_ContentPlaceHolder1_panelRedondeadoFrame_tematica");
    //capa.style.visibility = "visible";


    try {
        document.getElementById("divSignin").style.display = "block";
 
        objDiv = document.getElementById("divg");
        objDiv.style.display = "block";
        objDiv.style.width = document.body.offsetWidth;   //scrollWidth;
        objDiv.style.height = document.body.offsetHeight;  //scrollHeight;
        fnSetDivSigninLeft("divSignin");

    }
    catch (e) {
        alert(e);
    }
    return false

}


function fnSetDivSigninLeft(oElement)  
 {  
    var DivWidth = parseInt(document.getElementById(oElement).offsetWidth,10)  
    var DivHeight = parseInt(document.getElementById(oElement).offsetHeight,10)  
    document.getElementById(oElement).style.left = (document.body.offsetWidth / 2) - (DivWidth / 2) - 50;


    var e = document.getElementById("contenidoBlanco");
    e.style.visibility = "hidden";
    var e = document.getElementById("contenidoCargando");
    e.style.visibility = "visible";
    
    return false;       
 }  



function cerrarVentanaFlotante() {
//    var o = GE("ctl00_ContentPlaceHolder1_panelRedondeadoFrame_tematica");
    //    o.style.visibility = "hidden";
          document.getElementById("divSignin").style.display="none";      
         objDiv = document.getElementById("divg");  
         objDiv.style.display = "none";   
         return false;
}

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(); 
} 

