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 getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function fnc_next()
{
	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";
	//obj.style.height = "250px";
	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}
}

function fnc_prev()
{
	if (curpage>numpages)	curpage = 0;
	obj= arraySlides[curpage];
	if(obj)
	{
		obj.style.visibility = "hidden";
		obj.style.display = "none";
		//obj.style.height = "1px";
	}
	curpage--;
	if (curpage<0)	curpage = numpages-1;
	obj=arraySlides[curpage];
	if(obj)
	{
		obj.style.visibility = "visible";
		obj.style.display = "block";
		//obj.style.height = slideHeight + "px";
		//obj.style.height = "250px";
	}
	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}
}

function stopstart() 
{
	if (stopped) {
		document.getElementById('pausa').innerHTML="Pausa ||";
		start();
	} else {
		document.getElementById('pausa').innerHTML="Iniciar &gt;";
		stop();
	}
}

function stop() 
{
	if (!(stopped)) 
	{
		clearTimeout(timer);
		stopped=true;
	}
}
function start() 
{
	timer=setTimeout('fnc_next()',10000);
	stopped=false;
}

function firsthide()
{
	arraySlides = getElementsByClassName(document, "div", "nota-slide");
	numpages = arraySlides.length;
	for (i=0;i < numpages ;  i ++)
	{
		obj=arraySlides[i];
		if(obj)
		{
			//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";
		//firstSlide.style.height = "250px";
		start();
	}
}