function documentKeyPressHandler(){
	// Se pressionou a tecla <enter>
	if( (event.keyCode == 13) && (window.location.toString().indexOf("fale_conosco.aspx") <= 0)
	    && (window.location.toString().indexOf("alteracao_cadastro.aspx") <= 0) ){
		// Pega exatamente a action atual do client
		var sUrl = window.location.toString();
		sUrl = sUrl.substring(sUrl.lastIndexOf("/")+1, sUrl.length);
		var source = window.event.srcElement.name;
		if( source != undefined ){		
		    if( source.indexOf("txbCupom") >= 0 ){
			    document.getElementById("imbCupom").focus();
				document.getElementById("imbCupom").click(); 
			}
		
			if( source.indexOf("txbCaixaBusca") >= 0 ){
				document.getElementById("header_imbOkBusca").focus();
				document.getElementById("header_imbOkBusca").click();
			}
						
			if( source.indexOf("txbQtd") >= 0 ){
				document.getElementById("btnRecalcular").focus();
				document.getElementById("btnRecalcular").click();
			}
			
			if( source.indexOf("txbSenhaDetalhes") >= 0 ){
				document.getElementById("imgLoginDetalhe").focus();
				document.getElementById("imgLoginDetalhe").click();
			}
			
			if( source.indexOf("txbCep1") >= 0 || source.indexOf("txbCep2") >= 0 ){
				document.getElementById("btnCalculaFrete").focus();
				document.getElementById("btnCalculaFrete").click();
			}
			
			if( (sUrl == "finalizacao_pedido.aspx" && source.indexOf("txbLogin") >= 0)
			        || (sUrl == "finalizacao_pedido.aspx" && source.indexOf("txbSenha") >= 0) ){
			
			    document.getElementById("imgLogin").focus();
				document.getElementById("imgLogin").click();            
		    }
		    
		    if( source.indexOf("caixaLogin$txbLogin") >= 0 || source.indexOf("caixaLogin$txbSenha") >= 0  ){
				document.getElementById("caixaLogin$imgLogin").focus();
				document.getElementById("caixaLogin$imgLogin").click();
			}
			
			if( source.indexOf("txbNomeAviseMe") >= 0 || source.indexOf("txbEmailAviseMe") >= 0  ){
				document.getElementById("imbEnviarAviseMe").focus();
				document.getElementById("imbEnviarAviseMe").click();
			}
			
			if( source.indexOf("txbBuscaAutor") >= 0 ){
				document.getElementById("imbOkBuscaAutor").focus();
				document.getElementById("imbOkBuscaAutor").click();
			}
			
			if( source.indexOf("txbNome") >= 0 || source.indexOf("txbEmail") >= 0 ){
			    document.getElementById("imbEnviarAN").focus();
				document.getElementById("imbEnviarAN").click(); 
			}
			
			if( source.indexOf("txbMaterial") >= 0 ){
			    document.getElementById("imbPesquisaMateriais").focus();
				document.getElementById("imbPesquisaMateriais").click(); 
			}
			
			if( source.indexOf("txbCPFEsqueciSenha") >= 0 ){
			    document.getElementById("imbEsqueciSenha").focus();
				document.getElementById("imbEsqueciSenha").click(); 
			}
		}
		
		window.event.cancelBubble = true;
		window.event.returnValue = false;

	}
}

document.onkeypress = documentKeyPressHandler;