function enviar_frm(tipo)//envia o pedido de reparo ou contato
{
	// alert(document.contatoform.nome.value+"----"+a);	
 var a=tipo;

 if(a=='s')
  { 
  //alert("uju");
	var pendereco=document.contatoform.endereco.value;
	var pbairro=document.contatoform.bairro.value;
	var pcidade=document.contatoform.cidade.value;
	var puf=document.contatoform.uf.value;
	var psolicitacao=document.contatoform.tipo_solicitacao.value;
	var pdata=document.contatoform.data.value;
    var phorario=document.contatoform.horario.value;
	var ptipo_solicitacao=document.contatoform.tipo_solicitacao.value;
	var pequipamento=document.contatoform.equipamento.value;
	var pmarca=document.contatoform.marca.value;
    var pserie=document.contatoform.serie.value;
	var pmensagem=document.contatoform.mensagem.value;
	var encher="<div style='width:100%; background-color:#fff; border:none;'>&nbsp;</div>";	  
     $('#msgerror').html("<img src='img/wait.gif' name='preload'>&nbsp;&nbsp;Carregando..."+encher);
	 $.post('faleconosco.php', {action:'enviar_frm',endereco:pendereco,bairro:pbairro,cidade:pcidade,uf:puf,solicitacao:psolicitacao,data:pdata,horario:phorario,tipo_solicitacao:ptipo_solicitacao,equipamento:pequipamento,marca:pmarca,serie:pserie,mensagem:pmensagem,tipo_de_contato:a}, function(resposta)
		  { 
		    r=resposta;	
			if(r.indexOf("Preencha o campo")==-1)
			{
		     $('#frm_alternate').html(r);	
			}
			else
			{
			 $('#msgerror').html(r);
			 }	   
	    });	
  }//fim se for contato suporte tecnico
  else
  {
      // alert(document.contatoform.nome.value+"----"+a);	
		var pnome=document.contatoform.nome.value;
	var pemail=document.contatoform.email.value;
	var passunto=document.contatoform.assunto.value;
	var pmensagem=document.contatoform.mensagem.value;
	var encher="<div style='width:100%; background-color:#fff; border:none;'>&nbsp;</div>";	  
     
	  $('#msgerror').html("<img src='img/wait.gif' name='preload'>&nbsp;&nbsp;Carregando..."+encher);
	 $.post('faleconosco.php', {action:'enviar_frm',nome:pnome,email:pemail,assunto:passunto,mensagem:pmensagem,tipo_de_contato:a}, function(resposta)
		  { 
		    r=resposta;	
			if(r.indexOf("O campo ")==-1)
			{
		     $('#frm_alternate').html(r);	
			}
			else
			{
			 $('#msgerror').html(r);
			 $('#frm_alternate').fadeIn(300);
			 }	   
	    });  
	  
   }//fim se for contato
}//fim da função
function geralista(id,tipo)
{

//alert(id+"---"+tipo);
$('#meiofotos').html("<img src='img/wait.gif' name='preload'>&nbsp;&nbsp;Carregando...");
$.get('galeria.php', {funcao:tipo,id_:id}, function(resposta)
		  {			
		  // $('#fotopainel').fadeIn(200);
		  $('#meiofotos').html(resposta);
		});
}//fim da função
function selecionarcidade(puf)
{ a=puf
  
	$('#cidade').html('<option value="0">..:: Carregando ::..</option>');
		$.get('buscasubcidade.php', {funcao: 'populateCombo',uf:a}, function(resposta)
		  {			
		  $('#cidade').html(resposta);
		});
}//fim da função
function loginn(cod,senha)  
{
  var l=cod;
  var s=senha;
   if(l=="" || s=="")
   {
	 alert("Os campos cod. cliente e senha são obrigatórios");	 
	}
   else
   {
	 var encher="<div style='width:100%; height:550px; background-color:#fff; border:none;'>&nbsp;</div>";	  
     $('#frm_alternate').html("<img src='img/wait.gif' name='preload'>&nbsp;&nbsp;Carregando..."+encher);
	//$.post('cliente_dados.php', {cod:l,senha:s}, function(resposta)
	$.post('teste.php', {cod:l,senha:s}, function(resposta)														
		  {// alert("9993666");
		   r=resposta;
		   alternar('s');
	    });
	}//fim do else	  
}//fim da função 

function alternar(frm)//alterna os formularios de contato
 {
   var f=frm;
    var encher="<div style='width:100%; height:550px; background-color:#fff; border:none;'>&nbsp;</div>";	  
     $('#frm_alternate').html("<img src='img/wait.gif' name='preload'>&nbsp;&nbsp;Carregando..."+encher);	
  if(f=='s')
   {
		 $.get('faleconosco.php', {action:'suporte'}, function(resposta)
		  {
		   $('#frm_alternate').html(resposta);
		});	 
    }//fim do if
	else
	 {
		 $.get('faleconosco.php', {action:'contato'}, function(resposta)
		  {
		   $('#frm_alternate').html(resposta);
		});
	 }//fim do else
}//fim da função.

function status_foto(atual,total)
{
	//alert("Foto "+atual+" de " +total);
	patual=atual;
	ptotal=ftotal();
	if((atual)<0 || parseInt(total)<0)
	{
		$('#fotopaginator').html("Foto  0 de 0");
		}
	else
	{
     $('#fotopaginator').html("Foto "+(atual+1)+" de " +(total+1));
	}
}//fim da função
function exibeValor(nomeCampo, lenCampo, controle)
{
	if ((nomeCampo.value.length == lenCampo) && (checarTabulacao))
	{	
		var i=0;
		for (i=0; i<document.anunciar.elements.length; i++)
		{
			if (document.anunciar.elements[i].name == nomeCampo.name)
			{
				while ((i+1) < document.anunciar.elements.length)
				{
					if (document.anunciar.elements[i+1].type != "hidden")
					{
						document.anunciar.elements[i+1].focus();
						break;
					}
					i++;
				}
				checarTabulacao=false;
				break;
			}
		}
	}
}
	
function stopTabCheck(nomeCampo)
{checarTabulacao=false;}

function startTabCheck()
{checarTabulacao=true;}

function formatar(src, mask){
  var i = src.value.length;
  var saida = mask.substring(0,1);
  var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
  {
    src.value += texto.substring(0,1);
  }
}
function Trim(strTexto)
{
// Substitúi os espaços vazios no inicio e no fim da string por vazio.
  return strTexto.replace(/^\s+|\s+$/g, '');
 }
		
function mostra_produto(p_,c_)
{
	var pp=p_;
	var pc=c_;	 
	//$('#content').css('background','#ff0000');
	
	 $.get('produtos.php', {t:'s',p:pp,c:pc}, function(resposta)
	  {		  
		 $('#content').html(resposta);
	 });
}//fim da função

