function a(p){
if(p.backgroundColor!='417C17')
		p.backgroundColor='417C17';
}
function b(p){
	if(p.backgroundColor!='326111')
		p.backgroundColor='326111';
}
function c(p,q){
	if(p.color!='EAF4B5')
		p.color='FFFFFF';
	if(screen.width==800){
		document.all.Secciones.style.left = 373;
		document.all.Debate.style.left = 435;
		document.all.Otros.style.left = 480
	}else{
		document.all.Secciones.style.left = 484;
		document.all.Debate.style.left = 544;
		document.all.Otros.style.left = 594;
		}
	switch(q){
		case 'Secciones':{
			with(document.all){
				Secciones.style.visibility = 'visible';
				Debate.style.visibility = 'hidden';
				Otros.style.visibility = 'hidden';
			}
		};break;
		case 'Debate':{
			with(document.all){
				Secciones.style.visibility = 'hidden';
				Debate.style.visibility = 'visible';
				Otros.style.visibility = 'hidden';
			}
		};break;
		case 'Otros':{
			with(document.all){
				Secciones.style.visibility = 'hidden';
				Debate.style.visibility = 'hidden';
				Otros.style.visibility = 'visible';
			}
		};break;
		case '':{
			with(document.all){
				Secciones.style.visibility = 'hidden';
				Debate.style.visibility = 'hidden';
				Otros.style.visibility = 'hidden';
			}
		};break;		
	}
}
function d(p){
	if(p.color!='FFFFFF')
		p.color='EAF4B5';
}
function e(){
	(screen.width==800) ? document.body.leftMargin= 0 : document.body.leftMargin = 15;
	with(document.all){
		if(mainTable.scrollHeight-275>0)
			leftTable.style.height = mainTable.scrollHeight-275;
	}
}
function f(p,q){
	location.href = '?a=newstype&i='+p+'&f='+q;
}
function g(p,q,r){
	location.href = '?a=news&i='+p+'&o='+q+'&f='+r;
}
function h(p){
	location.href = '?a='+p;
}
function i()
{
	var first = document.contact.first;
	var last = document.contact.last;
	var mail = document.contact.email;
	var comment = document.contact.comm;
	if(first.value=='')
	{
		alert("Ingrese sus nombres");
		first.focus();
		return;
	}
	if(last.value=='')
	{
		alert("Ingrese sus apellidos");
		last.focus();
		return;
	}
	if (mail.value == '' || mail.value.indexOf('@',0) == -1 || mail.value.indexOf('.',0) == -1)
	{
		alert("Ingrese un E-Mail Válido");
		mail.value='';
		mail.focus();
		return;
	}
	if (comment.value=='')
	{
		alert("Ingrese un Comentario");
		comment.focus;
		return;
	}
	document.contact.submit();
}
function j(p){
	with(document.archivo){
		ts.value=p;
		switch(p){
			case 1:{
				title2.disabled=false;
				title2.focus();
				desc.disabled=true;
				dia.disabled=true;
				mes.disabled=true;
				anio.disabled=true;
			};break;
			case 2:{
				title2.disabled=true;
				desc.disabled=false;
				desc.focus();
				dia.disabled=true;
				mes.disabled=true;
				anio.disabled=true;
			};break;
			case 3:{
				title2.disabled=true;
				desc.disabled=true;
				dia.disabled=false;
				mes.disabled=false;
				anio.disabled=false;
			};break;
		}
	}
}
function k(){
	MSG_ERR = 'Ingrese el criterio de búsqueda';
	var form = document.archivo;
	if(form.ts.value==1){
		if(form.title2.value==''){
			alert(MSG_ERR);
			form.title2.focus();
			return;
		}
		form.submit();
	}
	else if(form.ts.value==2){
		if(form.desc.value==''){
			alert(MSG_ERR);
			form.desc.focus();
			return;
		}
		form.submit();
	}
	else if(form.ts.value==3)
		form.submit();
	else if(form.ts.value=='')
		alert(MSG_ERR);
}
function l(){
	window.open('foros','','statusbar,menubar,resizable,scrollbars,titlebar,toolbar');
}
function m(){
	var r = document.forms[1].o;
	b = false;
	for(var i=0;i<r.length;i++){
		if(r[i].checked)
			b = true;
	}
	if(!b)
		alert('Escoja una respuesta');
	else
		document.forms[1].submit();
}
function n(p){
	if(p.color!='0000FF')
		p.color='FF0000';
}
function o(p){
	if(p.color!='FF0000')
		p.color='0000FF';
}

function Banner(refreshTime, width, height, altText, start, random){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
	if (!width) this.width = 460; else this.width = width;
	if (!height) this.height = 68; else this.height = height;
	if (random == null) this.random = 1; else this.random = random;
	this.altText = altText;
	this.ads = [];
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target, mouseover)
	 {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
				
if (typeof(target) == "undefined" && target == null) ad.target = "_self";
 else
        ad.target = target;
		ad.href = href;
		ad.mouseover = mouseover;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self")
		{
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_new")
		{
        	open(ad.href, this.objName + "win");
	
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.showStatus = function(){
		var ad = this.ads[this.currentAd];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.randomAd = function(){
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while(n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 1){
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode = '<a href="javascript:'+this.objName+'.link();"';
			tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
			tempCode += ' onMouseOut="status=\'\';return true">';
			tempCode += '<img style="border: 1px solid black" src="' + this.ads[this.currentAd].src + '" width="' + this.width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" /></a>';
			document.write(tempCode);
			this.nextAd();
		} else document.write("Error: two banners must be defined for the script to work.");
	}

	this.newAd = function(){

	if (!this.random){	
			this.currentAd++;
			if (this.currentAd >= this.mySize)
			   this.currentAd = 0;
		}
		else {
			this.randomAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		setTimeout(this.objName+'.newAd()',this.refreshTime)
	}
}
Banner.count = 0;
function p(){
	var subscribe = document.subscribe;
	if(subscribe.email.value=='nombre@email.com'){
		subscribe.email.value='';
	}
}

function q(){
	var mail = document.subscribe.email;
	if(mail.value == '' || mail.value.indexOf('@',0) == -1 || mail.value.indexOf('.',0) == -1 || mail.value =='nombre@email.com'){
		alert("Ingrese un E-Mail Válido");
		mail.value='';
		mail.focus();
		return;
	}
	window.open('email.php?email='+mail.value,'','left=100,top=100,width=250,height=100');
}
