// JavaScript Document

function GE(id) { return document.getElementById(id); };
function SHOW(id) { document.getElementById(id).style.display = 'block'; };
function HIDE(id) {	document.getElementById(id).style.display = 'none'; };

function chequearCampos() {
	var E = false;
	if ((GE('nombre').value.match(/^[A-Z \.]+$/i)==null)&&!E) { alert ('Controle el Nombre ingresado. No se admiten caracteres especiales.'); E=!E };
	if ((GE('email').value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)&&!E) { alert ('Controle la direccion de Email ingresada.'); E=!E };
	if ((GE('consulta').value.match(/^[\w\. \,\?\n\r]+$/)==null)&&!E) { alert ('Controle el texto de la consulta. No se admiten caracteres especiales. Solamente permitidos "?_.,"'); E=!E };
	return !E;
};


function muestraNoticias(url) {
	ajaxpack.addrandomnumber = 1;
	ajaxpack.getAjaxRequest('rss/rss.php', 'url='+url, processGet, 'txt');
};

function processGet() {
	var getNoticias=ajaxpack.ajaxobj;
	if (getNoticias.readyState == 1) {
			if (typeof lefttime != 'undefined') { clearTimeout(lefttime) };
			document.getElementById('vmarquee').style.top='0px';
			document.getElementById('vmarquee').innerHTML = '<table align=\"center\" style=\"height:100px\"><tr><td><img src=\"images/ajax.gif\" alt=\"cargando...\" align=\"absmiddle\" /> cargando noticias...</td></tr></table>';
	};
		
	if (getNoticias.readyState == 4){ //if request of file completed
		if (getNoticias.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			document.getElementById('vmarquee').innerHTML = getNoticias.responseText;
			initializemarquee();
		}
	}
};




/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
	if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
	cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
	else
	cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
	if (typeof lefttime != 'undefined') { clearTimeout(lefttime) };
	cross_marquee=document.getElementById("vmarquee")
	cross_marquee.style.top=0
	marqueeheight=document.getElementById("marqueecontainer").offsetHeight
	actualheight=cross_marquee.offsetHeight
	if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
		cross_marquee.style.height=marqueeheight+"px"
		cross_marquee.style.overflow="scroll"
		return
	}
	//setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
	lefttime = setInterval("scrollmarquee()",30);
}
