/* ELEMENTOS COMUNES */
// Enlace en ventana nueva.
// Quitar el &nbsp; de inputs tipo texto, password y textareas.
$(document).ready( function() {
	// Enlace en ventana nueva.
	$("a[rel='external']").attr("target","_blank");

	// Quitar el &nbsp; de inputs tipo texto, password y textareas.
	$("input[type='text'], input[type='password'], textarea").focus( function() {
		if (($(this).attr("value")) && ($(this).attr("value").charCodeAt(0) == 32 || $(this).attr("value").charCodeAt(0) == 160) && ($(this).attr("value").length == 1)) {
			this.value = "";
			return false;
		}
	});
});

//Resaltar input(text-password)/textarea seleccionado
$(document).ready(function(){
	$("input[type='text'], input[type='password'], textarea").focus( function() {
		if ($(this).attr("readonly")) {
			// Nada
		} else {
			$(this).addClass("enfocado");
		}
		return false;
	});
	$("input[type='text'], input[type='password'], textarea").blur( function() {
		$(this).removeClass("enfocado");
	});
	$("input[type='text'], input[type='password'], textarea").each( function() {
		if ($(this).attr("readonly")) {
			$(this).addClass("solo_lectura");
		}
	});
});

$(document).ready(function(){
	$("tr.libre").mouseover( function() {
		$(this).find("td").addClass("libre_sobre");
	});
	$("tr.libre").mouseout( function() {
		$(this).find("td").removeClass("libre_sobre");
	});
});
