// JavaScript Document for DIABOLOCAPETA.com */

// gera-escreve emails

function monta_mailto(antes,depois){
	var arroba="@";
	return (antes + arroba + depois);
}

function escreve_mailto(antes,depois){
	document.write("<a class='txt' href='mailto:" + monta_mailto(antes,depois) + "'>" + monta_mailto(antes,depois) + "</a>");
}

function credito(antes,depois,exibe){
	document.write("<a class='credito' href='mailto:" + monta_mailto(antes,depois) + "'>" + exibe + "</a>");
}


// image preload

function imgPreload()
{ 
  var args = imgPreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=1; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

// switch images

function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

// navegação entre imagens

var imgNow;

function switchImageIndex(imgName) 
{
  document.getElementById('foto_img').style.background = 'url(images/fotos/' + imgName + '.jpg) top center no-repeat';
  imgNow = imgName;
}
function switchImagePrevious(now) 
{
  var imgName = Number(now) - 1;
  imgName = '0' + String(imgName);
  document.getElementById('foto_img').style.background = 'url(images/fotos/' + imgName + '.jpg) top center no-repeat';
  imgNow = imgName;
}
function switchImageNext(now) 
{
  var imgName = Number(now) + 1;
  imgName = '0' + String(imgName);
  document.getElementById('foto_img').style.background = 'url(images/fotos/' + imgName + '.jpg) top center no-repeat';
  imgNow = imgName;
}


// mostra filho, ou seja, exibe uma div que estava oculta

function mostraFilho(mostra,esconde){

	obj=document.getElementById(esconde);
	disp="none";
	if (obj.style.display=="none") disp="block";
	obj.style.display=disp;
	
	obj=document.getElementById(mostra);
	disp="block";
	if (obj.style.display=="block") disp="none";
	obj.style.display=disp;
	return false;
}