var 
	posi;
	posi=1;

function ShowDiv (div_id) {
	var element = document.getElementById(div_id);
     
     if (element.style.display == 'none') {
     
         element.style.display = 'block';
     
     }
     else {
         element.style.display = 'none';
     }
     
     return false;
    
}

function mascaraData(DATA_INICIO, nome){ 
              var mydata = ''; 
              mydata = mydata + DATA_INICIO; 
              if (mydata.length == 2){ 
                  mydata = mydata + '/'; 
                  document.getElementById(nome).value=mydata; 
              } 
              if (mydata.length == 5){ 
                  mydata = mydata + '/'; 
                  document.getElementById(nome).value=mydata;  
              } 
            
          } 
          

function mascaraFone(DATA_INICIO, nome){ 
              var mydata = ''; 
              mydata = mydata + DATA_INICIO; 
              if (mydata.length == 1){ 
                  mydata = '(' + mydata ; 
                  document.getElementById(nome).value=mydata; 
              } 
              
                if (mydata.length == 3){ 
                  mydata =  mydata + ')' ; 
                  document.getElementById(nome).value=mydata; 
              } 
              
                 if (mydata.length == 8){ 
                  mydata =  mydata + '-' ; 
                  document.getElementById(nome).value=mydata; 
              } 
              
              
            
          } 
          
function confirmar(end)
{
	

if (window.confirm("Tem certeza que deseja excluir?")){
window.location = end; 
}else
window.alert("Exclusão cancelada");

	
	
}

function aumentaGal(id,titulo,image,contador){
	
	posi=posi+1;
	id=id.split("^");
	titulo=titulo.split("^");
	image=image.split("^");
	if (posi<=contador){
		imgMuda.innerHTML = "<img src='http://www.fckarate.com.br/newSite/IMG_UP/p_"+image[posi]+ "'  style='border-color:#ffffff; border-style:double;'>";
		titulomuda.innerHTML = titulo[posi];

	
		
	}else{
		posi=posi-1;
		window.alert('Você encerrou a listagem de galerias!');
	}
	
	
	
	
}

function diminuiGal(id,titulo,image,contador){
	
	posi=posi-1;
	id=id.split("^");
	titulo=titulo.split("^");
	image=image.split("^");
	if (posi>0){
		imgMuda.innerHTML = "<img src='http://www.fckarate.com.br/newSite/IMG_UP/p_"+image[posi]+ "' style='border-color:#ffffff; border-style:double;'>";
		titulomuda.innerHTML = titulo[posi];
		
		
	}else{
		posi=posi+1;
		window.alert('Você encerrou a listagem de galerias!');
		
	}
	
	
	
	
}


function abrirGal(val){
	val=val.split("^");
	urlgal="http://www.fckarate.com.br/newSite/galeriaFotos/galeriaFotos.php?conte="+ val[posi];
	window.open(urlgal,'Blank','width=660, height=497','location=no');
}

function verificaCodigo(codigo){
	
	if (document.getElementById('vercod').value.toUpperCase()==codigo){
		document.getElementById('formPrincipal').submit();
	} else {
		window.alert('Código de Segurança incorreto!');
		document.getElementById('vercod').value='';
	}
	
}

function mostraFotoi(id){
	if (navigator.appName == 'Netscape'){
		mostraFotoN(id)
	}else{
		 mostraFoto();
	}
}


function mostraFotoN(elemID){
	 var offsetTrail = document.getElementById(elemID);    
 var i = 0;    
 var offsetLeft = 0;    
 var offsetTop = 0;    
 while (offsetTrail || i>1) {        
 offsetLeft += offsetTrail.offsetLeft;        
 offsetTop += offsetTrail.offsetTop;        
 offsetTrail = offsetTrail.offsetParent;    
 }    
 if (navigator.userAgent.indexOf("Mac") != -1 &&
 typeof document.body.leftMargin != "undefined") {        
 offsetLeft += document.body.leftMargin;        
 offsetTop += document.body.topMargin;    }   //  return {left:offsetLeft, top:offsetTop};    
 posy=offsetTop;
 posx=offsetLeft;
// alert(offsetLeft+"----"+offsetTop);}
	document.getElementById('showImage').style.display='block';
	//window.alert(event.clientY);
	document.getElementById('showImage').style.top=(posy-160)+'px';
	document.getElementById('showImage').style.left=(posx+120)+'px';
	
	
}
function mostraFoto(e) {
	var posx = 0;
	var posy = 0;
	
	


 
	e = (e) ? e : ((window.event) ? window.event : "");

	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}

	// posx and posy contain the mouse position relative to the document
	// Do something with this information
	//window.alert(posx+','+posy );
	document.getElementById('showImage').style.display='block';
	//	window.alert(event.clientY);
		//if(posy==0){}
	document.getElementById('showImage').style.top=(posy-160)+'px';
	document.getElementById('showImage').style.left=posx+'px';
	

}

function mudaBack(id){
	//window.alert(id);
	if(id!=""){
	document.getElementById('pizza').style.background="url(/IMG_UP/car_"+id+")";
	} else {
		document.getElementById('pizza').style.background="url(/img/emBreve.jpg)";
		
	}
	
}

function escondeFoto(){
	
	document.getElementById('showImage').style.display='none';
	
	
}
