function hacernoticiero(nombre,posicionx,posiciony,ancho,alto){
	document.write('<div id="div_noticiero" style="position:absolute;left:' + posicionx + 'px;top:' + posiciony + 'px;width:' + ancho + 'px;height:' + alto + 'px;text-align:center;">');

	//variables comunes a todos los noticieros
	this.nombre=nombre;
	this.tipo="deslizante";
	this.ancho = ancho;
	this.alto = alto;
	this.posicionx = posicionx;
	this.posiciony = posiciony;
	this.noticias= new Array();  //almacenare to l contenido d las noticias
	this.totalnoticias=0;
	this.classnoticias="";
	this.classfecha="";
	this.classimagen="";
	this.classcontenido="";

	//estas variables son para el deslizante
	this.direccion="Up";
	this.scrollamount=3;
	this.scrolldelay=100;

	//estas variables para el secuencial
	this.seleccionado=0;
	this.intervalo=10; //en segundos
	this.classtable="";
	this.tabletitulo="Noticiero Ma><";
	return this;
}

//*****************************************************************************************

hacernoticiero.prototype.insertarnoticia = function(){ 
	var x;
	this.noticias[this.totalnoticias]= new Array();
	for (x=0;x<arguments.length ;x++ ){
		this.noticias[this.totalnoticias][x]=arguments[x];
	}
	this.totalnoticias++;
}

//*****************************************************************************************

hacernoticiero.prototype.finnoticiero = function(){
	switch (this.tipo){
		case "deslizante":
			this.hacerdeslizante();
			break;
		case "secuencial":
			this.hacersecuencial();
			this.secuenciar();
			break;
	}
	document.write('</div>');
}

//*****************************************************************************************

hacernoticiero.prototype.hacerdeslizante= function(){//0 titulo, 1 fecha, 2 href
	var x,str;
	str='<marquee style="text-align:center;height:' + this.alto + 'px;" Behavior="Scroll" Direction="' + this.direccion + '" ScrollAmount="' + this.scrollamount + '" ScrollDelay="' + this.scrolldelay + '" onMouseOver="this.stop()" onMouseOut="this.start()">'
	for (x=0;x<this.totalnoticias ;x++ ){
		if (x!=0){
			str+='<br>';
		}
		str+='<a href="' + this.noticias[x][2] + '" class="' + this.classtitulo + '">' + this.noticias[x][0] + '</a>';
		str+=' <a class="' + this.classfecha + '">' + this.noticias[x][1] + '</a>';
	}
	str+="</marquee>";
	document.write(str);
}

//*****************************************************************************************

hacernoticiero.prototype.hacersecuencial= function(){//0 titulo, 1 fecha, 2 href, 3 contenido, 4 imagen
	var x,str;
	str="";
	str='<table><tr>';
		str+='<td><a href="javascript:' + this.nombre + '.seleccionar(-1,0)"><img src="izquierda.gif"></a></td>';
		str+='<td width=10><a id="aseleccionado">2</a>/' + this.totalnoticias + '</td>';
		str+='<td><a href="javascript:' + this.nombre + '.seleccionar(1,0)"><img src="derecha.gif"></a></td>';
		str+='<td>' + this.tabletitulo + '</td>';
	str+='</tr>';
	str+='<tr><td colspan=4>';
		for (x=0;x<this.totalnoticias ;x++ ){
			str+='<table id="table' + x + '" style="display:none" class="' + this.classtable + '">';
				str+='<tr>';
					str+='<td><a href="' + this.noticias[x][2] + '"><img class="' + this.classimagen + '" src="' + this.noticias[x][4] + '"></a></td>';
					str+='<td>';
						str+='<a class="' + this.classtitulo + '" href="' + this.noticias[x][2] + '">' + this.noticias[x][0] + '</a>';
						str+='<br><a class="' + this.classfecha + '">' + this.noticias[x][1] + '</a>';
					str+='</td>';
				str+='</tr>';
				str+='<tr><td colspan=2><a class="' + this.classcontenido + '">' + this.noticias[x][3] + '</a></td>';
				str+='</tr>';
			str+='</table>';
		}
	str+='</td></tr></table>';
	document.write(str);
}

//*****************************************************************************************

hacernoticiero.prototype.secuenciar= function(){
	this.seleccionar(1,1);	
	setTimeout(this.nombre + ".secuenciar()",this.intervalo * 1000);
}

//*****************************************************************************************

hacernoticiero.prototype.seleccionar= function(num,bucle){
	seleccionado=-1;
	if (bucle){
		if (num==-1){
			if (this.seleccionado!=0){
				seleccionado=this.seleccionado-1;
			}else{
				seleccionado=this.seleccionado=this.totalnoticias-1;
			}
		}else{//1
			if (this.seleccionado!=this.totalnoticias-1){
				seleccionado=this.seleccionado+1;
			}else{
				seleccionado=0;
			}
		}
	}else{
		if (num==-1){
			if (this.seleccionado!=0){
				seleccionado=this.seleccionado-1;
			}
		}else{//1
			if (this.seleccionado!=this.totalnoticias-1){
				seleccionado=this.seleccionado+1;
			}
		}
	}
	if (seleccionado!=-1){
		document.getElementById('table' + this.seleccionado).style.display='none';				
		this.seleccionado=seleccionado;
		document.getElementById('table' + this.seleccionado).style.display='block';
		document.getElementById('aseleccionado').innerHTML=this.seleccionado+1;
	}
}
