$(document).ready( function(){

if($("#ALL").height()<600) $("#ALL").height(600);
$("#IND H3").click( function() { 
	$("#IND").find("LI").hide();
	$(this).parent().find("LI").fadeIn("show"); 
	});

$(".proyecto H4").click( function() {
	$(".proyecto").find("DIV").hide();
	$(this).parent().find("DIV").fadeIn("show");
	if($("#ALL").height()<1200) $("#ALL").height(1200);
	});

$("#IND H3").hover(function(){ $(this).addClass("INDon"); },function(){ $(this).removeClass("INDon"); });

$("#cdrfotos").find("DIV").click( function() {
	$('#fototaller').attr('src', 'img/foto/max/'+$(this).find("IMG").attr('alt'));
	});

});

function cbfoto(img) {
	$('#fototaller').attr('src', 'img/foto/max/'+img);
}

function soloemail()
{
	if ((event.keyCode == 45)||(event.keyCode == 64)||(event.keyCode == 46)||(event.keyCode == 95)||(event.keyCode >= 97 && event.keyCode <= 122)||(event.keyCode >= 48 && event.keyCode <= 57)||(event.keyCode >= 65 && event.keyCode <= 90))
	{	event.returnValue = event.KeyCode; }
	else
	{	event.returnValue = false; }
}

function comprobar_email(email)
{
	if (email.indexOf(".")==-1 || email.indexOf("@")==-1) {
	return false
	}
	return true
}

function comprobar() {
	var nomb = new String(fo.nom.value);
	var mail = new String(fo.cor.value);
	var text = new String(fo.sug.value);
	var erro = new String;
	a = 0;
	
	erro = 'UPD Ávila, le informa que:\n\n';

	if(nomb.length < 3) {
		a = 1;
		erro = erro + '- No ha introducido su Nombre y Apellidos.\n';
		}
	if(!comprobar_email(mail)) {
		a = 1;
		erro = erro + '- No ha introducido su Correo Electrónico.\n';
		}
	if(text.length < 5) {
		a = 1;
		erro = erro + '- No ha expecificado su consulta o sugerencia.\n';
		}

	if(a) 
		window.alert(erro);
	else
		fo.submit();
}
