
/* Manejo de Fuentes */
var codigonoticia = 0;
var codigopublicacion= 0;
var codigoseccion=0;
var codigodistrito=0;
var fontSize=11;

function tamanoFontSize()
{
	if (fontSize==9) tamano=11;
	if (fontSize==11) tamano=14;
	if (fontSize==14) tamano=16;
	if (fontSize==16) tamano=18;
	if (fontSize==18) tamano=9;

	document.getElementById('spntxt').style.fontSize = tamano;
	fontSize=tamano;
	salvarActualFontSize(tamano);
}

function salvarActualFontSize(tamano)
{
	expire = new Date();
	expire.setTime(expire.getTime()+(6000 * 24 * 3600000));
	guardarCookie("fontSize", tamano, 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)
{
/*	if (document.all.txtbusqueda.value == '')
	{
		alert('Debe ingresar una frase de busqueda');
		return false;
	}*/
	document.all.pag.value = 1;
	return true;
//  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 + "|";
}

