<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function AdicionarFavoritos(){
var bookmarkurl=document.location
var bookmarktitle=document.title
if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function AbrirJanela(pagina, largura, altura, scrollbar) {
	// Definindo meio da tela
	var esquerda = (screen.width - largura)/2;
	var topo = (screen.height - altura)/2;

	// Abre a nova janela 
	window.open(pagina,'','height=' + altura + ', width=' + largura + ', top=' + topo + ', left=' + esquerda + ', scrollbars=' + scrollbar); 
}

function ValidaAgendamentoOnline(){
	if (document.formagendamento.nome.value == ""){
		alert("Digite o seu nome"); document.formagendamento.nome.focus(); 
		return (false); 
	}
	if (document.formagendamento.email.value == ""){
		alert("Digite o seu e-mail"); document.formagendamento.email.focus(); 
		return (false)
	}
	if (document.formagendamento.telefone.value == ""){
		alert("Digite o seu telefone"); document.formagendamento.telefone.focus(); 
		return (false)
	}
	if (document.formagendamento.empresa.value == ""){
		alert("Escolha a empresa onde deseja agendar os serviços"); document.formagendamento.empresa.focus(); 
		return (false)
	}
	if (document.formagendamento.cidade.value == ""){
		alert("Escolha uma cidade"); document.formagendamento.cidade.focus(); 
		return (false)
	}
	if (document.formagendamento.data.value == ""){
		alert("Digite a data de agendamento"); document.formagendamento.data.focus(); 
		return (false)
	}
	return (true);
}

function ValidaAgendamento(){
	if (document.formtestdrive.nome.value == ""){
		alert("Digite o seu nome"); document.formtestdrive.nome.focus(); 
		return (false); 
	}
	if (document.formtestdrive.telefone.value == ""){
		alert("Digite o seu telefone"); document.formtestdrive.telefone.focus(); 
		return (false)
	}
	if (document.formtestdrive.email.value == ""){
		alert("Digite o seu e-mail"); document.formtestdrive.email.focus(); 
		return (false)
	}
	if (document.formtestdrive.data.value == ""){
		alert("Digite a data de agendamento"); document.formtestdrive.data.focus(); 
		return (false)
	}
	return (true);
}

function ValidaDetalhes(){
	if (document.formDetalhes.veiculo.value == ""){
		alert("Digite o código do veículo"); document.formDetalhes.veiculo.focus(); 
		return (false); 
	}
	if (document.formDetalhes.nome.value == ""){
		alert("Digite o seu nome"); document.formDetalhes.nome.focus(); 
		return (false)
	}
	if (document.formDetalhes.email.value == ""){
		alert("Digite o seu e-mail"); document.formDetalhes.email.focus(); 
		return (false)
	}
	if (document.formDetalhes.mensagem.value == ""){
		alert("Digite a sua proposta"); document.formDetalhes.mensagem.focus(); 
		return (false)
	}
	return (true);
}

function ValidaContato(){
	if (document.formcontato.nome.value == ""){
		alert("Digite o seu nome"); document.formcontato.nome.focus(); 
		return (false); 
	}
	if (document.formcontato.email.value == ""){
		alert("Digite o seu e-mail"); document.formcontato.email.focus(); 
		return (false)
	}
	if (document.formcontato.telefone.value == ""){
		alert("Digite o seu telefone"); document.formcontato.telefone.focus(); 
		return (false)
	}
	if (document.formcontato.empresa.value == ""){
		alert("Escolha uma empresa do grupo"); document.formcontato.empresa.focus(); 
		return (false)
	}
	if (document.formcontato.cidade.value == ""){
		alert("Escolha a cidade da empresa que deseja contactar"); document.formcontato.cidade.focus(); 
		return (false)
	}
	if (document.formcontato.departamento.value == ""){
		alert("Escolha um departamento"); document.formcontato.departamento.focus(); 
		return (false)
	}
	if (document.formcontato.assunto.value == ""){
		alert("Digite o assunto"); document.formcontato.assunto.focus(); 
		return (false)
	}
	if (document.formcontato.mensagem.value == ""){
		alert("Digite a mensagem"); document.formcontato.mensagem.focus(); 
		return (false)
	}
	return (true);
}

function ValidaNews(){
	if (document.formnews.nome.value == ""){
		alert("Digite o seu nome"); document.formnews.nome.focus(); 
		return (false); 
	}
	if (document.formnews.email.value == ""){
		alert("Digite o seu e-mail"); document.formnews.email.focus(); 
		return (false)
	}
	return (true);
}

function ValidaFormulario(){
	if (document.login.codCliente.value == ""){
		alert("Digite o código do cliente"); document.login.codCliente.focus(); 
		return (false); 
	}
	if (document.login.loginUsuario.value == ""){
		alert("Digite o login"); document.login.loginUsuario.focus(); 
		return (false)
	}
	if (document.login.senhaUsuario.value == ""){
		alert("Digite a senha"); document.login.senhaUsuario.focus(); 
		return (false)
	}
	return (true);
}

function LembrarSenha(){    
var janela = window.open("senha.lembrar.php","location=no,top=50,left=50,menubar=no,toolbar=no,titlebar=no,status=no,scrollbars=no,resizable=no,fullscreen=no,width=480,height=300");
	janela.focus();    
}

function ContatoAdmin(){    
var janela = window.open("admin.contato.php","location=no,top=50,left=50,menubar=no,toolbar=no,titlebar=no,status=no,scrollbars=no,resizable=no,fullscreen=no,width=480,height=300");
	janela.focus();    
}     

function SobreSistema(){    
var janela = window.open("sistema.sobre.php","location=no,top=50,left=50,menubar=no,toolbar=no,titlebar=no,status=no,scrollbars=no,resizable=no,fullscreen=no,width=480,height=300");
	janela.focus();    
}     

function MRP_over(src,clrOver)
{
	if (!src.contains(event.fromElement))
	{
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
}

function MRP_out(src,clrIn)
{
	if (!src.contains(event.toElement))
	{
		src.style.cursor = 'default';
		src.bgColor = clrIn;
	}
}

function Remover() 
{
	if (confirm('Tem certeza que deseja remover?')) { 
		return true 
	}
	else { 
		return false 
	}
}

function Alterar() 
{
	if (confirm('Tem certeza que deseja alterar?')) { 
		return true 
	}
	else { 
		return false 
	}
}

function Adicionar() 
{
	if (confirm('Tem certeza que deseja adicionar?')) {
		return true
	}
	else { 
		return false 
	}
}
function FormataValor(objeto,teclapres,tammax,decimais) 
{
	var tecla			= teclapres.keyCode;
	var tamanhoObjeto	= objeto.value.length;
	if ((tecla == 8) && (tamanhoObjeto == tammax))
	{
		tamanhoObjeto = tamanhoObjeto - 1 ;
	}
    if (( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) && ((tamanhoObjeto+1) <= tammax))
	{
		vr	= objeto.value;
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( ",", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		tam	= vr.length;
		if (tam < tammax && tecla != 8)
		{
			tam = vr.length + 1 ;
		}
		if ((tecla == 8) && (tam > 1))
		{
			tam = tam - 1 ;
			vr = objeto.value;
			vr = vr.replace( "/", "" );
			vr = vr.replace( "/", "" );
			vr = vr.replace( ",", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
		}
		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
		{
			if (decimais > 0)
			{
				if ( (tam <= decimais) )
				{ 
					objeto.value = ("0," + vr) ;
				}
				if( (tam == (decimais + 1)) && (tecla == 8))
				{
					objeto.value = vr.substr( 0, (tam - decimais)) + ',' + vr.substr( tam - (decimais), tam ) ;	
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) == "0"))
				{
					objeto.value = vr.substr( 1, (tam - (decimais+1))) + ',' + vr.substr( tam - (decimais), tam ) ;
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) != "0"))
				{
				    objeto.value = vr.substr( 0, tam - decimais ) + ',' + vr.substr( tam - decimais, tam ) ; 
				}
				if ( (tam >= (decimais + 4)) && (tam <= (decimais + 6)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 3) ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			 	if ( (tam >= (decimais + 7)) && (tam <= (decimais + 9)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 6) ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 10)) && (tam <= (decimais + 12)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 9) ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 13)) && (tam <= (decimais + 15)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 12) ) + '.' + vr.substr( tam - (decimais + 12), 3 ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			}
			else if(decimais == 0)
			{
				if ( tam <= 3 )
				{ 
			 		objeto.value = vr ;
				}
				if ( (tam >= 4) && (tam <= 6) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr(0, tam - 3) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 7) && (tam <= 9) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 6 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 10) && (tam <= 12) )
				{
			 		if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}

				if ( (tam >= 13) && (tam <= 15) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ) ;
				}			
			}
		}
	}
	else if((window.event.keyCode != 8) && (window.event.keyCode != 9) && (window.event.keyCode != 13) && (window.event.keyCode != 35) && (window.event.keyCode != 36) && (window.event.keyCode != 46))
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
}

function posiciona01(s){
	if(document.layers){
		return document.layers[s];
	}else if(document.all && !document.getElementById) {
		return document.all[s];
	}else {
		return document.getElementById(s);
	}
}

function posiciona02(s,x,y){
	_o = posiciona01(s);
	_o.style.clip = 'rect(0px '+x+'px '+y+'px 0px)';
}

-->
