// JavaScript Document

var cv0 = ["/imgs/cvv1.jpg","Chapin do Refúgio1","BH1","Macho1","06/01/2001","0014561 -BH"];
var cv1 = ["/imgs/cvv2.jpg","Chapin do Refúgio2","BH2","Macho2","06/01/2002","0014562 -BH"];
var cv2 = ["/imgs/cvv3.jpg","Chapin do Refúgio3","BH3","Macho3","06/01/2003","0014563 -BH"];
var cv3 = ["/imgs/cvv4.jpg","Chapin do Refúgio4","BH4","Macho4","06/01/2004","0014564 -BH"];
var cv4 = ["/imgs/cvv5.jpg","Chapin do Refúgio5","BH5","Macho5","06/01/2005","0014565 -BH"];

var array = cv;
var total = array.length -1;
var cont=0;

function init(){
	var quem = array[cont];
	
	document.getElementById("imgcv").innerHTML="<img id='cavabox' src='"+urlBase+quem[0]+"' width='80'/>";
	alphama(document.getElementById("imgcv"));
	
	setTimeout(function(){ document.getElementById("nomecv").innerHTML="<strong>Nome: </strong>"+quem[1]; } , 100);
	setTimeout(function(){ document.getElementById("racacv").innerHTML="<strong>Raça: </strong>"+quem[2]; } , 150);
	setTimeout(function(){ document.getElementById("sexocv").innerHTML="<strong>Sexo: </strong>"+quem[3]; } , 200);
	setTimeout(function(){ document.getElementById("nascimentocv").innerHTML="<strong>Nascimento: </strong>"+quem[4]; } , 250);
	setTimeout(function(){ document.getElementById("registrocv").innerHTML="<strong>Registro: </strong>"+quem[5]; } ,  300);
}
function sobe(){
	if(cont<total){
		cont++;
		zera();

		alphame(document.getElementById("imgcv"));
		setTimeout(init,290);
		
		if(cont==total){
			document.getElementById("flep").innerHTML="";
		}
	}
	if(cont==1){
		document.getElementById("flea").innerHTML="<div class='flebox' ><img src='"+urlBase+"/imgs/fled.jpg' /></div><div class='tbb'><i>Anterior</i></div>";
		document.getElementById("flep").style.marginLeft="58px";
	}
}
function desce(){
	if(cont>0){
		cont--;
		zera();
		alphame(document.getElementById("imgcv"));
		setTimeout(init,290);
		
		
		if(cont==0){
			document.getElementById("flea").innerHTML="";
			document.getElementById("flep").style.marginLeft="125px";
		}
	}
	if(cont==total-1){
		document.getElementById("flep").innerHTML="<div class='tbb'><i>Próximo</i></div><div class='flebox'><img src='"+urlBase+"/imgs/flee.jpg'/></div>";
	}
}
function zera(){
	document.getElementById("nomecv").innerHTML="";
	document.getElementById("racacv").innerHTML="";
	document.getElementById("sexocv").innerHTML="";
	document.getElementById("nascimentocv").innerHTML="";
	document.getElementById("registrocv").innerHTML="";
}
