var ruoloselezionato = null;

var nonValidEmailDomain = new Array(
		'beep',
		'e4ward.com',
		'@0815.ru',
		'@0sg.net',
		'@0wnd.net',
		'@0wnd.org',
		'@10minutemail.com',
		'@10minutemail.com',
		'@12hourmail.com',
		'@1chuan.com',
		'@1zhuan.com',
		'@21cn.com',
		'@2prong.com',
		'@3126.com',
		'@3d-painting.com',
		'@3g.ua',
		'@4warding.com',
		'@4warding.net',
		'@4warding.org',
		'@50e.info',
		'@6url.com',
		'@9ox.net',
		'@a-bc.net',
		'@abwesend.de',
		'@addcom.de',
		'@agnitumhost.net',
		'@alpenjodel.de',
		'@alphafrau.de',
		'@amorki.pl',
		'@anonbox.net',
		'@anonymbox.com',
		'@antichef.com',
		'@antichef.net',
		'@antispam.de',
		'@antispam24.de',
		'@autosfromus.com',
		'@baldmama.de',
		'@baldpapa.de',
		'@ballyfinance.com',
		'@betriebsdirektor.de',
		'@bigmir.net',
		'@bin-wieder-da.de',
		'@bio-muesli.info',
		'@bio-muesli.net',
		'@bk.ru',
		'@bleib-bei-mir.de',
		'@blockfilter.com',
		'@bluebottle.com',
		'@bodhi.lawlita.com',
		'@bonbon.net',
		'@briefemail.com',
		'@brokenvalve.com',
		'@brokenvalve.org',
		'@bspamfree.org',
		'@buerotiger.de',
		'@bugmenot.com',
		'@bumpymail.com',
		'@buy-24h.net.ru',
		'@cashette.com',
		'@center-mail.de',
		'@centermail.at',
		'@centermail.ch',
		'@centermail.com',
		'@centermail.de',
		'@centermail.info',
		'@centermail.net',
		'@cghost.s-a-d.de',
		'@chongsoft.org',
		'@chongsoft.org',
		'@cool.fr.nf',
		'@coole-files.de',
		'@cosmorph.com',
		'@courriel.fr.nf',
		'@curryworld.de',
		'@cust.in',
		'@cyber-matrix.com',
		'@dandikmail.com',
		'@dating4best.net',
		'@deadspam.com',
		'@despam.it',
		'@despammed.com',
		'@dfgh.net',
		'@die-besten-bilder.de',
		'@die-genossen.de',
		'@die-optimisten.de',
		'@die-optimisten.net',
		'@dieMailbox.de',
		'@digital-filestore.de',
		'@directbox.com',
		'@discardmail.com',
		'@discardmail.de',
		'@discartmail.com',
		'@disposeamail.com',
		'@docmail.cz',
		'@dodgeit.com',
		'@dodgit.com',
		'@dogit.com',
		'@dontreg.com',
		'@dontreg.com',
		'@dontsendmespam.de',
		'@dontsentmespam.de',
		'@download-privat.de',
		'@dumpandjunk.com',
		'@dumpmail.com',
		'@dumpmail.de',
		'@dyndns.org',
		'@e-mail.com',
		'@e-mail.org',
		'@e4ward.com',
		'@eintagsmail.de',
		'@email.org',
		'@email4u.info',
		'@emaildienst.de',
		'@emailias.com',
		'@emailmiser.com',
		'@emailtaxi.de',
		'@emailto.de',
		'@emailwarden.com',
		'@example.com',
		'@fahr-zur-hoelle.org',
		'@fakeinformation.com',
		'@falseaddress.com',
		'@fantasymail.de',
		'@farifluset.mailexpire.com',
		'@fastacura.com',
		'@fastchevy.com',
		'@fastchrysler.com',
		'@fastkawasaki.com',
		'@fastmazda.com',
		'@fastmitsubishi.com',
		'@fastnissan.com',
		'@fastsubaru.com',
		'@fastsuzuki.com',
		'@fasttoyota.com',
		'@fastyamaha.com',
		'@feinripptraeger.de',
		'@fettabernett.de',
		'@filzmail.com',
		'@fishfuse.com',
		'@forgetmail.com',
		'@freemeilaadressforall.net',
		'@freudenkinder.de',
		'@fromru.com',
		'@front14.org',
		'@gawab.com',
		'@gawab.com',
		'@gentlemansclub.de',
		'@getonemail.com',
		'@ghosttexter.de',
		'@gishpuppy.com',
		'@gold-profits.info',
		'@goldtoolbox.com',
		'@golfilla.info',
		'@great-host.in',
		'@greensloth.com',
		'@greensloth.com',
		'@guerillamail.com',
		'@guerillamail.org',
		'@guerrillamail.biz',
		'@guerrillamail.com',
		'@guerrillamail.com',
		'@guerrillamail.de',
		'@guerrillamail.info',
		'@guerrillamail.org',
		'@h8s.org',
		'@hab-verschlafen.de',
		'@habmalnefrage.de',
		'@haltospam.com',
		'@hatespam.org',
		'@herr-der-mails.de',
		'@hidemail.de',
		'@home.de',
		'@hush.com',
		'@hushmail.com',
		'@i.ua',
		'@ich-bin-verrueckt-nach-dir.de',
		'@ich-will-net.de',
		'@imails.info',
		'@imstations.com',
		'@inbox.ru',
		'@inbox2.info',
		'@inboxclean.org',
		'@incognitomail.net',
		'@inerted.com',
		'@inet.ua',
		'@inmail24.com',
		'@ipoo.org',
		'@ist-allein.info',
		'@ist-einmalig.de',
		'@ist-ganz-allein.de',
		'@ist-willig.de',
		'@izmail.net',
		'@jetable.com',
		'@jetable.de',
		'@jetable.fr.nf',
		'@jetable.net',
		'@jetable.org',
		'@jetable.org',
		'@jetfix.ee',
		'@jetzt-bin-ich-dran.com',
		'@jn-club.de',
		'@junkmail.com',
		'@kaffeeschluerfer.com',
		'@kaffeeschluerfer.de',
		'@kasmail.com',
		'@kasmail.com',
		'@killmail.com',
		'@killmail.net',
		'@kinglibrary.net',
		'@klassmaster.com',
		'@klassmaster.net',
		'@kommespaeter.de',
		'@krim.ws',
		'@kuh.mu',
		'@kulturbetrieb.info',
		'@lass-es-geschehen.de',
		'@liebt-dich.info',
		'@link2mail.net',
		'@list.ru',
		'@listomail.com',
		'@litedrop.com',
		'@lortemail.dk',
		'@loveyouforever.de',
		'@maennerversteherin.com',
		'@maennerversteherin.de',
		'@mail.by',
		'@mail.htl22.at',
		'@mail.misterpinball.de',
		'@mail.ru',
		'@mail.ru',
		'@mail.svenz.eu',
		'@mail15.com',
		'@mail2rss.org',
		'@mail333.com',
		'@mail4days.com',
		'@mail4u.info',
		'@mailblocks.com',
		'@mailbucket.org',
		'@mailcatch.com',
		'@maileater.com',
		'@maileater.com',
		'@mailexpire.com',
		'@mailexpire.com',
		'@mailfreeonline.com',
		'@mailin8r.com',
		'@mailinater.com',
		'@mailinator.com',
		'@mailinator.com',
		'@mailinator.net',
		'@mailinator2.com',
		'@mailinblack.com',
		'@mailmoat.com',
		'@mailnull.com',
		'@mailquack.com',
		'@mailshell.com',
		'@mailsiphon.com',
		'@mailtrash.net',
		'@mailueberfall.de',
		'@mailzilla.com',
		'@makemetheking.com',
		'@mamber.net',
		'@meine-dateien.info',
		'@meine-diashow.de',
		'@meine-fotos.info',
		'@meine-urlaubsfotos.de',
		'@meinspamschutz.de',
		'@messagebeamer.de',
		'@metaping.com',
		'@mintemail.com',
		'@mns.ru',
		'@moncourrier.fr.nf',
		'@monemail.fr.nf',
		'@monmail.fr.nf',
		'@mt2009.com',
		'@mufmail.com',
		'@muskelshirt.de',
		'@mx0.wwwnew.eu',
		'@my-mail.ch',
		'@myadult.info',
		'@mycleaninbox.net',
		'@mymail-in.net',
		'@mytempemail.com',
		'@mytop-in.net',
		'@mytrashmail.com',
		'@mytrashmail.com',
		'@mytrashmail.compookmail.com',
		'@nervmich.net',
		'@nervtmich.net',
		'@netmails.com',
		'@netmails.net',
		'@netterchef.de',
		'@netzidiot.de',
		'@neue-dateien.de',
		'@neverbox.com',
		'@nm.ru',
		'@no-spam.ws',
		'@nobulk.com',
		'@nomail2me.com',
		'@nospam4.us',
		'@nospamfor.us',
		'@nospammail.net',
		'@nowmymail.com',
		'@nullbox.info',
		'@nur-fuer-spam.de',
		'@nurfuerspam.de',
		'@nybella.com',
		'@office-dateien.de',
		'@oikrach.com',
		'@oneoffemail.com',
		'@oopi.org',
		'@open.by',
		'@orangatango.com',
		'@partybombe.de',
		'@partyheld.de',
		'@phreaker.net',
		'@pisem.net',
		'@pleasedontsendmespam.de',
		'@polizisten-duzer.de',
		'@poofy.org',
		'@pookmail.com',
		'@pookmail.com',
		'@pornobilder-mal-gratis.com',
		'@portsaid.cc',
		'@postfach.cc',
		'@privacy.net',
		'@prydirect.info',
		'@pryworld.info',
		'@public-files.de',
		'@punkass.com',
		'@put2.net',
		'@quantentunnel.de',
		'@qv7.info',
		'@ralib.com',
		'@raubtierbaendiger.de',
		'@recode.me',
		'@record.me',
		'@recursor.net',
		'@rejectmail.com',
		'@rootprompt.org',
		'@saeuferleber.de',
		'@safe-mail.net',
		'@safersignup.de',
		'@sags-per-mail.de',
		'@sandelf.de',
		'@satka.net',
		'@schmusemail.de',
		'@schreib-doch-mal-wieder.de',
		'@senseless-entertainment.com',
		'@shared-files.de',
		'@shieldedmail.com',
		'@shinedyoureyes.com',
		'@shortmail.net',
		'@sibmail.com',
		'@siria.cc',
		'@skeefmail.net',
		'@slaskpost.se',
		'@slopsbox.com',
		'@slopsbox.com',
		'@sms.at',
		'@sneakemail.com',
		'@sofort-mail.de',
		'@sofortmail.de',
		'@sogetthis.com',
		'@sogetthis.com',
		'@sonnenkinder.org',
		'@soodonims.com',
		'@spam.la',
		'@spam.la',
		'@spamavert.com',
		'@spambob.com',
		'@spambob.net',
		'@spambob.org',
		'@spambog.com',
		'@spambog.de',
		'@spambog.ru',
		'@spambox.us',
		'@spambox.us',
		'@spamcannon.com',
		'@spamcannon.net',
		'@spamcon.org',
		'@spamcorptastic.com',
		'@spamcowboy.com',
		'@spamcowboy.net',
		'@spamcowboy.org',
		'@spamday.com',
		'@spameater.com',
		'@spameater.org',
		'@spamex.com',
		'@spamfree24.com',
		'@spamfree24.de',
		'@spamfree24.eu',
		'@spamfree24.info',
		'@spamfree24.net',
		'@spamfree24.org',
		'@spamfree24.org',
		'@spamgourmet.com',
		'@spamgourmet.com',
		'@spamgourmet.net',
		'@spamgourmet.org',
		'@spamgrube.net',
		'@spamherelots.com',
		'@spamhole.com',
		'@spamhole.com',
		'@spamify.com',
		'@spaminator.de',
		'@spaml.com',
		'@spammote.com',
		'@spammotel.com',
		'@spammotel.com',
		'@spammuffel.de',
		'@spamoff.de',
		'@spamreturn.com',
		'@spamspot.com',
		'@spamspot.com',
		'@spamtrail.com',
		'@sperke.net',
		'@sriaus.com',
		'@streber24.de',
		'@super-auswahl.de',
		'@sweetville.net',
		'@tagesmail.eu',
		'@teewars.org',
		'@temp-mail.com',
		'@temp-mail.org',
		'@tempe-mail.com',
		'@tempemail.biz',
		'@tempemail.net',
		'@tempemail.net',
		'@tempinbox.com',
		'@tempomail.fr',
		'@tempomail.fr',
		'@temporarily.de',
		'@temporaryforwarding.com',
		'@temporaryinbox.com',
		'@temporaryinbox.com',
		'@terminverpennt.de',
		'@test.com',
		'@test.de',
		'@thepryam.info',
		'@thisisnotmyrealemail.com',
		'@topmail-files.de',
		'@tortenboxer.de',
		'@totalmail.de',
		'@trash-mail.com',
		'@trash-mail.de',
		'@trashbox.eu',
		'@trashdevil.com',
		'@trashdevil.de',
		'@trashmail.com',
		'@trashmail.de',
		'@trashmail.net',
		'@trashmail.net',
		'@trashmail.org',
		'@trashymail.com',
		'@trashymail.net',
		'@trimix.cn',
		'@turboprinz.de',
		'@turboprinzessin.de',
		'@tut.by',
		'@twinmail.de',
		'@ua.fm',
		'@uk2.net',
		'@ukr.net',
		'@unterderbruecke.de',
		'@verlass-mich-nicht.de',
		'@vinbazar.com',
		'@vollbio.de',
		'@volloeko.de',
		'@vorsicht-bissig.de',
		'@vorsicht-scharf.de',
		'@walala.org',
		'@war-im-urlaub.de',
		'@wbb3.de',
		'@webmail4u.eu',
		'@wegwerfadresse.de',
		'@wegwerfemail.com',
		'@wegwerfemail.de',
		'@weibsvolk.de',
		'@weibsvolk.org',
		'@weinenvorglueck.de',
		'@wh4f.org',
		'@whopy.com',
		'@will-hier-weg.de',
		'@willhackforfood.biz',
		'@wir-haben-nachwuchs.de',
		'@wir-sind-cool.org',
		'@wirsindcool.de',
		'@wolke7.net',
		'@women-at-work.org',
		'@wormseo.cn',
		'@wp.pl',
		'@wronghead.com',
		'@wuzup.net',
		'@xents.com',
		'@xmail.com',
		'@xmaily.com',
		'@xoxy.net',
		'@xsecurity.org',
		'@yandex.ru',
		'@yesey.net',
		'@yopmail.com',
		'@yopmail.com',
		'@yopmail.fr',
		'@yopmail.net',
		'@yopweb.com',
		'@youmailr.com',
		'@ystea.org',
		'@yzbid.com',
		'@zoemail.com',
		'@zoemail.net',
		'@zweb.in',
		'killmail.net',
		'spam'
	);

// * ***************************
// * Gestione del campo: highlight e selezione ruoli

function highlight_img( ruolo, value ) {

	if( ruolo == 'qualsiasi' )
		for( var r in ruoli ) {
			if( r != 'qualsiasi' )
				highlight_img( r, value );
		}
	else {
		var img = $('#img_'+ruolo)[0];
		img.style.display = value ? 'block' : 'none';
	}
}


function highlight_txt( ruolo, value ) {
	var t = $('#testo'+ruolo)[0];

	t.style.color = value ? 'Red' : 'Black';
	t.style.fontStyle = value ? 'italic' : 'normal';
	t.style.border = value ? '2px solid Red' : '0px solid Black';
}


function setHighlight(ruolo, value)
{
	highlight_img( ruolo, value );
	highlight_txt( ruolo, value );
}

function setHighlightAll( value ) {
	for( var r in ruoli )
		setHighlight(r, value);
}

function setHighlightSelected() {
	if( ruoloselezionato )
		setHighlight( ruoloselezionato, true );
}


function highlight(ruolo) {
	setHighlightAll(false);
	setHighlight(ruolo,true);
}

function disable_highlight() {	
	setHighlightAll(false);
	setHighlightSelected();
}

function setSelectedEmph(value) {
	if( ruoloselezionato )
		$('#testo'+ruoloselezionato)[0].style.textDecoration = value ? 'underline' : 'none';
}


function selectruolo(ruolo)
{
	setSelectedEmph(false);
	ruoloselezionato = ruolo;
	setSelectedEmph(true);
	highlight(ruolo);

	$('#ruoloform').val(ruoli[ruolo]);
	$('#errore_ruolo').hide();
}



// * ***************************
// * Check on fly

var check_span_field = new Array();
check_span_field['comune'] = new Array( '#errore_comune_empty' );
check_span_field['nome'] = new Array( '#errore_nome_empty', '#errore_nome_3' );
check_span_field['username'] = new Array( '#errore_username_empty', '#errore_username_invalido_3', '#errore_username_invalido_inv', '#errore_username_invalido_usato' );
check_span_field['email'] = new Array( '#errore_email_empty', '#errore_email_invalido', '#errore_email_usata');
check_span_field['password'] = new Array( '#errore_password_empty', '#errore_password_3');
check_span_field['password_2'] = new Array( '#errore_password_eq' );
check_span_field['ruolo'] = new Array( '#errore_ruolo' );
check_span_field['privacy'] = new Array( '#errore_privacy' );
check_span_field['captcha'] = new Array( '#errore_captcha' );
check_span_field['cellulare'] = new Array( '#errore_cellulare_invalido' );
check_span_field['datanascita'] = new Array( '#errore_datanascita_invalido' );

function check_showSpans( field, toTurnOn ) {
	for( var idx = 0; idx < check_span_field[field].length; idx++ )
		if( idx == toTurnOn ) $(check_span_field[field][idx]).show();
		else $(check_span_field[field][idx]).hide();
	return false;
}

function check_setImg( id, value ) {
	var img = $('#'+id)[0];
	if( value == -1 )
		img.src = '/imgs/icons/loader.gif';
	else
		img.src = value ? '/imgs/icons/yes.png' : '/imgs/icons/no.png';
}

function check_comune( showalert ) {

	var v = $('#hid_comune').val();

	var valid = true;
	
	if( v <= 0 )
		valid = check_showSpans( 'comune', 0 );
	else
		check_showSpans('comune',-1);

	if( !valid && showalert ) { 
		myAlert("Specifica il comune");
		$('#outer_ajax_html_selettore').addClass('bgorange');
	}

	return valid;
}

function check_nome( showalert )
{
	var valid = true;
	var v = $('#txt_nome').val();

	if( v.length == 0 ) {
		valid = check_showSpans( 'nome', 0);
	} else if( v.length < 3 || v.length > 21 ) {
		valid = check_showSpans( 'nome', 1);
	} else {
		check_showSpans( 'nome', -1 );
	}

	check_setImg('img_onfly_nome', valid);

	if( !valid && showalert ) myAlert("Controlla il nome");

	return valid;
}


function check_username(showalert)
{
	var valid = true;
	var v = $('#txt_username').val();

	var illegalChars = "^[_\.-]|[^a-zA-Z0-9_\.-]|[_\.-]$|[_\.-]{2,}";

	if( v.length == 0 ) {
		valid = check_showSpans( 'username', 0 );
	} else if( v.length < 3 ) {
		valid = check_showSpans( 'username', 1 );
	} else if( v.match(illegalChars)) {
		valid = check_showSpans( 'username', 2 );
	} else {
		check_showSpans( 'username', -1 );
		$.get( '/ajax/checkutenti.php?do=check_username_exists&username='+v, function(res){
			var valid_answer = { 'L' : 0, '3' : 1, 'IC' : 2, 'Y' : 3 };
			if( typeof valid_answer[res] != 'undefined' ) {
				check_showSpans( 'username', valid_answer[res] );
				check_setImg('img_onfly_username', false );
			} else {
				check_showSpans( 'username', -1 );
				check_setImg('img_onfly_username', true );
			}
		});
	}

	if( valid ) check_setImg('img_onfly_username', -1);
	else check_setImg('img_onfly_username', false);

	if( !valid && showalert ) myAlert("Controlla lo username");

	return valid;
}

function check_email( showalert, mustbeunique )
{
	var valid = true;
	var v = $('#txt_email').val();

	var validChars = "[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?";

	if( v.length == 0 ) {
		valid = check_showSpans( 'email', 0 );
	} else if(!v.match(validChars)) {
		valid = check_showSpans( 'email', 1 );
	} else if( mustbeunique ) {
		$.get( '/ajax/checkutenti.php?do=check_email_exists&email='+v, function(res){
			check_showSpans( 'email', res == 'Y' ? 2 : -1 );
			check_setImg( 'img_onfly_email', res != 'Y' );
		});
	}
	
	for(var i in nonValidEmailDomain)
		if(v.indexOf(nonValidEmailDomain[i]) != -1)
		{
			valid = false;
			break;
		}
	
	if( valid ) {
		check_setImg( 'img_onfly_email', mustbeunique ? -1 : true );
		check_showSpans( 'email', -1);
	} else 
		check_setImg('img_onfly_email', false);

	if( !valid && showalert ) myAlert("Controlla l'email");

	return valid;
}

function check_password( showalert )
{
	var valid = true;
	var v = $('#txt_password').val();

	if( v.length == 0 ) {
		valid = check_showSpans( 'password', 0 );
	} else if( v.length < 3 ) {
		valid = check_showSpans( 'password', 1 );
	} else {
		check_showSpans( 'password', -1);
	}

	check_setImg( 'img_onfly_password', valid);

	if( !valid && showalert ) myAlert("Controlla la password");

	return valid;
}


function check_password_same( showalert )
{
	var valid = true;
	var v1 = $('#txt_password').val();
	var v2 = $('#txt_password_2').val();

	if( v1 != v2 )
		valid = check_showSpans( 'password_2', 0 );
	else
		check_showSpans( 'password_2', -1);

	check_setImg( 'img_onfly_password_2', valid);

	if( !valid && showalert ) myAlert("Controlla la password");

	return valid;
}

function check_ruolo( showalert ) 
{
	var valid = $('#ruoloform').val() != '';
	check_showSpans( 'ruolo', valid ? -1 : 0 );
	
	if( !valid && showalert ) myAlert("Seleziona un ruolo");

	return valid;
}

function check_privacy( showalert ) 
{
	var valid = $('#chk_privacy')[0].checked;
	check_showSpans( 'privacy', valid ? -1 : 0 );

	if( !valid && showalert ) myAlert("Devi accettare l'informativa sui dati personali");

	return valid;
}

function check_captcha( showalert )
{
	var valid = $('#txt_captcha').val() != '';
	check_showSpans( 'captcha', valid ? -1 : 0 );

	if( !valid && showalert ) myAlert("Controlla il codice di controllo");

	return valid;
}


function check_cellulare( showalert )
{
	var valid = true;
	var v = $('#txt_cellulare').val();

	var validChars = "^((00|\\+)39[\. -]?)?3[0-9]{2}[\\. -]?[0-9]{5,8}$";

	if( v.length > 0 ) {
		if( !v.match(validChars)) {
			valid = check_showSpans( 'cellulare', 0 );
		}
	}
	
	if( valid ) check_showSpans( 'cellulare', -1 );

	check_setImg( 'img_onfly_cellulare', valid);

	if( !valid && showalert ) myAlert("Il numero di cellulare non risulta valido. Leggi e comprendi quanto riportato nell'help.\nNon sei obbligato a lasciare il numero di cellulare; se non vuoi farlo lascia quetso campo vuoto");

	return valid;
}

function check_datanascita( showalert )
{
	var valid = true;
	var v = $('#datepicker_data_nascita').val();

	if( v == '__/__/____' )
		return valid;
	
	//Un primo controllo rozzo
	var validChars = "^([0-9]){2}/([0-9]|_){2}/([0-9]|_){4}$";

	if( v.length > 0 ) {
		if( !v.match(validChars)) {
			valid = check_showSpans( 'datanascita', 0 );
		}
	}
	
	if( valid )
	{
		//Ora controllo se la data esiste ed è minore di oggi
		var currDay = v.substring(0,2)*1;
		var currMonth = v.substring(3,5)*1;
		var currYear = v.substring(6,10)*1;
		today = new Date();
		tempdata = new Date();		
		tempdata.setFullYear(currYear,currMonth-1,currDay);
		valid = ((tempdata.getDate()+"/"+(tempdata.getMonth()+1)+"/"+tempdata.getFullYear() == (currDay+"/"+currMonth+"/"+currYear)) && tempdata < today);
		if(!valid)
			check_showSpans( 'datanascita', 0 );
	}
	
	if( valid ) check_showSpans( 'datanascita', -1 );
		
	check_setImg( 'img_onfly_datanascita', valid);

	if( !valid && showalert ) myAlert("La data di nascita non è valida!");

	return valid;
}

function myAlert(txt) {
	// * Scusate ma jAlert fa cacare
	jAlert(txt);
	//alert(txt);
}
