var curpage=0;
var timer=null;
var imagesWidth=null;
var imagesHeight=null;
// var slideHeight=0;
var stopped = false;
var numpages = 0;
var arraySlides;
var obj;

function proxima()
{
	if (curpage > numpages-1)
	{
		curpage=0;
	}

	obj=arraySlides[curpage];
	obj.style.visibility = "hidden";
	obj.style.display = "none";
//	obj.style.height = "1px";

	curpage++;

	if (curpage>numpages - 1) 
	{
		curpage = 0;
	}

	obj=arraySlides[curpage];
	obj.style.visibility = "visible";
	obj.style.display = "block";
//	obj.style.height = slideHeight + "px";

	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}

}

function previa()
{
	if (curpage>numpages)	curpage = 0;

	//Obtengo la nota Actual
	obj= arraySlides[curpage];

	if(obj)
	{
		obj.style.visibility = "hidden";
		obj.style.display = "none";
//		obj.style.height = "1px";
	}
	
	curpage--;
	if (curpage<0)	curpage = numpages-1;

	//Obtengo la nota Anterior
	obj=arraySlides[curpage];
	if(obj)
	{
		obj.style.visibility = "visible";
		obj.style.display = "block";
//		obj.style.height = slideHeight + "px";
	}

	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}
}

function stopstart(img) 
{
	if (stopped) {
		img.src="img/"+img.id+".gif";
		img.onmouseover="sgppnov(this);";
		img.onmouseout="sgppnou(this);";
		start();
	} else {
		img.src="img/"+img.id+"_over.gif";
		img.onmouseover="";
		img.onmouseout="";
		stop();
	}
}

function stop() 
{
	if (!(stopped)) 
	{
		clearTimeout(timer);
		stopped=true;
	}
}
function start() 
{
	timer=setTimeout('proxima()',11000);
	stopped=false;
}

function esconder()
{
	
	arraySlides = document.getElementsByName("notice");
	numpages = arraySlides.length;
	//alert (numpages);
	
	//Oculto cada una de las imagenes
	for (i=0;i < numpages ;  i ++)
	{
		obj=arraySlides[i];
		if(obj)
		{
			if(i==0) 
			{
				imagesWidth	 = document.getElementById('imgSlide').width;
				imagesHeight = document.getElementById('imgSlide').height;
			}

		//	slideHeight = imagesHeight + 83;
			obj.style.visibility="hidden";
			obj.style.display = "none";
		//	obj.style.height = "1px";
			obj.style.overflow ="hidden";
			obj.style.top = "0px";
			obj.style.position = "relative";
			obj.style.border = "0px solid";
			obj.style.zIndex = 1;
		}
	}

	//Muestro la primer imagen
	curpage = 0;
	var firstSlide = arraySlides[0];
	if(firstSlide)
	{
		firstSlide.style.visibility = "visible";
		firstSlide.style.display = "block";
//		firstSlide.style.height = slideHeight + "px";
		start();
	}
	

}

function sgppnov(img)
{
	img.src="img/"+img.id+'_over.gif';
}
function sgppnou(img)
{
	img.src="img/"+img.id+'.gif';
}