function SWFtopo() {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="493" height="170">\n');
  document.write('<param name="movie" value="menu_home.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="menu_home.swf" width="493" height="170" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}
function SWFmenu() {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="493" height="73">\n');
  document.write('<param name="movie" value="menucima.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="menucima.swf" width="493" height="73" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}
function WEBradio() {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="582" height="550">\n');
  document.write('<param name="movie" value="webradio.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="webradio.swf" width="582" height="585" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}
function QuemSomos() {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="561" height="22">\n');
  document.write('<param name="movie" value="menu_quem.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="menu_quem.swf" width="561" height="22" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}

/*
  SWF função pra exibir o flash sem bug
  
  é so chamar a funão e pronto
  <script type="text/javascript">SWFmenu('menu.swf', '200', '500');</script>
*/

function SWF(file, w, h) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="'+w+'" height="'+h+'">\n');
  document.write('<param name="movie" value="'+file+'" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="'+file+'" width="'+w+'" height="'+h+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}
function SWF2(file, w, h) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="'+w+'" height="'+h+'">\n');
  document.write('<param name="movie" value="'+file+'" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="'+file+'" width="'+w+'" height="'+h+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>\n');
}
/*----------------------------------------------------------------------
  funcção exibe_float_carteirinha() serve pra exibir ou ocultar uma div flutante em determinado
  local na pagina, com o mouse sobre certo texto

  vc vai precisar chamar a funçao duas vezes, sendo uma pra exibir e outra pra ocultar
  pra chamar a função tem q colocar uma ação onmouseover e onmouseout
  onmouseover="exibe_float_carteirinha( this, 'id_Div', true );" mostra div
  onmouseout="exibe_float_carteirinha( this, 'id_Div', false );" oculta div
------------------------------------------------------------------------*/
function exibe_float_carteirinha(elem, id_div, exibe) {
  document.getElementById(id_div).style.display = (exibe ? '' : 'none');
}


/*
  muda_action função pra mudar a ação de um formulario e dar submit no mesmo
  pra chamar essa funão vc vai precisar de uma ação onclick

  onclick="muda_action('Alvo');"
*/

function muda_action(Alvo) {
  if (Alvo == "update") {
    document.cad_pro.action = "index.php?corpo=escolhi.php";
    document.cad_pro.submit();
  } else {
    document.cad_pro.action = "index.php?corpo=comprar.php";
    document.cad_pro.submit();
  }
}

/*
  RedimensionaIframe função de redimenticonar o frame alvo
  pra chamar essa funão vc vai precisar de uma ação onLoad

  onLoad="parent.RedimensionaIframe();"
*/

function RedimensionaIframe() {
  var ifr = document.getElementById('id_frame');
  var altura = ifr.contentWindow.document.body.scrollHeight;
  if(altura > 120) {
    ifr.style.height = altura;
  } else {
    ifr.style.height = 120;
  }
  return true;
}

/*
  marca_todos funão pra marcar ou desmarcar todos os inputs do tipo checkbox
  
  pra chamar essa função vc precisa e uma ação onclik
  
  onclick="marca_todos();"
  
*/
function marca_todos() {
  f = document.form.name;
  for (i=0; i<f.length; i++) {
    if (f.elements[i].type == "checkbox") {
      if (f.marca_todos.checked) {
        f.elements[i].checked = true;
      } else {
        f.elements[i].checked = false;
      }
    }
  }
}

/*---------------------------------------------------------------------
  se_numero função que so permite digitar numeros e apagar caso haja algum erro usando backspace
  verifica qual tecla foi precionada e exibe alert se não for a tecla permitica

  pra chamar a função vc vai precisar de uma acão onkeydown
  onkeydown="return se_numero();"
-----------------------------------------------------------------------*/
function se_numero(kEys) {
  var tecla = event.keyCode;
  if(document.layers) {
    var tecla = e.which;
  }
  if(tecla > 47 && tecla < 58) {
    return true;
  } else {
    if (tecla != 8) {
      alert('Digite apenas números!');
      return false;
    } else {
      return true;
    }
  }
}

/*
  numero funão pra bloquear caracteres não numericos, essa função permite digitar qualquer tecla
  numerica no teclado

  pra chamar essa função vc precisa e uma ação onKeyPress

  onKeyPress="javascript: return numero(event)"

*/
function numero(e) {
  if (window.event) {
    // for IE, e.keyCode or window.event.keyCode can be used
    key = e.keyCode;
  } else if (e.which) {
    // netscape
    key = e.which;
  }
  if (key != 8 || key < 48 || key > 57)
    //alert('Digite apenas números!');
    return (((key > 47) && (key < 58)) || (key==8));

  {
    return true;
  }
}

/*
  mudaFonte função pra aumentar ou diminuir o tamanho do texto de uma area desejada
  
  o texto a ser alterado deve estar dentro de um span ou div com o id = 'tx'
  e deve existir um css pra esse div ou span
  
  <style>
    #tx {font-size:10;}
  </style>
  
  pra chamar a função 
    <a href="javascript:mudaFonte('menos')"><span>A-</span></a>
    &nbsp;&nbsp;
    <a href="javascript:mudaFonte('mais')"><span>A+</span></a>
*/
var tam = 10;
function mudaFonte(tipo) {
  if (tipo=="mais") {
    if(tam<16) tam+=2;
  } else {
    if(tam>9) tam-=2;
  }
  document.getElementById('tx').style.fontSize = tam+'px';
}

/*
	função chamaPagina serve para mudar a página no evento onchange do <select> essa função funciona em todos os browsers
	para chamar a função declare <select name='nome' onChange='chamaPagina(this)'>
*/
function chamaPagina (url){
	location.href=url.value;
	exit();
}
