	var menuAtivo = '';
	// cria a funcao trim
	String.prototype.trim = function()
	{
		var str = this.replace( /^\s*/, "" );
		str = str.replace( /\s*$/, "" );
		return str;
	}

	// mostra o icone do menu
	function mostraIco( strLayer, booMostra ) {
		var objLayer = ( document.all ? document.all( strLayer ) : document.getElementById( strLayer ) );
		if ( booMostra ) {
			objLayer.style.display = 'block';
		}
		else {
			if ( menuAtivo != strLayer ) {
				objLayer.style.display = 'none' ;
			}
			else {
			    desabilitaLayers();	
			}
		}
	}
	
	function desabilitaLayers(){
		var objContato   = ( document.all ? document.all( 'icoContato' ) : document.getElementById( 'icoContato' ) );
		var objEquipe    = ( document.all ? document.all( 'icoEquipe' ) : document.getElementById( 'icoEquipe' ) );
		var objAgencia   = ( document.all ? document.all( 'icoAgencia' ) : document.getElementById( 'icoAgencia' ) );
		var objPortfolio = ( document.all ? document.all( 'icoPortfolio' ) : document.getElementById( 'icoPortfolio' ) );
		
		objContato.style.display   = ( menuAtivo != 'icoContato'   ? 'none' : 'block' );
		objEquipe.style.display    = ( menuAtivo != 'icoEquipe'    ? 'none' : 'block' );
		objAgencia.style.display   = ( menuAtivo != 'icoAgencia'   ? 'none' : 'block' );
		objPortfolio.style.display = ( menuAtivo != 'icoPortfolio' ? 'none' : 'block' );
	}
	
	function habilitaIco( strLayer ) {
		var objLayer = ( document.all ? document.all( strLayer ) : document.getElementById( strLayer ) );
		menuAtivo = strLayer;
		objLayer.style.display = 'block';
		desabilitaLayers();
	}

	// amplia as imagens da agencia
	function ampliaImagem( intImagem ) {
		var objLayer  = ( document.all ? document.all( 'layMaior' ) : document.getElementById( 'layMaior' ) );
		var objImagem = ( document.all ? document.all( 'imgAgencia' ) : document.getElementById( 'imgAgencia' ) );
		
		objImagem.src          = 'imagens/agencia_grande' + intImagem + '.png';
		objLayer.style.display = 'block';
		objLayer.style.position = 'absolute';
	}
	
	// fecha a layer da imagem
	function fechaImagem() {
		var objLayer  = ( document.all ? document.all( 'layMaior' ) : document.getElementById( 'layMaior' ) );
		objLayer.style.display  = 'none';
		objLayer.style.position = 'relative';
	}
	
	//enviar o contar
	function enviarContato() {
		with ( document.forms[0] ) {
			if ( elements['txtNome'].value.trim() == '' ) {
				alert( 'Informe o nome' );
				elements['txtNome'].focus();
				return false;
			}
			if ( elements['txtEmail'].value.trim() == '' ) {
				alert( 'Informe o E-mail' );
				elements['txtEmail'].focus();
				return false;
			}
			if ( elements['txtAssunto'].value.trim() == '' ) {
				alert( 'Informe o Assunto!' );
				elements['txtAssunto'].focus();
				return false;
			}
			if ( elements['txtMensagem'].value.trim() == '' ) {
				alert( 'Informe a Mensagem!' );
				elements['txtMensagem'].focus();
				return false;
			}
		}
	}
	
	function mostraCliente( intId ) {
		ajaxSend( 'clientes.php?cliente=' + intId, 'layLista', 'layLista', 'Carregando . . .' );
        //Shadowbox.init();
	}
	
	function mudaThumb( strImg, strCaminho ) {
		var objImagem = ( document.all ? document.all( strImg ) : document.getElementById( strImg ) );
		
		objImagem.style.width  = '100px';
		objImagem.style.height = '95px';
		objImagem.src = strCaminho;
	}

	function mostraTrabalho( strCaminho, strCliente, strProduto, strPeca ) {
		var objFundo        = ( document.all ? document.all( 'layFundo' )       	  : document.getElementById( 'layFundo'  ) );
		var objVisualizacao = ( document.all ? document.all( 'layVisualizacao' ) 	  : document.getElementById( 'layVisualizacao'  ) );
		var objTexto        = ( document.all ? document.all( 'layTextoVisualizacao' ) : document.getElementById( 'layTextoVisualizacao'  ) );
		var objImagem       = ( document.all ? document.all( 'imgVisualizacao' ) 	  : document.getElementById( 'imgVisualizacao' ) );
		
		objImagem.src = strCaminho;
		
		objTexto.innerHTML  = '<b>CLIENTE:</b>&nbsp;' + strCliente + '<br/>';
		objTexto.innerHTML += '<b>PEÇA:</b>&nbsp;' + strPeca + '<br/>';
		objTexto.innerHTML += '<b>PRODUTO:</b>&nbsp;' + strProduto + '<br/>';
		
		objFundo.style.position = 'absolute';
		objFundo.style.display  = 'block';
		
		objVisualizacao.style.position = 'absolute';
		objVisualizacao.style.display  = 'block';
	}
	
	// fecha a layer da imagem
	function fechaVisualizacao() {
		var objFundo        = ( document.all ? document.all( 'layFundo' )       	  : document.getElementById( 'layFundo'  ) );
		var objVisualizacao = ( document.all ? document.all( 'layVisualizacao' ) 	  : document.getElementById( 'layVisualizacao'  ) );
		var objImagem       = ( document.all ? document.all( 'imgVisualizacao' ) 	  : document.getElementById( 'imgVisualizacao' ) );
		
		objImagem.src = '';

		objFundo.style.display  = 'none';
		objFundo.style.position = 'relative';
		
		objVisualizacao.style.display  = 'none';
		objVisualizacao.style.position = 'relative';
	}
	
	function home(){
		var objContato   = ( document.all ? document.all( 'icoContato' ) : document.getElementById( 'icoContato' ) );
		var objEquipe    = ( document.all ? document.all( 'icoEquipe' ) : document.getElementById( 'icoEquipe' ) );
		var objAgencia   = ( document.all ? document.all( 'icoAgencia' ) : document.getElementById( 'icoAgencia' ) );
		var objPortfolio = ( document.all ? document.all( 'icoPortfolio' ) : document.getElementById( 'icoPortfolio' ) );
		
		objContato.style.display   = 'none';
		objEquipe.style.display    = 'none';
		objAgencia.style.display   = 'none';
		objPortfolio.style.display = 'none';
		ajaxSend( 'meio.php', 'layCorpo', 'layCorpo', 'Carregando . . .' );
	}

    var intContador = 0;
    var objTimer = null;
    function slydeImagens() {
        if ( intContador < 2 ) {
            intContador++;
        }
        else {
            intContador = 0;
        }
        var objLayer1 = ( document.all ? document.all( 'layCapa1' ) : document.getElementById( 'layCapa1' ) );
        var objLayer2 = ( document.all ? document.all( 'layCapa2' ) : document.getElementById( 'layCapa2' ) );
        var objLayer3 = ( document.all ? document.all( 'layCapa3' ) : document.getElementById( 'layCapa3' ) );

        objLayer1.style.display = ( intContador == 0 ? 'block' : 'none' );
        objLayer2.style.display = ( intContador == 1 ? 'block' : 'none' );
        objLayer3.style.display = ( intContador == 2 ? 'block' : 'none' );
        objTimer = window.setTimeout( "slydeImagens()", 10000 );
    }

    function mostraLayer( strLayer ) {
        window.clearTimeout( objTimer );
        var objLayer1 = ( document.all ? document.all( 'layCapa1' ) : document.getElementById( 'layCapa1' ) );
        var objLayer2 = ( document.all ? document.all( 'layCapa2' ) : document.getElementById( 'layCapa2' ) );
        var objLayer3 = ( document.all ? document.all( 'layCapa3' ) : document.getElementById( 'layCapa3' ) );

        objLayer1.style.display = ( strLayer == 1 ? 'block' : 'none' );
        objLayer2.style.display = ( strLayer == 2 ? 'block' : 'none' );
        objLayer3.style.display = ( strLayer == 3 ? 'block' : 'none' );
    }
