
/* Manejo de Fuentes */
var codigonoticia = 0;
var codigopublicacion= 0;
var codigoseccion=0;
var codigodistrito=0;


function agrandarFontSize()
{
	ACTUAL_FONTSIZE = ACTUAL_FONTSIZE + 1;
	if (ACTUAL_FONTSIZE > MAYOR_FONTSIZE) 
		ACTUAL_FONTSIZE = MAYOR_FONTSIZE 
	document.all.spntxt.style.fontSize = ACTUAL_FONTSIZE;	
	salvarActualFontSize();
}

function achicarFontSize()
{
	ACTUAL_FONTSIZE = ACTUAL_FONTSIZE - 1;
	if (ACTUAL_FONTSIZE < MENOR_FONTSIZE) 
		ACTUAL_FONTSIZE = MENOR_FONTSIZE 
	document.all.spntxt.style.fontSize = ACTUAL_FONTSIZE;	
	salvarActualFontSize();
}

function salvarActualFontSize()
{
	expire = new Date();
	expire.setTime(expire.getTime()+(6000 * 24 * 3600000));
	guardarCookie("fontSize", ACTUAL_FONTSIZE, expire);
}

function levantarActualFontSize()
{
	tempC = document.cookie.split(";");
	for (index=0; index<tempC.length; index++)
	{
		if (tempC[index].indexOf('fontSize') > -1)
		{
			fontSizeValue = tempC[index].split("=")
			ACTUAL_FONTSIZE = parseInt(fontSizeValue[1]);
		}
	}
}

ACTUAL_FONTSIZE = 13;
MAYOR_FONTSIZE = 18;
MENOR_FONTSIZE = 10;

/* Funciones de uso general */

function mouseOverHand(src) 
{
	src.style.cursor = 'hand';
}

function guardarCookie(nombre, valor, caducidad)
{	
	document.cookie = nombre + "=" + valor + ((caducidad == null) ? "" : ("; expires=" + caducidad.toGMTString()));
}

function mostrarNoticia()
{
	location.href = "vernota.php?tipo=N&idPub="+codigopublicacion+"&id="+codigonoticia+"&sec="+codigoseccion+"&dis="+codigodistrito;
	
}


function irAlHome()
{
	location.href = "home.php";
}

function mostrarNoticiaBreve(dis,sec,hora, tema, titulo, copete, mensaje, codigonota, codpub, medio)
{
	codigonoticia = codigonota;
	codigopublicacion = codpub;
	codigodistrito = dis;
	codigoseccion = sec;	
	document.all.horatemanb.innerHTML = hora+"<b>"+tema+" ("+medio+")</b>";
	document.all.mensajenb.innerHTML = mensaje;
	document.all.titulonb.innerText = titulo;
	document.all.titulonb.onclick = mostrarNoticia
	document.all.copetenb.innerText = copete;
	document.all.copetenb.onclick = mostrarNoticia
}

/* Funciones para manejo de busqueda avanzada */

function chk_todos_onclick(sender)
{
var frm = document.frm_busqueda;
  
  for (var i=0; i < frm.elements.length; i++)
  {
    if (frm.elements[i].type == "checkbox")
      frm.elements[i].checked = sender.checked;
  }
}

function chk_unico(sender)
{
  document.all.chk_todos.checked = false;
}

function habilitar_seleccion(form, select_gral)
{
  var sel = eval('document.' + form + '.' + select_gral);
  sel.disabled = false;
}

function deshabilitar_seleccion(form, select_gral)
{
  var sel = eval('document.' + form + '.' + select_gral);
  sel.disabled = true;
  
  for (var indice=0; indice<sel.length; indice++)
    sel[indice].selected = false; 
}

function preparar_busqueda(sender)
{
  armar_lista_busqueda('frm_busqueda', 'sel_temas', 'hid_temas');
}

function armar_lista_busqueda(form, select_gral, hid_gral)
{
  var sel = eval('document.' + form + '.' + select_gral);
  var hid = eval('document.all.' + hid_gral);
  	  
  hid.value = "";
  for (var indice=0; indice < sel.length; indice++)
	if (sel[indice].selected) 
	  hid.value = hid.value + sel[indice].value + "|";
}

