function flash(div, url, wid, hei){
	var conteudo = document.getElementById(div);
	conteudo.innerHTML = '<object width="'+wid+'" height="'+hei+'" type="application/x-shockwave-flash" data="'+url+'"><param name="movie" value="'+url+'" /></object>';
	initLightbox();
}

function criaObjeto(){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}
}

function ajax(pagina, parametro, objdes){
	criaObjeto();
	xmlhttp.open("GET", pagina+parametro, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html; charset=utf-8");
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			var texto =  xmlhttp.responseText;
			texto = texto.replace(/\+/g," ");
			texto = unescape(texto);
			var conteudo = document.getElementById(objdes);
			conteudo.innerHTML = texto;
		}
	}
	xmlhttp.send(null);
}

function interacao(pagina, objori, objdes, divdes){
	var y = document.getElementById(objori);
	var z = y.options[y.selectedIndex].value;
	var x = document.getElementById(objdes);
	x.disabled = true;
	x.options[0].text = "carregando...";
	var parametro = "?id=" + z;
	ajax(pagina, parametro, divdes);
}

function banner(imgSource,url,alt,chance) {
this.imgSource = imgSource;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function dispBanner() {
with (this) document.write("<A HREF=" + url + "><IMG SRC='" + imgSource + "' ALT= class='bordafoto' title='Fábio Moraes'><\/A>");
}
banner.prototype.dispBanner = dispBanner;
banners = new Array();

banners[0] = new banner("imagens/foto01.jpg",
"#",
"Banner 1",
10);
banners[1] = new banner("imagens/foto02.jpg",
"#",
"Banner 2",
10);
sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function randomBanner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].imgSource + "' ALT= class='bordafoto' title='Fábio Moraes'" + banners[i].alt + "'><\/A>");
return banners[i];
break;
}
}
}
// End -->

//MÁSCARA DE VALORES
function txtBoxFormat(objeto, sMask, evtKeyPress) {
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;


if(document.all) { // Internet Explorer
    nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
    nTecla = evtKeyPress.which;
} else {
    nTecla = evtKeyPress.which;
    if (nTecla == 8) {
        return true;
    }
}

    sValue = objeto.value;

    // Limpa todos os caracteres de formatação que
    // já estiverem no campo.
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( " ", "" );
    sValue = sValue.toString().replace( " ", "" );
    fldLen = sValue.length;
    mskLen = sMask.length;

    i = 0;
    nCount = 0;
    sCod = "";
    mskLen = fldLen;

    while (i <= mskLen) {
      bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
      bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

      if (bolMask) {
        sCod += sMask.charAt(i);
        mskLen++; }
      else {
        sCod += sValue.charAt(nCount);
        nCount++;
      }

      i++;
    }

    objeto.value = sCod;

    if (nTecla != 8) { // backspace
      if (sMask.charAt(i-1) == "9") { // apenas números...
        return ((nTecla > 47) && (nTecla < 58)); }
      else { // qualquer caracter...
        return true;
      }
    }
    else {
      return true;
    }
  }