// JavaScript Document
//controllo IE6
if ($.browser.msie && $.browser.version < 7){
	//do other stuff
	alert ("Questo sito non e' ottimizzato per Internet Explorer 6 o versioni precedenti: aggiorna il tuo browser se vuoi avere accesso a tutte le funzionalita' del sito.");
} 


function checkCancella(){
	var OK = window.confirm("Sicuro di voler cancellare?");
	if (OK) {
		return true;
	} else {
		return false;
	}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function ControllaMail(EmailAddr)  {
	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if (Filtro.test(EmailAddr)) {
		return true;
	} else {
		return false;
	}
}



// offusca indirizzo email
// es. offuscare info@miosito.it diventa aW5mb0BtaW9zaXRvLml0
//<a rel="aW5mb0BtaW9zaXRvLml0" class="offuscaindirizzoe">Devi avere javascript abilitato per visualizzare questo indirizzo.</a>
// usare http://sito/js/tools/offuscameil.html per generarare la stringa
 $('.offuscaindirizzoe').each(function(){
	var address = $.base64Decode($(this).attr('rel'));
 	$(this).attr('href', 'mailto:'+address);
	$(this).text(address);
});


// controllo campi obbligatori secondo una classe
// restituisce true o false
// input text => obblRiga
// input select => obblSelect
// input check => obblCheck
function controllaObbligatori() { 
	tmpval=0;
	$('.obblRiga').each(function(){
		if($(this).val() == '') {
				tmpval=tmpval+1
		} 						 
	});
	
	$('.obblSelect').each(function(){
		if($('option:selected', this ).val() == '') {
				tmpval=tmpval+1
		} 						 
	});
	
	$('.obblCheck').each(function(){
		idcheck= $(this).attr('id')	;					  
		if($('#'+$(this).attr('id')+':checked').val() === undefined) {
				tmpval=tmpval+1
		} 						 
	});
	
	if (tmpval == 0 ){
		return true;
	} else {
		return false;
	}
}


//


