// JavaScript Document
numscrollimage = 0
function scrollimage()
{	numscrollimage++
	this.name = "scrollingImage"+numscrollimage
	this.sliderwidth = 500
	this.sliderheight = 100
	this.slidespeed = 5
	this.thelength
	this.divimage
	this.marquee
	this.title = "scrolling"

	this.leftrightslide = new Array()
	this.finalslide = ''
	this.copyspeed = this.slidespeed
	this.direction = "left"
	
	this.initialize = initialize
	this.paint = paint
	this.addImage = addImage
	this.create = create
	this.regenerate = regenerate
	this.regenerate2 = regenerate2
	this.intializeleftrightslide = intializeleftrightslide
	this.scrollslide = scrollslide
}
//*************************************************************
function create()
{	this.initialize()
	this.paint()
	this.regenerate2()		
}
//*************************************************************
function addImage(url,target,img,alt)
{	len = this.leftrightslide.length
	alt = (typeof alt != "undefined" && alt != "" ? alt: "Clic aquí para ver.")
	this.leftrightslide[len]='<a href="'+url+'" target="'+target+'"><img src="'+img+'" border=0 alt="'+alt+'" align="absmiddle" ></a>'
}
//*************************************************************
function initialize()
{	for (var i = 0; i < this.leftrightslide.length; i++)
		this.finalslide = this.finalslide + this.leftrightslide[i] + "  "
}
//*************************************************************
function paint()
{	document.write('<div id="'+this.name+'" align="center">')

	document.write('<table border="0" align="center" cellpadding="0" cellspacing="0"><tr><td width="394" align="left" valign="baseline" background="images/arriba.gif"><img src="images/arribaizq.gif" width="16" height="16" border="0" align="baseline" /><span class="white">'+this.title+'<span></td></tr><tr><td align="center" valign="middle" background="images/center2.gif">')

	//if(document.all)
	//{	
		document.write('<marquee id="mrq'+this.name+'" direction="'+this.direction+'" scrollAmount=0 align="absmiddle" style="width:'+this.sliderwidth+'" height="'+this.sliderheight+'"; behavior="scroll">'+this.finalslide+'</marquee>')
		
		this.divimage = document.getElementById(this.name)		
		this.marquee = this.divimage.getElementsByTagName("marquee")[0]	
				
		this.marquee.onmouseover = function()
		{	this.scrollAmount = 0
		}
		
		//alert(document.readyState)
		thisparent = this
		this.marquee.onmouseout = function()
		{	//if (document.readyState == 'complete') 
				this.scrollAmount = thisparent.slidespeed
		}
	//}
	
	document.write('<ilayer width=&{sliderwidth}; height=&{sliderheight}; name="ns_slider01" visibility=hide><layer name="ns_slider02" onMouseover="slidespeed=0;" onMouseout="slidespeed=copyspeed"></layer></ilayer><p align="center" style="margin-top: 0; margin-bottom: 0"> </td></tr></table></div>')
}
//*************************************************************
function regenerate()
{	window.location.reload()
}
//*************************************************************
function regenerate2()
{	if (document.layers)
	{	document.ns_slider01.visibility="show"
		setTimeout("window.onresize = this.regenerate",450)
		this.intializeleftrightslide()
	}

	if (document.all)
		this.marquee.scrollAmount = this.slidespeed
}
//*************************************************************
function intializeleftrightslide()
{	document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
	document. ns_slider01.document.ns_slider02.document.close()
	this.thelength = document.ns_slider01.document.ns_slider02.document.width
	this.scrollslide()
}
//*************************************************************
function scrollslide()
{	if (document.ns_slider01.document.ns_slider02.left >= this.thelength*(-1))
	{	document.ns_slider01.document.ns_slider02.left -= this.slidespeed
		setTimeout("this.scrollslide()",100)
	}
	else
	{	document.ns_slider01.document.ns_slider02.left = this.sliderwidth
		this.scrollslide()
	}
}
