var epl_rnd =(new String(Math.random())).substring(2,8) + (((new Date()).getTime()) & 262143);

function TabsManager()
	{
		this.tabArray = new Array();
		this.tabClassOn = "seleccionado";
		this.tabClassOff = "inactivo";
		this.contentClassOn = "contenidoOn";
		this.contentClassOff = "contenidoOff";
	}

	TabsManager.prototype.setTab = _TabsManagerSetTab;
	TabsManager.prototype.showTab = _TabsManagerShowTab;

	function _TabsManagerSetTab( tabId, contentId, tabState )
	{
		var tab = new Tab(tabId,contentId,tabState);
		this.tabArray.push(tab);
		switch(tabState)
		{
			case "on":
						document.getElementById(tabId).className = this.tabClassOn;
						document.getElementById(contentId).className = this.contentClassOn;
					break;
			case "off":
						document.getElementById(tabId).className = this.tabClassOff;
						document.getElementById(contentId).className = this.contentClassOff;
					break;
		}
	}

	function _TabsManagerShowTab( tabId )
	{
	    
		for(  i = 0 ; i < this.tabArray.length ; i ++)
		{		
			if ( this.tabArray[i].tabId == tabId)
			{
				document.getElementById(this.tabArray[i].tabId).className = this.tabClassOn;
				document.getElementById(this.tabArray[i].contentId).className = this.contentClassOn;
			}
			else
			{
				document.getElementById(this.tabArray[i].tabId).className = this.tabClassOff;
				document.getElementById(this.tabArray[i].contentId).className = this.contentClassOff;
			}
		}
	}


	function Tab( tabId, contentId, tabState)
	{
		this.tabId = tabId;
		this.contentId = contentId;
		this.tabState = tabState;
	}
	
	
/* Tamano de texto */
var t = 13;

function afuente(texto){
	if (t < 18 ){
		t++; 
		setFuentes(t,texto);
	}
}

function rfuente(texto){
	if (t > 11){
		t--;
		setFuentes(t,texto);
	}
}

function setFuentes(fontactual,idtexto){
	var lay = document.getElementById(idtexto);
	try{
		lay.style.fontSize = fontactual;
		lay.style.lineHeight = (fontactual + 4) + "px";
	}catch(e){
	}
}

function Popup(url,name,width,height,resize,scroll) {
	var dialogWin = new Object();
	dialogWin.width = width;
	dialogWin.height = height;
	now = new Date();
	var millis=now.getTime();
	var mstr=""+millis;
	if (navigator.appName == "Netscape") {
		dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
		dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
		var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	} else if (document.all) {
		dialogWin.left = (screen.width - dialogWin.width) / 2;
		dialogWin.top = (screen.height - dialogWin.height) / 2;
		var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
window.open(url,name,attr);
}	


/* validar voto */
function validarvoto(cant, estado,encuesta,formulario)
            {
                seleccion=false;
                
                if (estado){
                    for (i=0;i<cant;i=i+1)
                    {
                        if (document.getElementById(formulario).OPCION[i].checked) 
                        {
                            seleccion = true;
							pregunta_id = document.getElementById(formulario).OPCION[i].value 
							respuestas = '&respuestas='+pregunta_id;
                        }
                    }				
                    if (!seleccion) {
                        alert("Por favor, seleccione una respuesta ");
                        return false;
                    }
                }
                
				Popup('/includes/modulos/votar.asp?id='+encuesta+respuestas,'envio',520,455,'no','no')
				
}
		
		
function verresultados(cant, estado,encuesta)
{
				Popup('/includes/modulos/encuesta.asp?id='+encuesta+'&resultados=si','envio',520,455,'no','no')
				
}		

function comentarios_ingresa()
{
	
	id_noticia = document.form1.id_noticia.value  
	usuario = document.form1.usuario.value  
	clave = document.form1.clave.value  
	comentario = escape(document.form1.comentario.value)  
	
				Popup('/includes/modulos/comentarios.asp?login=no&id_noticia='+id_noticia+'&usuario='+usuario+'&clave='+clave+'&comentario='+comentario+'','envio',350,430,'no','no')
				
}	


function comentarios()
{
	
	id_noticia = document.form1.id_noticia.value  
	comentario = document.form1.comentario.value  
	
				Popup('/includes/modulos/comentarios.asp?login=si&id_noticia='+id_noticia+'&comentario='+comentario+'','envio',350,430,'no','no')
				
}		

function ShowBanner(NombreObjeto,estado)
{
	document.getElementById(NombreObjeto).style.display=estado;
}

function LimpiaBanner(NombreObjeto)
{
	document.getElementById(NombreObjeto).style.display="none";
}

function DesapareceBanner(NombreObjeto)
{
	window.setTimeout('LimpiaBanner(NombreObjeto)', 11000);
}


function votar(id,voto,destino){


	$.ajax({
	url : "/includes/modulos/votacomentario.asp",
	data: "id="+id+"&voto="+voto+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}

function abuso(id,voto,destino){

	$.ajax({
	url : "/includes/modulos/resp_abuso.asp",
	data: "id="+id+"&voto="+voto+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}


function pasfoto(docid,id_foto,destino){

	$.ajax({
	url : "/includes/modulos/pasfoto.asp",
	data: "id_foto="+id_foto+"&docid="+docid+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}


function notaflecha(id_modulodinamico,orden,destino){

	$.ajax({
	url : "/includes/modulos/dinamicos/1.asp",
	data: "orden="+orden+"&id_modulodinamico="+id_modulodinamico+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}


function secc_din(id_modulodinamico,orden,destino){

	$.ajax({
	url : "/includes/modulos/dinamicos/2.asp",
	data: "orden="+orden+"&id_modulodinamico="+id_modulodinamico+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}


function secc_sociales(id_modulodinamico,orden,destino){

	$.ajax({
	url : "/includes/modulos/dinamicos/9.asp",
	data: "orden="+orden+"&id_modulodinamico="+id_modulodinamico+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}


function secc_fotodeldia(id,id_modulodinamico,destino){

	$.ajax({
	url : "/includes/modulos/dinamicos/8.asp",
	data: "id="+id+"&id_modulodinamico="+id_modulodinamico+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}

function respuesta(id_comentario,docid,destino){
	

	$.ajax({
	url : "/includes/modulos/respuestacoments.asp",
	data: "id_comentario="+id_comentario+"&docid="+docid+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}

function verprivado(id,destino){

	$.ajax({
	url : "/participacion/vermensajeprivado.asp",
	data: "id="+id+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}



function borramensaje(id,destino,destino2){

	$.ajax({
	url : "/participacion/borramensaje.asp",
	data: "id="+id+"",
	success : function (data) {
	$("#"+destino+"").html(''),
	$("#"+destino2+"").html('');
	},
	error : function (data) {
	$("#"+destino2+"").html('no se pudo eliminar el registro');
	}	
	});

}


		
        //Edit the counter/limiter value as your wish
        var count = "500";
        function limiter(){
        var tex = document.form1.comentario.value;
        var len = tex.length;
        if(len > count){
                tex = tex.substring(0,count);
                document.form1.comentario.value =tex;
                return false;
        }
        document.form1.limit.value = count-len;
        }
     

function showlayer(layer){
	var myLayer=document.getElementById(layer);
	if(myLayer.style.display=="none" || myLayer.style.display==""){
		myLayer.style.display="block";
	} else { 
		myLayer.style.display="none";
		}
}




function verenviarsociales(idf,id_social,nrofoto,destino){

	$.ajax({
	url : "/includes/ajax/enviarsociales.asp",
	data: "idf="+idf+"&id_social="+id_social+"&nrofoto="+nrofoto+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}

function verenviarfotolectores(id_foto,destino){

	$.ajax({
	url : "/includes/ajax/enviafotolectores.asp",
	data: "id_foto="+id_foto+"",
	success : function (data) {
	$("#"+destino+"").html(data);
	}
	});

}





