function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) 
		selObj.selectedIndex=0;
}

function Color(t) {
	t.className='sep_tr_over';
}

function Decolor(t) {
	t.className='sep_tr';
}

/**** finestre popup ****/
function popup(){
	newwin = window.open('','win_img','width=700, height=500,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}

function imgpopup(){
	newwin = window.open('','pgpreview','width=520, height=425,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}
function popup_ring(){
	newwin = window.open('','win_img_ring','width=360, height=330,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}
function target_blank(x){
	document.getElementById(x).target="_blank";
}


/**** info privacy ****/
function mostra_informa(){
	document.getElementById('testo_informativa_1').style.display ='None';
	document.getElementById('testo_informativa_2').style.display ='';
}

function nascondi_informa(){
	document.getElementById('testo_informativa_1').style.display ='';
	document.getElementById('testo_informativa_2').style.display ='None';
}


/**** colonna dx bilanci/progetti per js attivo/no ****/
function mostra_jdx(id){
	document.getElementById('el'+id+'Child').className ='';
	document.getElementById('el'+id+'Parent').className ='menu_hidden';
}

function nascondi_jdx(id){
	document.getElementById('el'+id+'Child').className ='menu_hidden';
	document.getElementById('el'+id+'Parent').className ='menu_jright';
}

/****cartiografia ****/
function mappaita(){
	e=window.open('', 'mappa', "width=750,height=560,scrollbars=1,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20");
	e.focus();
}


function newsletter(){
		d=window.open('', 'newsletter', "width=560,height=640,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20");
		d.focus();
	}

/**** colonna dx bilanci/progetti per js attivo/no ****/
															
function mostra_aree(id, fine_indice){
	var inizio_indice_aree = 1;
	var fine_indice_aree = fine_indice;
	for (indice=inizio_indice_aree;indice<=fine_indice_aree;indice++) {
		if (indice==id) {
			document.getElementById('elmod_'+indice).className='menu_jright_att';
			document.getElementById('elmod_'+indice+'_Child').className='menu_hidden_att';
		} else {
			document.getElementById('elmod_'+indice).className='menu_jright';
			document.getElementById('elmod_'+indice+'_Child').className='menu_hidden';
		}
	}
}
/* rnd img come background */
function rnd_image(){
	
	// array con le img presenti nella dir
	var imgs = new Array("1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg");
	
	var rnd_img = Math.floor(Math.random()*imgs.length);
	
	document.write('<style type="text\/css">body {background:#e7e1de url(..\/..\/img\/share\/back-random\/' + imgs[rnd_img] +') no-repeat 0 0;}<\/style>');

}
function isEmail(str) {
	var supported = 0;
	if(window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if(!supported)
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,6}|[0-9]{1,3})(\\]?)$");

	return (!r1.test(str) && r2.test(str));
}

function isDate(str) {
	var arrivoArray = str.split("/"); 
	var dataarrivo=new Date()
	dataarrivo.setFullYear(arrivoArray[2],arrivoArray[1],arrivoArray[0])
	return (dataarrivo);
}

function MyTrim(myObj){
	var i;
	var myObjTmp;
	var myObjTmp2;

	if (myObj==null){
		myObj=''; 
		return myObj;
	}

	if (myObj=='') {
		return myObj;
	}

	for (i = 0; i < myObj.length; i++) {
		if(myObj.charAt(i) == ' '){
			myObjTmp = myObj.substr(i+1)
		} else {
			if (i==0) { 
				myObjTmp = myObj;
			}
			break;
		}
	}

	myObjTmp2 = myObjTmp

	if (myObjTmp.length > 0) {
		for (i = myObjTmp.length-1; i > 0; i--) {// elimina gli spazi finali
			if (myObjTmp.charAt(i) == ' '){
				myObjTmp2 = myObjTmp.substr(0,i)
			} else {
				break;
			}
		}
	}

	myObj = myObjTmp2
	return (myObj)
}
