//mostrar .swf
function SWF(arquivo, largura, altura, bg, wmode, quality, variaveis){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + largura + '" height="' + altura + '">');
	document.write('<param name="movie" value="' + arquivo + '">');
	document.write('<param name="Flashvars" value="' + variaveis + '">');
	document.write('<param name="bgcolor" value="#' + bg + '">');
	document.write('<param name="wmode" value="' + wmode + '">');
	document.write('<param name="menu" value="false"><param name="quality" value="' + quality + '">');
	document.write('<embed src="' + arquivo + '" menu="false" Flashvars="' + variaveis + '"  width="' + largura + '" height="' + altura + '" wmode="' + wmode + '"  quality="' + quality + '"  pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#' + bg + '"></embed>');
	document.write('</object>');
}

//newsletter
function Newsletter() {

	email = document.newsletter.newsEmail.value;
	if ( email == "") {
		alert("Digite seu e-mail!");
		document.newsletter.newsEmail.focus();
		return;
	}
	if ((email.indexOf("@") == -1) || (email.indexOf(".") == -1) || (email.length < 7)) {
		alert("E-mail inválido!");
		document.newsletter.newsEmail.focus();
		return;
	}

	else {
        document.newsletter.submit();
	}

}


//popup
function popup(url, nome, largura, altura, rolagem) {
 
	if (!rolagem) { scrolling = 'auto' }
	var lateral = (screen.width - largura) / 2;
	var topo = (screen.height - altura) / 2;
	
	ImprimiNoticia = window.open(url,nome,'width='+largura+',height='+altura+',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+lateral+',top='+topo+'');
}

//ajax
function Ajax(){
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.conecta = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

	document.getElementById("loading").style.display = "inline";

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
		  document.getElementById("loading").style.display = "none";

        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}


//limita caracteres
function LimitarCaracter(campo, contador, Limite) {

	Campo = document.getElementById(campo);
	Display = document.getElementById(contador);
	Caracteres = Limite - Campo.value.length;
	Display.innerHTML = Caracteres;
	if(Campo.value.length >= Limite){
		Campo.value = Campo.value.substring(0, Limite);
	}
	
}