var k = 0;
var speed=0;
var timer = 0;
var id = "img_big";
var t
var j = 0
var r
var type = new Array("ScrollIn","ScrollOut","ScrollIn","DoubleDoor");
function ClearRotar(j){	
	window.clearTimeout(r);
	rotar_ini(j)
}
function rotar_ini(j){	
			
		   	$("#img_big").ImageSwitch({Type:type[j], 
									NewImage:"img/"+images[j], 
									Direction:"DownTop", 
									EffectOriginal: false
									});
			
		   
			color();
			$("#pag"+j).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:300})
			document.getElementById("pos").value = j;
			document.getElementById("link_enlace").href = enlaces[j];
	 
	   j = j + 1
	   if (j  > (images.length-1)) j=0;
	 r = window.setTimeout('rotar_ini('+j+')', 5000)	 
}
function color(){
	for(t=0;t < images.length;t++){
		$("#pag"+t).css( {backgroundPosition: "0 -20px"} )
	}
}
function Next(){	
	
	window.clearTimeout(r);
	num = parseInt(document.getElementById("pos").value);
	val  = parseInt( num + 1)
	if (val > (images.length-1)) val=0;
	rotar_ini(val)
}

function Previus(){	
	window.clearTimeout(r);
	num = parseInt(document.getElementById("pos").value);
	if (num == 0 ) num=5;
	val  = parseInt( num - 1)
	rotar_ini(val)
}

function stoping(){	
	var valor = document.getElementById("change").value;
	if(valor == "on" ){
		window.clearTimeout(r);
		document.getElementById("change").value="off";
		//document.getElementById("img_change").src="aplication/webroot/imgs/play.jpg";
	}else{
		window.clearTimeout(r);
		num = parseInt(document.getElementById("pos").value);
		val  = parseInt( num + 1)
		if (val > (images.length-1)) val=0;
		rotar_ini(val)
		document.getElementById("change").value="on";
		//document.getElementById("img_change").src="aplication/webroot/imgs/pause.jpg";
	}
}

