function popUp(tipo)
{
	var page = 'popup.' + tipo + '.asp';
	var lenX = 721;
	var lenY = 560;
	var posX = (screen.width / 2) - (lenX / 2);
	var posY = (screen.height / 2) - (lenY / 2);
	var scrl = 0;
	var attr = 'left=' + posX + ',top=' + posY + ',width=' + lenX + ',height=' + lenY + ',scrollbars=' + scrl;
	window.open(page, 'popup', attr);
	void(0);
}

function galeria(id)
{
	var page = id;
	var lenX = 800;
	var lenY = 600;
	var posX = (screen.width / 2) - (lenX / 2);
	var posY = (screen.height / 2) - (lenY / 2);
	var scrl = 1;
	var attr = 'left=' + posX + ',top=' + posY + ',width=' + lenX + ',height=' + lenY + ',scrollbars=' + scrl;
	window.open(page, 'popup', attr);
	void(0);
}

function galeria2(id)
{
	var page = 'fotos2.php?id_galeria='+id;
	var lenX = 721;
	var lenY = 560;
	var posX = (screen.width / 2) - (lenX / 2);
	var posY = (screen.height / 2) - (lenY / 2);
	var scrl = 0;
	var attr = 'left=' + posX + ',top=' + posY + ',width=' + lenX + ',height=' + lenY + ',scrollbars=' + scrl;
	window.open(page, 'popup', attr);
	void(0);
}

function foto(id,foto)
{
	var page = 'fotos.php?id_galeria='+id+'&id_foto='+foto;
	var lenX = 771;
	var lenY = 560;
	var posX = (screen.width / 2) - (lenX / 2);
	var posY = (screen.height / 2) - (lenY / 2);
	var scrl = 1;
	var attr = 'left=' + posX + ',top=' + posY + ',width=' + lenX + ',height=' + lenY + ',scrollbars=' + scrl;
	window.open(page, 'popup', attr);
	void(0);
}

function classSwap(id)
{
	var cls = id.className.split('_');
	cls[parseInt(cls.length - 1)] = cls[parseInt(cls.length - 1)] != 'off' ? 'off' : 'on';
	id.className = cls.join('_');
	void(0);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function converteFloatMoeda(valor){
      var inteiro = null, decimal = null, c = null, j = null;
      var aux = new Array();
      valor = ""+valor;
      c = valor.indexOf(".",0);
      //encontrou o ponto na string
      if(c > 0){
         //separa as partes em inteiro e decimal
         inteiro = valor.substring(0,c);
         decimal = valor.substring(c+1,valor.length);
      }else{
         inteiro = valor;
      }
      
      //pega a parte inteiro de 3 em 3 partes
      for (j = inteiro.length, c = 0; j > 0; j-=3, c++){
         aux[c]=inteiro.substring(j-3,j);
      }
      
      //percorre a string acrescentando os pontos
      inteiro = "";
      for(c = aux.length-1; c >= 0; c--){
         inteiro += aux[c]+'.';
      }
      //retirando o ultimo ponto e finalizando a parte inteiro
      
      inteiro = inteiro.substring(0,inteiro.length-1);
      
      decimal = parseInt(decimal);
      if(isNaN(decimal)){
         decimal = "00";
      }else{
         decimal = ""+decimal;
         if(decimal.length === 1){
            decimal = decimal+"0";
         }
      }
      
      
      valor = "R$ "+inteiro+","+decimal;
      
      
      return valor;
} 

function validaFormDoacao(value){
	var nElementos = value.length;
	var base = value.elements;
	var controle;
	var erros = new Array();
	var ponteiro = 0;
	var msg;
	for(controle = 0; controle < nElementos; controle++){
		if(base[controle].type != "button" && base[controle].type != "submit" && base[controle].type != "reset"){
			if(base[controle].obrigatorio == "s"){
				if(base[controle].value == ""){
					erros[ponteiro] = base[controle].nome;
					ponteiro++;
				}
			}
		}
	}
	if(erros.length > 0){
		msg = "Preencha os campos:\n\n";
		for(controle = 0; controle < erros.length; controle++){
			msg += "-"+erros[controle]+"\n";
		}
		window.alert(msg);
		return false;
	}
}
// Início do código de Aumentar/ Diminuir a letra
function TamanhoFonte(num, id)
{
	//document.getElementById(num).className = "text-"+num+"-desativo";
	document.getElementById(id).className = "fonte"+num;
	
}
// Fim do código de Aumentar/ Diminuir a letra
function sizeFonts(size, id)
	{
		var icons = 4;
		for(i = 0; i <= icons; i++)
		{
			document.getElementById('icon_' + i).className = '';
			document.getElementById(id).className = '';
		}
		document.getElementById('icon_' + id).className = 'selected';
		document.getElementById(id).className = 'fonte' + size;
	}
function loadSwf(fileName, lenX, lenY)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+lenX+'" height="'+lenY+'">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="transparent" />');
	document.write('<param name=scale value=noscale>');
	document.write('<param name="movie" value="'+fileName+'" /><param name="quality" value="best" /><param name="bgcolor" value="#FFFFFF" /><embed src="'+fileName+'" wmode="transparent" quality="best" width="'+lenX+'" height="'+lenY+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


 