function ExibeFlash(w,h,wmode,movie) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="wmode" value="'+wmode+'"/>');
	document.write('<param name="quality" value="high"/>');
	document.write('<param name="movie" value="'+movie+'"/>');
	document.write('<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="'+wmode+'" width="'+w+'" height="'+h+'"></embed>');
	document.write('</object>');
}

function PNGHandler() {
  var self = this;

  this.na = navigator.appName.toLowerCase();
  this.nv = navigator.appVersion.toLowerCase();
  this.isIE = this.na.indexOf('internet explorer')+1?1:0;
  this.isWin = this.nv.indexOf('windows')+1?1:0;
  this.ver = this.isIE?parseFloat(this.nv.split('msie ')[1]):parseFloat(this.nv);
  this.isMac = this.nv.indexOf('mac')+1?1:0;
  this.isOpera = (navigator.userAgent.toLowerCase().indexOf('opera ')+1 || navigator.userAgent.toLowerCase().indexOf('opera/')+1);
  if (this.isOpera) this.isIE = false; // Opera filter catch (which is sneaky, pretending to be IE by default)

  this.transform = null;

  this.getElementsByClassName = function(className,oParent) {
    doc = (oParent||document);
    matches = [];
    nodes = doc.all||doc.getElementsByTagName('*');
    for (i=0; i<nodes.length; i++) {
      if (nodes[i].className == className || nodes[i].className.indexOf(className)+1 || nodes[i].className.indexOf(className+' ')+1 || nodes[i].className.indexOf(' '+className)+1) {
        matches[matches.length] = nodes[i];
      }
    }
    return matches; // kids, don't play with fire. ;)
  }

  this.filterMethod = function(oOld) {
    // IE 5.5+ proprietary filter garbage (boo!)
    // Create new element based on old one. Doesn't seem to render properly otherwise (due to filter?)
    // use proprietary "currentStyle" object, so rules inherited via CSS are picked up.

    var o = document.createElement('div'); // oOld.nodeName
    var filterID = 'DXImageTransform.Microsoft.AlphaImageLoader';
    // o.style.width = oOld.currentStyle.width;
    // o.style.height = oOld.currentStyle.height;

    if (oOld.nodeName == 'DIV') {
      var b = oOld.currentStyle.backgroundImage.toString(); // parse out background image URL
      oOld.style.backgroundImage = 'none';
      // Parse out background image URL from currentStyle object.
      var i1 = b.indexOf('url("')+5;
      var newSrc = b.substr(i1,b.length-i1-2).replace('.gif','.png'); // find first instance of ") after (", chop from string
      o = oOld;
      o.style.writingMode = 'lr-tb'; // Has to be applied so filter "has layout" and is displayed. Seriously. Refer to http://msdn.microsoft.com/workshop/author/filter/reference/filters/alphaimageloader.asp?frame=true
      o.style.filter = "progid:"+filterID+"(src='"+newSrc+"',sizingMethod='crop')";
      // Replace the old (existing) with the new (just created) element.
      // oOld.parentNode.replaceChild(o,oOld);
    } else if (oOld.nodeName == 'IMG') {
      var newSrc = oOld.getAttribute('src').replace('.gif','.png');
      // apply filter
      oOld.src = 'spacer.gif'; // get rid of image
      oOld.style.filter = "progid:"+filterID+"(src='"+newSrc+"',sizingMethod='crop')";
      oOld.style.writingMode = 'lr-tb'; // Has to be applied so filter "has layout" and is displayed. Seriously. Refer to http://msdn.microsoft.com/workshop/author/filter/reference/filters/alphaimageloader.asp?frame=true
    }
  }

  this.pngMethod = function(o) {
    // Native transparency support. Easy to implement. (woo!)
    bgImage = this.getBackgroundImage(o);
    if (bgImage) {
      // set background image, replacing .gif
      o.style.backgroundImage = 'url('+bgImage.replace('.gif','.png')+')';
    } else if (o.nodeName == 'IMG') {
      o.src = o.src.replace('.gif','.png');
    } else if (!this.isMac) {
      // window.status = 'PNGHandler.applyPNG(): Node is not a DIV or IMG.';
    }
  }

  this.getBackgroundImage = function(o) {
    var b, i1; // background-related variables
    var bgUrl = null;

    if (o.nodeName == 'DIV' && !(this.isIE && this.isMac)) { // ie:mac PNG support broken for DIVs with PNG backgrounds
      if (document.defaultView) {
        if (document.defaultView.getComputedStyle) {
          b = document.defaultView.getComputedStyle(o,'').getPropertyValue('background-image');
          i1 = b.indexOf('url(')+4;
          bgUrl = b.substr(i1,b.length-i1-1);
        } else {
          // no computed style
        }
      } else {
        // no default view
      }
    }
    return bgUrl;
  }
  
  this.supportTest = function() {
    // Determine method to use.
    // IE 5.5+/win32: filter

    if (this.isIE && this.isWin && this.ver >= 5.5) {
      // IE proprietary filter method (via DXFilter)
      self.transform = self.filterMethod;
    } else if (!this.isIE && this.ver < 5) {
      self.transform = null;
      // No PNG support or broken support
      // Leave existing content as-is
    } else if (!this.isIE && this.ver >= 5 || (this.isIE && this.isMac && this.ver >= 5)) { // version 5+ browser (not IE), or IE:mac 5+
      self.transform = self.pngMethod;
    } else {
      // Presumably no PNG support. GIF used instead.
      self.transform = null;
      return false;
    }
    return true;
  }

  this.init = function() {
    if (this.supportTest()) {
      this.elements = this.getElementsByClassName('png');
      for (var i=0; i<this.elements.length; i++) {
        this.transform(this.elements[i]);
      }
    }
  }

}

// Instantiate and initialize PNG Handler

var pngHandler = new PNGHandler();

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function faq(respID) {
	document.getElementById(respID).style.display = document.getElementById(respID).style.display == 'none' ? '' : 'none';
}

// FUNÇÃO DE ABERTURA DE POPUP CENTRALIZADO
// ----------------------------------------------------------------------------
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = parseInt((screen.width) ? (screen.width-w)/2 : 0);
	TopPosition = parseInt((screen.height) ? (screen.height-h)/2 : 0);
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',noresizable,status=yes'
	win = window.open(mypage,myname,settings)
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------


var tipo = 0;

function AtivaBusca() {
	tipo = 1;
	document.form1.action = "";
	document.form1.method = "get";
}
function AtivaBuscaGeral() {
	tipo = 2;
	document.form1.action = "";
	document.form1.method = "get";
}
function FaleConosco() {
	tipo = 3;
	document.form1.action = "mail.asp";
	document.form1.method = "post";
}
function AcessoRestritoPP() {
	document.form1.action = "ar/login.asp";
	document.form1.method = "post";
	tipo = 4;
}
function AcessoRestrito() {
	document.form1.action = "../ar/login.asp";
	document.form1.method = "post";
	tipo = 5;
}

function AcessoRestritoUpdate() {
	document.form1.action = "../ar/alterar-action.asp";
	document.form1.method = "post";
	tipo = 6;
}

function fEmailIsValid( strEmail ) {
   if (strEmail.length < 6) return false;
   for (nCont=0; nCont < strEmail.length; nCont++) if (strEmail.charAt(nCont) == '@') break; if (nCont == strEmail.length) return false;
   for (nCont1=nCont+1; nCont1 < strEmail.length; nCont1++) if (strEmail.charAt(nCont1) == '.') break; if (nCont1 == strEmail.length) return false;
   return true;
}

function VerificaCamposContato() {
	if (document.form1.nome.value == "") { alert("Por favor, informe seu nome."); document.form1.nome.focus(); return false; };
  if (fEmailIsValid( document.form1.email.value ) == false) { alert("O seu e-mail não é válido!\nVerifique-o novamente."); document.form1.email.focus(); return false; };
  if (document.form1.cidade.value == "") { alert("Por favor, informe a cidade."); document.form1.cidade.focus(); return false; };
  if (document.form1.assunto.value == "-") { alert("Você deve escolher um assunto."); document.form1.assunto.focus(); return false; };
  if (document.form1.mensagem.value == "") { alert("Você deve escrever a mensagem."); document.form1.mensagem.focus(); return false; };
  return true;
}

function VerificaCamposLogin() {
	if (document.form1.acessoRestritoLogin.value == "") { alert("Por favor, informe o seu nome de login."); document.form1.acessoRestritoLogin.focus(); return false; };
  if (document.form1.acessoRestritoSenha.value == "") { alert("Por favor, informe a sua senha."); document.form1.acessoRestritoSenha.focus(); return false; };
  return true;
}

function VerificaCamposLoginUpdate() {
  if (document.form1.nome.value == "") { alert("Por favor, informe seu Nome."); document.form1.nome.focus(); return false; };
  if (document.form1.senha.value == "") { alert("Por favor, informe a Senha atual."); document.form1.senha.focus(); return false; };
  if (document.form1.nsenha.value == "") { alert("Por favor, informe a nova Senha."); document.form1.nsenha.focus(); return false; };
  if (document.form1.nsenha.value.length < 4) { alert("Por favor, a nova senha deve ter ao menos 4 caracteres."); document.form1.nsenha.focus(); return false; };
  if (document.form1.csenha.value == "") { alert("Por favor, confirme a sua nova Senha."); document.form1.csenha.focus(); return false; };
  if (document.form1.nsenha.value != document.form1.csenha.value) { alert("As Senhas digitadas não coincidem."); document.form1.nsenha.focus(); return false; };
		  
  return true;
}

function EnviaFormulario() {
	if (tipo == 0) {
		return false;
	}
	if (tipo == 1) {
		if (document.form1.busca.value.length > 1) {
			document.location.href="busca.asp?busca=" + document.form1.busca.value;
		} else {
			alert("Informe um número maior de caracteres para busca.");
			document.form1.busca.focus();	};
	}
	if (tipo == 2) {
		if (document.form1.buscaGeral.value.length > 1) {
			document.location.href="busca/index.asp?busca=" + document.form1.buscaGeral.value;
		} else {
			alert("Informe um número maior de caracteres para busca.");
			document.form1.buscaGeral.focus();	};
	}
	if (tipo == 3) {
		return VerificaCamposContato();
	}
	if ((tipo == 4) || (tipo == 5)) {
		return VerificaCamposLogin();
	}
	if (tipo == 6) {
		return VerificaCamposLoginUpdate();
	}

	return false;
}