function gerarSWF($arquivo,$largura,$altura)
{
    document.writeln('    <object type="application/x-shockwave-flash" data="'+ $arquivo +'" width="'+ $largura +'" height="'+ $altura +'">');
    document.writeln('        <param name="movie" value="' + $arquivo + '" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
	document.writeln('        <param name="wmode" value="transparent" />');
	document.writeln('        <embed src="swf/banner_topo.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ></embed>');
    document.writeln('    </object>');
}

function fecha_div(){
	//document.getElementById('bg_case').style.display = "none";
	document.getElementById('lightbox').style.display = "none";
	document.getElementById('floater').style.display = "none";
}
function Esvazia(valor_campo){
	if (valor_campo.value == valor_campo.defaultValue)
		valor_campo.value='';
	}

function padrao(valor_campo){
	if (valor_campo.value == '')
		valor_campo.value=valor_campo.defaultValue;
	}
	
	
	/********************************/
	
	function info_view(){
		document.getElementById('info').style.visibility = 'visible';
	}
	function info_hidden(){
		document.getElementById('info').style.visibility = 'hidden';
	}
	
	function showEng(){
		document.getElementById('eua').style.visibility = 'visible';
		document.getElementById('overflow').style.visibility = 'visible';
	}
	
	function showEsp(){
		document.getElementById('spa').style.visibility = 'visible';
		document.getElementById('overflow').style.visibility = 'visible';
	}
	
	function showCatalogo(cod,linha)
	{
		i = 0;
		total = 500;
		while (i <= total){
			i++;
			if(document.getElementById('showinfo'+i)) {
				document.getElementById('showinfo'+i).style.display = 'none';
			}
		}
		//document.getElementById('overflow').style.visibility = 'visible';
		
		ajax = ajaxInit();
		if(ajax)
		{
			ajax.open("GET", "produto_show.php?cod="+cod+"&j="+linha, true);
			ajax.onreadystatechange = function()
		    {
		    	if(ajax.readyState == 4)
		    	{
		    		if(ajax.status == 200)
		    		{		    			
                        //alert(ajax.responseText);
                        //eval(ajax.responseText);
                        document.getElementById('showinfo'+linha).innerHTML = ajax.responseText;
						document.getElementById('showinfo'+linha).style.display = 'block';
		       		}
		       		else
		       		{
		         		alert(ajax.statusText);
		       		}
		     	}		     	
		   	}
		ajax.send(null);
		}
	}
	function fechaShow(valor){
		document.getElementById('showinfo'+valor).style.display = "none";	
	}
	function hiddenLang(){
		document.getElementById('spa').style.visibility = 'hidden';
		document.getElementById('eua').style.visibility = 'hidden';
		document.getElementById('catalogo').style.visibility = 'hidden';
		document.getElementById('overflow').style.visibility = 'hidden';
	}
	
function Tecla(e)
{
	if(document.all) // Internet Explorer
	{
		var tecla = event.keyCode;
	}	
	else
	{
		var tecla = e.which;
	}

	if(tecla > 47 && tecla < 58) // numeros de 0 a 9
	{
		return true;
	}
	else
	{
		if (tecla != 8) // backspace
		{
			if (tecla == 13)
			{
				return true;
			}
			else
			{
				return false;
			}	
		}
		Else
		{
			return true;
		}
	}	
}

function JumpField(fields) {
 if (fields.value.length == fields.maxLength) {
  for (var i = 0; i < fields.form.length; i++) {
   if (fields.form[i] == fields && fields.form[(i + 1)] && fields.form[(i + 1)].type != "hidden") {
        fields.form[(i + 1)].focus();
        break;
   }
  }
 }
}

function Contato_Envia(frm) {
		if(frm.nome.value == '') { alert('Por favor, preencha o campo NOME corretamente.'); frm.nome.focus(); return false; }
		else if(frm.email.value == '') { alert('Por favor, preencha o campo E-MAIL corretamente.'); frm.email.focus(); return false; }
		else if(frm.msg.value == '') { alert('Por favor, preencha o campo MENSAGEM corretamente.'); frm.msg.focus(); return false; }
		else { frm.submit(); return true; }
}

function valida_cep(x)
{
	var validos = "0123456789";
	var digitos = x.value;
	digito = '';
	memoria = '';
	for (i=0;i<digitos.length;i++)
	{
		digito = digitos.charAt(i);
		if (validos.indexOf(digito) != -1)
		{
			memoria += digito;
		}
		else
		{
		}
	}
	
	if (memoria.length > 8 || memoria.length < 8 )
	{
		alert('O CEP informado é inválido');
		x.value = '';
		return false;
	}
	else
	{
		return true; 
	}
	
	x.value = memoria;
	return true;
}