function showFiglio(codice,imgName) {
			
	altro_el = document.getElementById(codice).style; 
	//spanName = document.getElementById(imgName).style;
	
	if(altro_el.display == "") {
		altro_el.display = "none" ;
		//spanName.backgroundImage = "url(img/pallino.gif)" ;
		//spanName.backgroundRepeat = "no-repeat" ;
	}else {
		altro_el.display = "" ;
		//spanName.backgroundImage = "url(img/pallino.gif)" ;
		//spanName.backgroundRepeat = "no-repeat" ;
	}
}

function toggleDisplay(fO){
	
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);


	if(ie5 || ns6){
		if (document.getElementById(fO).style.display=="none") {
		document.getElementById(fO).style.display="inline";
		}else{
		document.getElementById(fO).style.display="none";
		}
	}

	if(ie4){
		if (document.all[fO].style.display=="none") {
		document.all[fO].style.display="inline";
		}else{
		document.all[fO].style.display="none";
		}
	}	
}

function apriDiv(fO){
	
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);


	if(ie5 || ns6){
		
		document.getElementById(fO).style.display="";
		
	}

	if(ie4){
		
		document.all[fO].style.display="";
		
	}	
}

function chiudiDiv(fO){
	
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);


	if(ie5 || ns6){
		
		document.getElementById(fO).style.display="none";
		
	}

	if(ie4){
		
		document.all[fO].style.display="none";
		
	}	
}

function toggleNLetterSrc(fO) {
	
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);
	
	
	// a prescindere stuto l'altro
	if(ie5 || ns6){
		if(fO == "src_email"){
			document.getElementById('src_gruppo').style.display="none";
		} else {
			document.getElementById('src_email').style.display="none";
		}
	}
	if(ie4){
		if(fO == "src_email"){
			document.all['src_gruppo'].style.display="none";
		} else {
			document.all['src_email'].style.display="none";
		}
	}	
	
	toggleDisplay(fO);
	
}


function riportalocalita(id_regione,id_provincia,id_comune,regione,provincia,comune) {
	
	window.opener.document.form.id_regione.value=id_regione;
	window.opener.document.form.id_provincia.value=id_provincia;
	window.opener.document.form.id_comune.value=id_comune;
	window.opener.document.form.regione.value=regione;
	window.opener.document.form.provincia.value=provincia;
	window.opener.document.form.comune.value=comune;

self.close();
}



/* quistione di date */ 

function riporta_data(year,month,day) {
	self.close();
	opener.setData(day,month,year);	
}

function riporta_data_src(year,month,day) {
	self.close();
	opener.setDataSrc(day,month,year);	
}

function riporta_data_in(year,month,day) {
	self.close();
	opener.setDataIn(day,month,year);	
}

function riporta_data_out(year,month,day) {
	self.close();
	opener.setDataOut(day,month,year);	
}

function riporta_data_in_src(year,month,day) {
	self.close();
	opener.setDataInSrc(day,month,year);	
}

function riporta_data_out_src(year,month,day) {
	self.close();
	opener.setDataOutSrc(day,month,year);	
}
 
function riporta_data_in_ical(year,month,day) {
	self.close();
	opener.setDataInIcal(day,month,year);	
}

function setDataInIcal(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;
	
	document.form_ical.data_in_ical.value = date;
	document.form_ical.data_in_ical_vis.value = dateVis;
}

function riporta_data_out_ical(year,month,day) {
	self.close();
	opener.setDataOutIcal(day,month,year);	
}

function setDataOutIcal(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;
	
	document.form_ical.data_out_ical.value = date;
	document.form_ical.data_out_ical_vis.value = dateVis;
}

function setData(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;
	
	document.form.data.value = date;
	document.form.data_vis.value = dateVis;
}

function setDataIn(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;

	document.form.data_in.value = date;
	document.form.data_in_vis.value = dateVis;
}

function setDataOut(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;
	
	document.form.data_out.value = date;
	document.form.data_out_vis.value = dateVis;
}

function setDataInSrc(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;

	document.form_src.data_in_src.value = date;
	document.form_src.data_in_src_vis.value = dateVis;
}

function setDataOutSrc(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;
	
	document.form_src.data_out_src.value = date;
	document.form_src.data_out_src_vis.value = dateVis;
}

function setDataSrc(day,month,year) {
var day = String(day) ;
var month = String(month) ;
var year = String(year) ;

	if(day.length == 1)day = "0" + day ;
	if(month.length == 1)month = "0" + month ;
	
	dateVis=day+'-'+month+'-'+year;	
	date=year+month+day;

	document.form_src.data_src.value = date;
	document.form_src.data_src_vis.value = dateVis;
}

function riporta_data_(data,campo){
 
 var dataincongruente = 0 ;
 
 Arr = data.split("-")
 
 datavisYYYY  = Arr[0] ; 
 datavisMM  = Arr[1] ; 
 datavisGG  = Arr[2] ; 
 
 if(datavisMM.length == 1) datavisMM = "0" + datavisMM ;
 if(datavisGG.length == 1) datavisGG = "0" + datavisGG ;

 datavis = datavisGG + "-" + datavisMM + "-" + datavisYYYY ;
 data = datavisYYYY + datavisMM + datavisGG ;


 if(campo == "stage_al") {
	
	if(window.opener.document.form.stage_dal.value > data ){
	 	alert ('data incongruente') ;
 		dataincongruente = 1 ;
 	} else {
		window.opener.document.form.stage_al.value=data ;
		window.opener.document.form.stage_al_vis.value=datavis ;
	}
}

 if(campo == "stage_dal") {
	window.opener.document.form.stage_dal.value=data ;
	window.opener.document.form.stage_dal_vis.value=datavis ;
}
 
  if(campo == "data_in") {
	window.opener.document.form.data_in.value=data ;
	window.opener.document.form.data_in_vis.value=datavis ;
}
 if(campo == "data_out") {
 	if(window.opener.document.form.data_in.value > data ){
 		alert ('data incongruente') ;
 		dataincongruente = 1 ;
 		} else {
		window.opener.document.form.data_out.value=data ;
		window.opener.document.form.data_out_vis.value=datavis ;
	}
}
	if (dataincongruente == 0) { 
		self.close();	
	}
}


/* fine quistione di date */


function popup(url_pagina,w,h,sw_scroll) {

	
	  /*w = 500;
	  h = 400;*/
	  l = (screen.width - w) / 2;
	  t = (screen.height - h) / 2;
	
	  wnd = window.open(url_pagina,"","fullscreen=0,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+sw_scroll+", resizable=no, width="+w+", height="+h+", left="+l+", top="+t);
	  wnd.focus();		

}


function setEditable(campo, valore, tipo) {

	var url = "php/ajax.php?action=setEditable&campo="+campo+"&valore="+valore ;
	
	var ajaxObj = new ClassAJAX();

	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement (campo) ;
	ajaxObj.runAJAX (url) ;
	
}

function setEditableClose(campo, valore) { 

	
	var elemento = document.getElementById(campo);
	
	elemento.innerHTML = 	'<span id='+campo+' onmouseout="this.className=\'EDText\'" onmouseover="this.className=\'EDTextOver\'" class="EDText" onclick="setEditable(\''+campo+'\',\''+valore+'\',\'text\')" title="Clicca qui per editare">'+ 
							valore +
							'</span>' ;
			 
}






/*************************/
function setVariables(){
	if (navigator.appName == "Netscape") {
		if (parseInt(navigator.appVersion) >= 5){
			v=".top=";
			h=".left=";
			dS="document.getElementById(\"";sD="\").style";
			y="window.pageYOffset";
			x="window.pageXOffset";
		}
		else {
			v=".top=";
			h=".left=";
			dS="document.";
			sD="";
			y="window.pageYOffset";
			x="window.pageXOffset";
		}
	}
	else {
	//ENTRO QUI
		h=".pixelLeft=";
		v=".pixelTop=";
		dS="";
		sD=".style";
		y="document.body.scrollTop";
		x="document.body.scrollLeft";
	}
	checkLocationA()
}

movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0
var elFake ;


function checkLocation(){
	object="obj";
	yy=eval(y);
	xx=eval(x);
	ydiff=ystart-yy;
	xdiff=xstart-xx;
	
	if ((ydiff<(-1))||(ydiff>(1))) {
		movey=Math.round(ydiff/10) ;
		ystart-=movey ;
	}
	if ((xdiff<(-1))||(xdiff>(1))) {
		movex=Math.round(xdiff/10) ; 
		xstart-=movex ;
	}
	
	if (ystart>=10){
		
		var alldiv = document.body.getElementsByTagName("DIV");
		nu = alldiv.length ;
		var altro_div = null ;
	
		
		for(r=0;r<nu;r++){
			if("DivAnag" == alldiv[r].getAttribute('id')){
				altro_div = alldiv[r].getAttribute('id');		
			}
		}
		
		elFake = document.getElementById(altro_div).style ;
		var newY = ystart+10 ;
		eval("elFake"+".top="+newY) ;
		
	} 
	else {
		var alldiv = document.body.getElementsByTagName("DIV");
		nu = alldiv.length ;
		var altro_div = null ;
	
		
		for(r=0;r<nu;r++){
			if("DivAnag" == alldiv[r].getAttribute('id')){
				altro_div = alldiv[r].getAttribute('id');		
			}
		}
		
		//elFake = document.getElementById(altro_div).style ;
		//var newY = 10 ;
		//eval("elFake"+".top="+newY) ;
	}


	var alldiv = document.body.getElementsByTagName("DIV");
	nu = alldiv.length ;
	var altro_div = null ;

	
	for(r=0;r<nu;r++){
		if("DivAnag" == alldiv[r].getAttribute('id')){
			altro_div = alldiv[r].getAttribute('id');		
		}
	}
	
	//elFake = document.getElementById(altro_div).style ;
	//var newX = xstart ;
	//eval("elFake"+".left="+newX) ;
		
	setTimeout("checkLocation()",10);
}

function checkLocationA(){
	ystart=eval(y);
	xstart=eval(x);
}
/*************************/

function storicoDettaglio(id_storico) {
	var url = "php/ajax.php?center=storico&id_storico="+id_storico ;
	
	var ajaxObj = new ClassAJAX();

	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement ('storicoDettaglio') ;
	ajaxObj.runAJAX (url) ;
}




function resetJob() {
	
	 
	
	 
		for (i = 0; i < document.form.inglese_lingua.length; i++) {
			document.form.inglese_lingua[i].checked = false ;
		}
		for (i = 0; i < document.form.francese_lingua.length; i++) {
			document.form.francese_lingua[i].checked = false ;
		}
		for (i = 0; i < document.form.tedesco_lingua.length; i++) {
			document.form.tedesco_lingua[i].checked = false ;
		}
		for (i = 0; i < document.form.spagnolo_lingua.length; i++) {
			document.form.spagnolo_lingua[i].checked = false ;
		}
	 
	
	 
} 

function chekFormBlog(){
		
		var swKO = 0 ;
		var msg = "" ;
 
		// sezione valida email
		var x = document.form.email.value;
		this.emailForm = x ;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		msg += 'Indirizzo email inesatto.\n';
		swKO = 1 ;	
		} 	
		
		// sezione campi obbligatori
		if (document.form.nome.value == "" ) {
		msg += 'Manca il nome.\n';
		swKO = 1 ;
		}
		if (document.form.cognome.value == "" ) {
		msg += 'Manca il cognome.\n';
		swKO = 1 ;
		}	
		if (document.form.email.value == "" ) {
		msg += 'Manca l\' email.\n';
		swKO = 1 ;
		} 
		
		if (document.form.captchastring.value == "" ) {
		msg += 'Manca il codice.\n';
		swKO = 1 ;
		} 
		if (document.form.commento.value == "" ) {
		msg += 'Manca il commento.\n';
		swKO = 1 ;
		} 
		
		if (swKO == 1) {
			alert(msg) ;
			return false ;	
		}  else {
			//return true ;	
		}
}

function checkFormCurriculum() { 	
		
		var swKO = 0 ;
		var msg = "" ;
 
		// sezione valida email
		var x = document.form.email.value;
		this.emailForm = x ;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		msg += 'Indirizzo email inesatto.\n';
		swKO = 1 ;	
		} 

		// sezione campi obbligatori
		if (document.form.nome.value == "" ) {
		msg += 'Manca il nome.\n';
		swKO = 1 ;
		}
		if (document.form.cognome.value == "" ) {
		msg += 'Manca il cognome.\n';
		swKO = 1 ;
		}	
		if (document.form.email.value == "" ) {
		msg += 'Manca l\' email.\n';
		swKO = 1 ;
		} 
		 
		 
		
		if (document.form.candidato_2.value == "" ) {
		msg += 'Manca il curriculum.\n';
		swKO = 1 ;
		}  
		 
		
		
		var the_box1 = document.form.acconsento1[1].checked;
		
		 
		if (the_box1 == true) {
			msg += "Devi accettare la clausola.\n" ;
			swKO = 1 ;
		}
		
		
		if (swKO == 1) {
			alert(msg) ;
			return false ;	
		}  else {
			//return true ;	
		}
}

function checkFormIscriviti() { 	
		
		var swKO = 0 ;
		var msg = "" ;
 
		// sezione valida email
		var x = document.form.email.value;
		this.emailForm = x ;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		msg += 'Indirizzo email inesatto.\n';
		swKO = 1 ;	
		} 

		// sezione campi obbligatori
		if (document.form.nome.value == "" ) {
		msg += 'Manca il nome.\n';
		swKO = 1 ;
		}
		if (document.form.cognome.value == "" ) {
		msg += 'Manca il cognome.\n';
		swKO = 1 ;
		}	
		if (document.form.email.value == "" ) {
		msg += 'Manca l\' email.\n';
		swKO = 1 ;
		} 
		 
		if (document.form.login.value == "" ) {
		msg += 'Mancala login.\n';
		swKO = 1 ;
		} 	 
		 
		if (document.form.passwd.value == "" ) {
		msg += 'Manca la password.\n';
		swKO = 1 ;
		} 
		 
		
		
		var the_box1 = document.form.acconsento1[1].checked;
		
		 
		if (the_box1 == true) {
			msg += "Devi accettare la clausola.\n" ;
			swKO = 1 ;
		}
		
		
		if (swKO == 1) {
			alert(msg) ;
			return false ;	
		}  else {
			//return true ;	
		}
}


function checkFormContatto() { 	
				 
		var swKO = 0 ;
		var msg = "" ;
 
		// sezione valida email
		var x = document.contatto.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
			msg += "Indirizzo email inesatto.\n" ;
		swKO = 1 ;	
		} 

		// sezione campi obbligatori
		if (document.contatto.nome.value == "" ) {
			msg += "Manca il nome.\n" ;
			swKO = 1 ;
		}
		if (document.contatto.cognome.value == "" ) {
			msg += "Manca il cognome.\n" ;
			swKO = 1 ;
		}
	
		if (document.contatto.email.value == "" ) {
			msg += "Manca l\'email.\n" ;
			swKO = 1 ;
		} 

		if (document.contatto.messaggio.value == "" ) {
			msg += "Manca il messaggio.\n" ;
			swKO = 1 ;
		}
		
		var the_box1 = document.contatto.acconsento1[1].checked;
		
		 
		if (the_box1 == true) {
			msg += "Devi accettare la clausola.\n" ;
			swKO = 1 ;
		}
		
		if (swKO == 1) {
			alert(msg);
			return false ;		
		}  
 
}

function checkFormNletter() { 	
				 
		var swKO = 0 ;
		var msg = "" ;
 
		// sezione valida email
		var x = document.contatto.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
			msg += "Indirizzo email inesatto.\n" ;
		swKO = 1 ;	
		} 

		// sezione campi obbligatori
		if (document.contatto.nome.value == "" ) {
			msg += "Manca il nome.\n" ;
			swKO = 1 ;
		}
		if (document.contatto.cognome.value == "" ) {
			msg += "Manca il cognome.\n" ;
			swKO = 1 ;
		}
	
		if (document.contatto.email.value == "" ) {
			msg += "Manca l\'email.\n" ;
			swKO = 1 ;
		} 

		 
		
		var the_box1 = document.contatto.acconsento1[1].checked;
		
		 
		if (the_box1 == true) {
			msg += "Devi accettare la clausola.\n" ;
			swKO = 1 ;
		}
		
		if (swKO == 1) {
			alert(msg);
			return false ;		
		}  
 
}

function riportalocalitaNascita(id_regione,id_provincia,id_comune,regione,provincia,comune) {
	
	window.opener.document.form.id_regione_nascita.value=id_regione;
	window.opener.document.form.id_provincia_nascita.value=id_provincia;
	window.opener.document.form.id_comune_nascita.value=id_comune;
	window.opener.document.form.regione_nascita.value=regione;
	window.opener.document.form.provincia_nascita.value=provincia;
	window.opener.document.form.comune_nascita.value=comune;

self.close();
}

function riportalocalitaResidenza(id_regione,id_provincia,id_comune,regione,provincia,comune) {
	
	window.opener.document.form.id_regione_residenza.value=id_regione;
	window.opener.document.form.id_provincia_residenza.value=id_provincia;
	window.opener.document.form.id_comune_residenza.value=id_comune;
	window.opener.document.form.regione_residenza.value=regione;
	window.opener.document.form.provincia_residenza.value=provincia;
	window.opener.document.form.comune_residenza.value=comune;

self.close();
}


/**
 * drag.js:
 *
 * Adapted from "JavaScript: The Definitive Guide, Fourth Edition".
 *
 * beginDrag() is designed to be called from an onmousedown event handler.
 * elementToDrag may be the element that received the mousedown event, or it
 * may be some containing element.  event must be the Event object for the
 * mousedown event.  This implementation works with both the DOM Level 2
 * event model and the IE Event model.
 **/
function beginDrag(elementToDrag, event) {
    // Compute the distance between the upper-left corner of the element
    // and the mouse click. The moveHandler function below needs these values.
    var deltaX = event.clientX - parseInt(elementToDrag.style.left);
    var deltaY = event.clientY - parseInt(elementToDrag.style.top);

    // Register the event handlers that will respond to the mousemove events
    // and the mouseup event that follow this mousedown event.  
    if (document.addEventListener) {  // DOM Level 2 Event Model
	// Register capturing event handlers
        document.addEventListener("mousemove", moveHandler, true);
	document.addEventListener("mouseup", upHandler, true);
    }
    else if (document.attachEvent) {  // IE 5+ Event Model
	// In the IE Event model, we can't capture events, so these handlers
	// are triggered when only if the event bubbles up to them.
	// This assumes that there aren't any intervening elements that
	// handle the events and stop them from bubbling.
	document.attachEvent("onmousemove", moveHandler);
	document.attachEvent("onmouseup", upHandler);
    }

    // We've handled this event.  Don't let anybody else see it.  
    if (event.stopPropagation) event.stopPropagation();   // DOM Level 2
    else event.cancelBubble = true;                       // IE

    // Now prevent any default action.
    if (event.preventDefault) event.preventDefault();     // DOM Level 2
    else event.returnValue = false;                       // IE

    /**
     * This is the handler that captures mousemove events when an element
     * is being dragged.  It is responsible for moving the element.
     **/
    function moveHandler(e) {
	if (!e) e = window.event;  // IE event model

        // Move the element to the current mouse position, adjusted as
	// necessary by the offset of the initial mouse click.
	elementToDrag.style.left = (e.clientX - deltaX) + "px";
	elementToDrag.style.top = (e.clientY - deltaY) + "px";

	// And don't let anyone else see this event.
	if (e.stopPropagation) e.stopPropagation();       // DOM Level 2
	else e.cancelBubble = true;                       // IE

        // Now prevent any default action.
        if (e.preventDefault) e.preventDefault();     // DOM Level 2
        else e.returnValue = false;                       // IE
    }

    /**
     * This is the handler that captures the final mouseup event that
     * occurs at the end of a drag.
     **/
    function upHandler(e) {
	if (!e) e = window.event;  // IE event model

	// Unregister the capturing event handlers.
	if (document.removeEventListener) {    // DOM Event Model
	    document.removeEventListener("mouseup", upHandler, true);
	    document.removeEventListener("mousemove", moveHandler, true);
	}
	else if (document.detachEvent) {       // IE 5+ Event Model
	    document.detachEvent("onmouseup", upHandler);
	    document.detachEvent("onmousemove", moveHandler);
	}

	// And don't let the event propagate any further.
	if (e.stopPropagation) e.stopPropagation();       // DOM Level 2
	else e.cancelBubble = true;                       // IE
    }
}


function videoShow(video) {
	
	var ajaxObj = new ClassAJAX() ;
	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement('videoplayer') ;
	
	ajaxObj.runAJAX ('./ajax/ajax.php?action=video&video='+video) ;
	
	var elem = document.getElementById('videoplayer') ;
	elem.style.display = 'inline' ;
	
	
	
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  
	l = (myWidth - 400) / 2 ;
	t = (myHeight - 450) / 2 ;
	
	elem.style.top = t ;
	elem.style.left = l ;
	 
	
}

function audioShow(audio) {
	
	var ajaxObj = new ClassAJAX() ;
	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement('audioplayer') ;
	
	ajaxObj.runAJAX ('./ajax/ajax.php?action=audio&audio='+audio) ;
	
	var elem = document.getElementById('audioplayer') ;
	elem.style.display = 'inline' ;
	
	
	
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  
	l = (myWidth - 400) / 2 ;
	t = (myHeight - 450) / 2 ;
	
	elem.style.top = t ;
	elem.style.left = l ;
	
}

function fotogalleryShow(id_fotogallery,fotogallery) {
	
	var ajaxObj = new ClassAJAX() ;
	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement('fotogalleryplayer') ;
	
	ajaxObj.runAJAX ('./ajax/ajax.php?action=fotogallery&fotogallery='+fotogallery+'&id_fotogallery='+id_fotogallery) ;
	
	var elem = document.getElementById('fotogalleryplayer') ;
	elem.style.display = 'inline' ;
	
	
	
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  
	l = (myWidth - 400) / 2 ;
	t = (myHeight - 450) / 2 ;
	
	elem.style.top = t ;
	elem.style.left = l ;
	
}

function subsettoreShow() {
	var id_settore = document.formazione_src.id_settore_src.options[document.formazione_src.id_settore_src.selectedIndex].value ;
	
	id_settoreArr = id_settore.split('_') ;
	
	var ajaxObj = new ClassAJAX() ;
	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement('subsettore') ;
	
	 
	// se il settore ha un solo figlio non ha senso aprire i subsettori
	if (id_settoreArr[1] > 1 ) {

		var url = "./ajax/ajax.php?action=subsettoreShow&id_settore="+id_settoreArr[0] ;
		ajaxObj.runAJAX (url) ;
		
	} else {
		var url = "./ajax/ajax.php?action=subsettoreHide" ;
		ajaxObj.runAJAX (url) ;			
	}
}


function cambiaFreccia(id_freccia) {
	
	var frecciaHi = "<img src=\"../img/dxSINGOLA3.jpg\" width=\"10\" height=\"10\" border=\"0\">" ;
	var freccia  = "<img src=\"../img/dxSINGOLA2.jpg\" width=\"10\" height=\"10\" border=\"0\">" ;
	
	 
	
	var num = document.getElementsByTagName('SPAN');
	
	
	// stuto tutto
	for (var i=0;i<num.length;i++) { 
	idx = num[i].id ;
	arr = idx.split("_") ;

		if (arr[0] == "freccia") {  
			id_temp = arr[0]+"_"+arr[1] ;
			eval("document.getElementById('"+id_temp+"').innerHTML = freccia") ;
		}
	}
	
	 // appiccio
	var ajaxObj = new ClassAJAX() ;
	ajaxObj.setExecute(true) ;	
	ajaxObj.setElement(id_freccia) ;
	
	ajaxObj.runAJAX ('./ajax/ajax.php?action=cambiaFreccia') ;
}

function toggleDisplayFormazione(id) {
	 
	id_formazione = 'formazione_'+id ; 
	 
	var num = document.getElementsByTagName('DIV');
	

	for (var i=0;i<num.length;i++) { 
		idx = num[i].id ;
		arr = idx.split("_") ;

		if (arr[0] == "formazione") {
		 
		
		id_temp = arr[0]+"_"+arr[1] ;
		 
		 	
			if (id_formazione == id_temp){		// siamo sulla riga giusta

				vis = eval ("document.getElementById('"+id_formazione+"').style.display") ; 
				 
				if (vis == 'inline') {	// e aperto e devo spegnere
				 	
				 	stutaColoreAndFrecce() ;
				 	
				} else {
					cambiaColoreTesto('titolo_'+id) ;
					cambiaFreccia('freccia_'+id) ;	
				}

				toggleDisplay(id_formazione) ;
				
			} else {
				chiudiDiv(id_temp) ;
			}
		 
		}
		 
	}
	 	
 	 
}




function cambiaColoreTesto(id){
	// stuto
	
	// prendo tutti i span
	var num = document.getElementsByTagName('SPAN');
		 
	// li ciclo tutti	
	for (var i=0;i<num.length;i++) { 
		
		//id corrente
		idx = num[i].id ;
		
		// splitto 
		arr = idx.split("_") ;
		 
		//xx+=arr[0]+"|"+arr[1] ;
	
		// se lo span e del tipo di quelli in oggetto ....		
		if (arr[0] == "titolo") { 	 	 
			eval ("document.getElementById('"+idx+"').className='biancoFormazione'") ; 
		}
		 
	}

	// appiccio
	eval ("document.getElementById('"+id+"').className='violaFormazione'") ;
 	
}

function stutaColoreAndFrecce() {
	// prendo tutti i span
	var num = document.getElementsByTagName('SPAN');
		 
	// li ciclo tutti	
	for (var i=0;i<num.length;i++) { 
		
		//id corrente
		idx = num[i].id ;
		
		// splitto 
		arr = idx.split("_") ;
		 
		//xx+=arr[0]+"|"+arr[1] ;
	
		// se lo span e del tipo di quelli in oggetto ....		
		if (arr[0] == "titolo") { 	 	 
			eval ("document.getElementById('"+idx+"').className='biancoFormazione'") ; 
		}
		 
	}

/* FRECCE */
var frecciaHi = "<img src=\"../img/dxSINGOLA3.jpg\" width=\"10\" height=\"10\" border=\"0\">" ;
	var freccia  = "<img src=\"../img/dxSINGOLA2.jpg\" width=\"10\" height=\"10\" border=\"0\">" ;
	
	 
	
	var num = document.getElementsByTagName('SPAN');
	
	
	// stuto tutto
	for (var i=0;i<num.length;i++) { 
	idx = num[i].id ;
	arr = idx.split("_") ;

		if (arr[0] == "freccia") {  
			id_temp = arr[0]+"_"+arr[1] ;
			eval("document.getElementById('"+id_temp+"').innerHTML = freccia") ;
		}
	}	
	
}


/************************************************************************************************************
	(C) www.dhtmlgoodies.com, September 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/
	function showToolTip(e,text){
		if(document.all)e = event;
		
		var obj = document.getElementById('bubble_tooltip');
		var obj2 = document.getElementById('bubble_tooltip_content');
		obj2.innerHTML = text;
		obj.style.display = 'block';
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
		var leftPos = e.clientX - 100;
		if(leftPos<0)leftPos = 0;
		obj.style.left = leftPos + 'px';
		obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
	}	
	
	function hideToolTip()
	{
		document.getElementById('bubble_tooltip').style.display = 'none';
		
	}
	
	/* TREE */
	
	function dettaglioNodo(e ,action) {
	
	var url = "" ;
	var fillUrl = false ;
	
	for (i=0; i < document.form.length; i++) {
		
		url += "&" + document.form[i].name + "=" + document.form[i].value ;
	}
	
	
	
	source = contextMenuSource;
	while(source.tagName.toLowerCase()!='li')source = source.parentNode;
	
	var idContext = source.getElementsByTagName('A')[0].id ;
	
	 //alert (idContext+"|"+action) ; 
		
		
		
	switch (action) {
		
		case "nuovoFratello" :	 
			location.href="?center=ctg&action=nuovo_fratello&etichetta=CATEGORIE&lev="+idContext ;
			/*var ajaxObj = new ClassAJAX() ;
			ajaxObj.setExecute(true) ;	
			ajaxObj.setElement('treeTable') ;
			ajaxObj.runAJAX ('./php/ajax.php?action=riportaProdottoLiv1&codiceProdotto='+idContextArr[0]+url) ;*/
			
		break ;
		
		case "nuovoFiglio" :
		
			if(idContext.length == 8) {
				location.href="?center=ctg&action=nuovo_figlio&etichetta=CATEGORIE&ctg_new_figlio="+idContext ;
			} else {
				alert('operazione non consentita.');	
			}
			 
		break ;
		
		case "modifica" :	 
			
			location.href="?center=ctg&action=edit&etichetta=CATEGORIE&cod_ctg="+idContext ;
			
			 
		break ;
		
		case "cancella" :
			var c = "" ;
			c = confirm ('ATTENZIONE\nCancellando questa categoria cancellerai tutte le categorie ad essa collegati\n\nSicuro ?');
			if(c){
				location.href="?center=ctg&action=delete&etichetta=CATEGORIE&cod_ctg="+idContext ;
			} else {
				return false ;	
			}
		break ;
	}
	
}


function addiCalEvent() {
	 
	
	var aula = document.form_ical.aula.options[document.form_ical.aula.selectedIndex].value ;
	var testo = document.form_ical.testo.value ;
	var data_in_ical = document.form_ical.data_in_ical.value ;
	var ora_start = document.form_ical.ora_start.options[document.form_ical.ora_start.selectedIndex].value ;
	var min_start = document.form_ical.min_start.options[document.form_ical.min_start.selectedIndex].value ;
	var data_out_ical = document.form_ical.data_out_ical.value ;
	var ora_stop = document.form_ical.ora_stop.options[document.form_ical.ora_stop.selectedIndex].value ;
	var min_stop = document.form_ical.min_stop.options[document.form_ical.min_stop.selectedIndex].value ;
					
	var url ="" ;
	url += "../manager/php/ajax.php?action=addiCalEvent" ;
	url += "&aula="+aula ;
	url += "&data_in_ical="+data_in_ical ;
	url += "&ora_start="+ora_start ;
	url += "&min_start="+min_start ;
	url += "&data_out_ical="+data_out_ical ;
	url += "&ora_stop="+ora_stop ;
	url += "&min_stop="+min_stop ;

	
	var ajaxObj = new ClassAJAX();
		ajaxObj.setExecute(false) ;
		ajaxObj.setReturn(true) ;
		ajaxObj.runAJAX (url) ;			

		var html = "" ;
		var htmlOld = "" ;

		myInterval = window.setInterval(
		function() { 
			htmlOld = html ;
			html = ajaxObj.getHtml() ;
			if (html != false) {
				
				if (htmlOld == html) { 
				
					window.clearInterval(myInterval);
									
					 top.ical.document.location.reload();
					
				var elem = document.getElementById('debug') ;	
				elem.style.display = "" ;
				elem.innerHTML = html ;
				}
			} 
		} 
		,1) ;
		
}


