var ka1=0;
var negka1;
var isli=0;
var jota1;
var espacio =2700;
var arreglo;
var ubi;
var set=0;
var tiem;



function pos1(){
	var posicion = document.getElementById('slid').style.margin;
	document.getElementById('boton_uno').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonActivo.png') no-repeat";
	document.getElementById('boton_dos').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonInactico.png') no-repeat";
	document.getElementById('boton_tres').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonInactico.png') no-repeat";
	if(posicion==""){
		posicion="0 0 0 0";
	}
	arreglo=posicion.split(" ");
	ubi=parseInt(arreglo[3]);
	if(isNaN(ubi))ubi=0;
	diferencia=ubi;
	isli=ubi;
	if(isli!=0){
	if(diferencia<0){
		atras();
	}
	else{
		adelante();
	}
	}
	}
	

function pos2(){
	var posicion = document.getElementById('slid').style.margin;
	document.getElementById('boton_uno').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonInactico.png') no-repeat";
	document.getElementById('boton_dos').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonActivo.png') no-repeat";
	document.getElementById('boton_tres').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonInactico.png') no-repeat";
	if(posicion==""){
		posicion="0 0 0 0";
	}
	arreglo=posicion.split(" ");
	ubi=parseInt(arreglo[3]);
	if(isNaN(ubi))ubi=0;
	diferencia=ubi+900;
	isli=ubi;
	if(isli!=-900){
	if(diferencia<0){
		atras();
	}
	else{
		adelante();
	}
}
}

function pos3(){
	var posicion = document.getElementById('slid').style.margin;
	document.getElementById('boton_uno').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide/botonInactico.png') no-repeat";
	document.getElementById('boton_dos').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide//botonInactico.png') no-repeat";
	document.getElementById('boton_tres').style.background= "url('wp-content/themes/tytal-tytank-v1.0/images/slide//botonActivo.png') no-repeat";
	if(posicion==""){
		posicion="0 0 0 0";
	}
	arreglo=posicion.split(" ");
	ubi=parseInt(arreglo[3]);
	if(isNaN(ubi))ubi=0;
	diferencia=ubi+1800;
	isli=ubi;
	if(isli!=-1800){
	if(diferencia<0){
		atras();
	}
	else{
		adelante();
	}
	}
}

function adelante(){	
			if(set ==0){
				jota1=0;
				set=1;	
				tiem=setInterval("incremento();",1);
			}	
		}
		
		function incremento(){
			jota1=jota1+10;
			isli=isli-10;
			var valor= "0 0 0 "+isli+"px";
			document.getElementById('slid').style.margin=valor;
			if(jota1>=diferencia){
				clearInterval(tiem);
				set=0;
				}
		}
		
		function atras(){
			if(set ==0){
				jota1=0;
				set=1;
				tiem=setInterval("decremento();",1);
			}
			
		}
		
		function decremento(){
			jota1=jota1+10;
			isli=isli+10;
			var valor= "0 0 0 "+isli+"px";
			document.getElementById('slid').style.margin=valor;
			if(jota1>=(-diferencia)){
				clearInterval(tiem);
				set=0;
				}
		}
		
	/*boton para ir a video */

function ir_video(){
	for(var au=0;au<conteo;au++){
	var aqui="desaparece"+au;
	document.getElementById(aqui).style.display="none";
	document.getElementById("minVideo"+au).style.display="none";
	}
	document.getElementById('apareece').style.display="block";
	document.getElementById('boton_uno').style.display="none";
	document.getElementById('boton_dos').style.display="none";
	document.getElementById('boton_tres').style.display="none";
	
	set=1;
	ka1=0;
	tiem=setInterval("arriba();",1);	
}
	
function salir_video(){
	set=1;
	ka1=-244;
	tiem=setInterval("abajo();",1);
	document.getElementById('apareece').style.display="none";
	
}
	
	

function arriba(){
			for(var au=0;au<conteo;au++){
			document.getElementById("minVideo"+au).style.display="block";
			}
			ka1=ka1-4;
			var ampliar=ka1+"px 0 0 0";	
			negka1=ka1+250;
			var decrecer=negka1+"px 0 0 875px";
			for(var au=0;au<conteo;au++){
				document.getElementById("minVideo"+au).style.margin=ampliar;
			}
			document.getElementById("apareece").style.margin=decrecer;
			if(ka1<=-244){
				clearInterval(tiem);
				set=0;
		}
	}
		
function abajo(){				
			ka1=ka1+4;
			var ampliar=ka1+"px 0 0 0";
			negka1=ka1+250;
			var decrecer=negka1+"px 0 0 875px";
			for(var au=0;au<conteo;au++){
				document.getElementById("minVideo"+au).style.margin=ampliar;
			}
			document.getElementById("apareece").style.margin=decrecer;
			if(ka1>=0){
				clearInterval(tiem);
				set=0;
				for(var au=0;au<conteo;au++){
				var aqui="desaparece"+au;
				document.getElementById(aqui).style.display="block";
				document.getElementById("minVideo"+au).style.display="none";
				}
				document.getElementById('boton_uno').style.display="block";
				document.getElementById('boton_dos').style.display="block";
				document.getElementById('boton_tres').style.display="block";
			}
		}

	
