﻿var prp = 1;

function programa(){
   // divA = eval("document.getElementById('prgM')");
    cad = prp;
    if(cad==1) {
        //divA.style.backgroundImage = "url('/ActualidadUR/recursos/imagenes/btn_programacion3.png')";
        prp = 0;
        Act.open();
    }
    
     if(cad==0) {
      //  divA.style.backgroundImage = "url('/ActualidadUR/recursos/imagenes/transparent.png')";
        prp = 1;
        Act.close();
    }
}


function navNota(id, cont) 
{
    self.location = "/actualidad/visorNota.aspx?id=" + id + "&tpCont=" + cont;
}

function navNotaIfrm(id, cont) 
{
    parent.location = "/actualidad/visorNota.aspx?id=" + id + "&tpCont=" + cont;
}

function navBlogIfrm(id) 
{
    self.location = "/actualidad/visorNota.aspx?id=0&tpCont=0&idprg=" + id;
}

var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}
 
 
function createPlayer(multimedia)
{
  // alert(multimedia);
    var flashvars = {
            file:multimedia,
            autostart:"true"
    }
    var params = {
            allowfullscreen:"false", 
            allowscriptaccess:"always"
    }
    var attributes = {
            id:"player1",  
            name:"player1"
    }
    
    swfobject.embedSWF("/recursos/mediaplayer-4.4/player.swf", "placeholder1", "380", "20", "9.0.115", false, flashvars, params, attributes);
}

function playPlayer(mmedia) {
    if (player) {
        player.sendEvent('STOP');    	player.sendEvent('LOAD', mmedia);
    } else {
        createPlayer(mmedia);
    }
}

    var gMinSize_nv = 8;
    var gNumSizes_nv = 30;
    var gCurSize_nv =14;
    
    var anchoVsbl = 0;
	var altovsVsbl = 0;    
    
    function SetBigger()
    {
	    if (gCurSize_nv < gNumSizes_nv) {
		    gCurSize_nv += 2;
		    //SetSize();
		    cambiarTamano(gCurSize_nv,0);
	    }
    }

    function SetSmaller()
    {
	    if (gCurSize_nv > gMinSize_nv) {
		    gCurSize_nv += -2;
		    //SetSize();
		    cambiarTamano(gCurSize_nv,1);
	    }
    }
    
    function cambiarTamano(tam,masomenos) {
    		document.getElementById('NotaCont').style.fontSize = tam + 'px';
    		parent.tamFuente = tam;
    }


var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
}



var idNota = 0;

function mailMan(idnt) {   
    if(idnt > 0) {
        idNota = idnt;
        showMwdw('MAIL');
    }
}

function showMwdw(valor) {
    var alto = 0;
    var altoifrm = 0;
    var anchoifrm = 0;
    var ruta = '';
    
    if(valor == 'REG') {
        //DIMENSIONAMOS LAS HERRAMIENTAS PARA QUE ENCAJE EN EL REGISTRO
        alto = (myHeight - 470) / 2;
        altoifrm = 470;
        anchoifrm = 570;
        ruta = '/recursos/herramientas/registro.aspx';

    }
    
    if(valor == 'LGN') {
        //DIMENSIONAMOS LAS HERRAMIENTAS PARA QUE ENCAJE EN EL REGISTRO
        alto = (myHeight -250) / 2;
        altoifrm = 250;
        anchoifrm = 570;
        ruta = '/recursos/herramientas/login.aspx';

    }
    
    if(valor == 'MAIL') {
        //DIMENSIONAMOS LAS HERRAMIENTAS PARA QUE ENCAJE EN EL REGISTRO
        alto = (myHeight -270) / 2;
        altoifrm = 270;
        anchoifrm = 570;
        ruta = '/recursos/herramientas/EnvioNota.aspx?id=' + idNota;

    }      
    
    if(valor == 'CNT') {
        //DIMENSIONAMOS LAS HERRAMIENTAS PARA QUE ENCAJE EN EL REGISTRO
        alto = (myHeight -410) / 2;
        altoifrm = 410;
        anchoifrm = 570;
        ruta = '/recursos/herramientas/contactenos.aspx';

    }    
      
    document.getElementById('centerUp').style.height= alto +'px';
    document.getElementById('centerBtto').style.height= alto +'px';
    
    //DIMENSIONAMOS LAS VENTANAS
    Refnm.location.href = ruta;
    document.getElementById('celdaIfrm').style.height= altoifrm + 'px';
    document.getElementById('celdaIfrm').style.width= anchoifrm + 'px';
    document.getElementById('reg').style.height= altoifrm + 'px';
    document.getElementById('reg').style.width= anchoifrm + 'px';
    document.getElementById('bkgInf').style.zIndex = '99';
    document.getElementById('bkgInf').style.visibility = 'visible';
}

function cerrarReg(valor){
        
    if(valor == 'RFR') {
        document.location.reload(true);
    } else {
        document.getElementById('centerUp').style.height= '1px';
        document.getElementById('centerBtto').style.height= '1px';
        
        //DIMENSIONAMOS LAS VENTANAS
        Refnm.location.href = '/recursos/blank.htm';
        document.getElementById('celdaIfrm').style.height= '1px';
        document.getElementById('celdaIfrm').style.width= '1px';
        document.getElementById('reg').style.height= '1px';
        document.getElementById('reg').style.width= '1px';
        document.getElementById('bkgInf').style.zIndex = '0';
        document.getElementById('bkgInf').style.visibility = 'hidden';        
    }
}

function altoEnc() {

    alert(document.encuesta.offsetHeight+" "+document.getElementById("encuesta").scrollHeight);
    alert(document.encuesta.scrollHeight+" "+document.getElementById("encuesta").offsetHeight);
}

function buscar() {
    var svalue = document.getElementById('sstring').value;
    window.location = "/actualidad/buscador.aspx?SearchValue=" + svalue;
    //document.location.href = "/actualidad/buscador.aspx?SearchValue=" + svalue;
    //document.location ="/actualidad/buscador.aspx?SearchValue=" + svalue;
}

	var timerID = 0;
	var timerIDx = 0;
	var prox= 0;
	var cont = 1;
	var rot = 0;
	
	function acciona(actual, proxi, tipo) {
		prox= proxi;
		timerIDx = setTimeout("fadeeff('"+ tipo +"')", 250);
	}
	
	function fadeeff(tipo) {
	
        if(tipo >0) {
	        TabbedPanels6.showPanel(prox);
	    } else {
	        TabbedPanels2.showPanel(prox);
	    }
		
		clearTimeout(timerIDx);
		if (rot ==0) {
			timerID = setTimeout("rotador('"+ tipo +"')", 10250);
		}
	}
	
	
	function rotador(tipo)
	{
	    if(tipo >0) {
	        tope = tipo;
	    } else {
	        tope = 5
	    }
		
		if(timerID!= 0) {
			clearTimeout(timerID);
		}
 
		cont+=1;
		prox+=1;
		
		if(cont==tope) {
			cont = 1;
			prox=0;
		}		
 
		acciona('tab' +  cont, prox, tipo);
	}
	
	function fin_rota() {
		rot = 1;
		if(timerID!= 0) {
			clearTimeout(timerID);
		}
 
		timerID = 0;
	}
	
	actTab = 0;
	tab = 1;
	cargado = false;
	timerID = 0;
	
	function fTimer() {
	    if(tab == 4) {
	        tab = 0;
	    }
	    
	    showR(tab, 0);
	    tab++;

	    if (!cargado) {
          timerID = setTimeout("fTimer()", 12000);
        }
	}
	
	function rotaHome() {
	    timerID = setTimeout("fTimer()", 12000);
	}
	
	function stpTimer() {
	    clearTimeout(timerID);
	    cargado = true;
	}
	
	function showR(tab, tipo) {
	    if(tipo == 1) {
	        stpTimer();
	    }
	    //DESHACER ESTILO
	    var ev = eval("document.getElementById('tabb" + actTab + "').style.backgroundImage = \"url('/recursos/imagenes/bgvit.png')\";");
        //ev = eval("document.getElementById('tabb" + actTab + "').style.color = '#4f4f4f';");
      //  ev = eval("document.getElementById('tabb" + actTab + "').style.fontWeight = 'normal';");   
        
        //HACER ESTILO
        
        ev = eval("document.getElementById('tabb" + tab + "').style.backgroundImage = \"url('/recursos/imagenes/bgvitsel.png')\";");
        //ev = eval("document.getElementById('tabb" + tab + "').style.color = 'white';");
      //  ev = eval("document.getElementById('tabb" + tab + "').style.fontWeight = 'normal';");   
        
        vitHome.showPanel(tab);
	    
	    actTab = tab;
	}
	
function irhome() {   
    window.location="/";
}
