/***************************************************/
/*****************VENTANA***************************/
/***************************************************/
function ventana(pagina,ancho,alto) 
	{
	window.open(pagina, 'popup', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+ancho+', height='+alto+', left = 100,top = 50');
	}

/***************************************************/
/*****************DECISION**************************/
/***************************************************/
function decision(message, url)
	{
	if(confirm(message)) location.href = url;
	}

/***************************************************/
/*****************OPEN DIR**************************/
/***************************************************/
function abrirOption( form ) 
	{ 
	var newIndex = form.campo.selectedIndex; 
	cururl = form.campo.options[ newIndex ].value; 
	window.location.assign( cururl ); 
	}

/***************************************************/
/*****************OPEN DIR**************************/
/***************************************************/
function openDir2( form ) 
	{ 
	var newIndex = form.idioma.selectedIndex; 
	cururl = form.idioma.options[ newIndex ].value; 
	window.location.assign( cururl ); 
	}


/***************************************************/
/*****************VALIDAR_EMAIL*********************/
/***************************************************/
function validarEmail(valor) 
	{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
		{
   		//alert("La direcci�n de email " + valor    + " es correcta.") 
   		return (true)
  		} else {
   		//alert("La direcci�n de email es incorrecta.");
   		return (false);
  		}
	}


/***************************************************/
/*****************NUEVO_AJAX************************/
/***************************************************/
function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

/***************************************************/
/*****************VER NOTICIA*****************/
/***************************************************/
var ultimo=0;
function verNoticia(id1,id2,id3){
	ultimo++;
	if(ultimo==3){ ultimo=0 }

	var lista = new Array(3);
	lista[0]=id1;
	lista[1]=id2;
	lista[2]=id3;
	
	//document.getElementById(lista[0]).style.removeProperty("color");
	//document.getElementById(lista[1]).style.removeProperty("color");
	//document.getElementById(lista[2]).style.removeProperty("color");
	document.getElementById(lista[0]).style.color = '#000000';
	document.getElementById(lista[1]).style.color = '#000000';
	document.getElementById(lista[2]).style.color = '#000000';
	document.getElementById(lista[ultimo]).style.color = '#CC0000';

	document.getElementById('fondoNoticia'+lista[0]).style.background = '#E2E4E3';
	document.getElementById('fondoNoticia'+lista[1]).style.background = '#E2E4E3';
	document.getElementById('fondoNoticia'+lista[2]).style.background = '#E2E4E3';
	document.getElementById('fondoNoticia'+lista[ultimo]).style.background = '#CCCCCC';
	
	
	var contenedor_noticia;
	contenedor_noticia = document.getElementById('contenedor_noticia');
	ajax=nuevoAjax();
	ajax.open("GET", "_ajax_ver_noticia.php?nota="+lista[ultimo], true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		//Para que los acentos salgan bien
		resul=unescape(ajax.responseText);
		resultado=resul.replace(/\+/gi," ");
		contenedor_noticia.innerHTML = resultado
		}else{
		contenedor_noticia.innerHTML = '<div style="text-align:center; padding-top:20px;"><img src="img/ajax-loader.gif" border=0></div>';
		}
	}
	ajax.send(null)
}

/***************************************************/
/*****************VER NOTICIA*****************/
/***************************************************/
function verNoticiaDirecta(id){
	var contenedor_noticia;
	contenedor_noticia = document.getElementById('contenedor_noticia');
	document.getElementById(id).style.color = '#CC0000';
	document.getElementById('fondoNoticia'+id).style.background = '#CCCCCC';
	ajax=nuevoAjax();
	ajax.open("GET", "_ajax_ver_noticia.php?nota="+id, true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		//Para que los acentos salgan bien
		resul=unescape(ajax.responseText);
		resultado=resul.replace(/\+/gi," ");
		contenedor_noticia.innerHTML = resultado
		}else{
		contenedor_noticia.innerHTML = '<div style="text-align:center; padding-top:20px;"><img src="img/ajax-loader.gif" border=0></div>';
		}
	}
	ajax.send(null)
}

function volverTituloAGris(id){
	document.getElementById(id).style.color = '#000000';
	document.getElementById('fondoNoticia'+id).style.background = '#E2E4E3';
}


function poneLineaRoja(cual){
	document.getElementById(cual).style.background = 'url(img/fdohist.jpg) repeat-y';
}

function sacaLineaRoja(cual){
	document.getElementById(cual).style.background = '';
}

function poneLineaRojaHorizontal(cual){
	document.getElementById(cual).style.background = 'url(img/fdohisthorizontal.jpg) repeat-x';
}

function sacaLineaRojaHorizontal(cual){
	document.getElementById(cual).style.background = '';
}