<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WebSite</title>
<style>
body{
	font:12px/1.3 'Segoe UI',Arial, sans-serif;
	text-shadow:1px 1px 0 rgba(255,255,255,0.5);
}

a, a:visited {
	text-decoration:none;
	outline:none;
	color:#666;
}

a:hover{
	text-decoration:underline;
	
}

input{
    border:1px solid #899caa;
    border-radius:3px;
    -moz-border-radius:3px;
    color:#3a454d;
    font-weight:bold;
    padding:3px 3px;
    box-shadow:inset 0px 1px 3px #bbb;
    -webkit-box-shadow:inset 0px 1px 3px #bbb;
    -moz-box-shadow:inset 0px 1px 3px #bbb;
    font-size:12px;
}

</style>

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
	
	$(document).ready(function(e) {
        
    
	$("#edtEvento").keypress(function(event) {
  if ( event.which == 13 ) {
     event.preventDefault();
  	 CarregarWebSite();
   }
	});

});

$("#edtEvento").click(function() {
  $("#edtEvento").keypress();
});
	
	
	var url   = window.location.search.replace("?", "");
	var items = url.split("?");
	var id_empresa = items[0].split('=');
	id_empresa = id_empresa[1];

	
	$(document).on('click','#btnCarregarFoto',function(){
		CarregarWebSite();
	return false;
	
	})
	
function CarregarWebSite(){
		var website = $('#edtEvento').val();
		$.ajax({
		type : "POST",
		url : "ax.website.php",
		dataType:"json",
		data : 'ax=VerificaExternoWebSite&id_empresa=' + id_empresa +'&website='+website,
		beforeSend : function() {
			$("#pnRetornoWebSite").html('<img src="img/load_curto.gif"/>').fadeIn('slow');
		},
		success : function(R) {
								if(R.controle != 0){
									$('#pnRetornoWebSite').html('<a href="http://www.vfoto.com.br/website.php?website='+ 
									R.website +'" target="_blank">'+R.img +' '+  R.nome +'</a>').show('fast');
									$('#pnDados').hide();
									
								} else {
									$('#edtEvento').select();
									
									$('#pnRetornoWebSite').html('WebSite não localizado tente novamente');
								}
							
							
							},
		error : function(R) {$("#pnRetornoWebSite").html('Falha ao carregar, ou tente novamente!').fadeIn('slow');
							$("#pnRetornoWebSite").addClass('ui-state-error ui-corner-all');
		}

	}) // fim ajax

}	
		
</script>

</head>

<body>
<div id="pnDados" >
                    <input name="edtEvento" id="edtEvento" type="text" size="20">
                    <a href="#" id="btnCarregarFoto" class="button">Carregar Fotos</a>
</div>
<div id="pnRetornoWebSite">
  <p>Informe a senha do evento que está no cartão.</p>
</div>
                    
</body>
</html>