function goURL(url){
	window.open(url, 'Page', '_blank');
}

function keyEnter(event){
	if(event.keyCode==13){
		 FormAjaxLogin();
	}
}
function FormAjaxLogin(){
    var username = jQuery("#username").attr("value");
    var password = jQuery("#password").attr("value");
    jQuery("#serverMsg").html('');
    jQuery.ajax({
		type: "POST",
		url: "login.php",
		dataType: "html",
		data: "login=" + username + "&passwd=" + password,
		success: function(response){
			if (response == "1") {
				jQuery("#serverMsg").html("Login correcto. Entrando...");
				document.location.href="inicio.php";
			}else{
				jQuery("#serverMsg").html("Usuario / Contrase&ntilde;a Incorrectos");
			}
		},
		error: function(){
			alert("Ha ocurrido un error en la petición Ajax.");
		}
	});
}

function showDialog(name){
	var width = 400;
	if (name=='avisolegal') width=950;
	$("#"+name).dialog({
		autoOpen: false,
		modal: false,
		width: width,
		title: 'Cocinas Jocar',
		buttons: {
			Aceptar: function() {
				$(this).dialog('close');
			}
		}
	});
	$("#"+name).dialog("open");
}

function show(secc, id){
	var destino = "viewImg.php?id=" + id + "&secc=" + secc;
	$.fn.colorbox({open: true, transition:"fade", iframe:true, href: destino, innerWidth:"80%", innerHeight:"80%", top: "10px"});
}
