function addSection(obj){
	if (!document.getElementById(obj).style.display || document.getElementById(obj).style.display == "none"){
		document.getElementById(obj).style.display = "block";
	}
}

function callBack(){}

function checkDate(anno,mese,giorno) {
  	var today = new Date();
  	anno = ((!anno) ? today.getYear():anno);
  	mese = ((!mese) ? today.getMonth():mese-1);
  	var data = new Date(anno,mese,giorno);
  	if(data.getYear()<1900){
  		data_anno=data.getYear()+1900
  	}else{
  		data_anno=data.getYear();
  	}
  	if(!((data_anno==anno)&&(mese==data.getMonth()) && (giorno==data.getDate()))) {
    	return false;
  	}else{
		return true;
	}
}

function checkInteger(field,name){
 	if(field.value==""){
    	alert("Il campo '"+name+"' non può essere vuoto");
    	field.value=field.defaultValue;
 	}else if(isNaN(field.value)){
 		alert("Il campo '"+name+"' deve essere numerico");
 		field.value=field.defaultValue;
 	}
 	return true;
}
function checkNumber(field,name){
 	if(isNaN(field.value)){
 		alert("Il campo '"+name+"' deve essere numerico");
 		field.value="";
 	}
 	return true;
}

function checkLogin(f){
	if(f.user.value==""){
  		alert("Manca il nome utente");
  		return false;
 	} 
 	if(f.pwd.value==""){
  		alert("Manca la password");
  		return false;
 	} 
	return true;
}

function checkMail(mail,lingua){
	var emailStr=mail
  	var emailPat=/^(.+)@(.+)$/
  	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
  	var validChars="\[^\\s" + specialChars + "\]"
  	var quotedUser="(\"[^\"]*\")"
  	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
  	var atom=validChars + '+'
  	var word="(" + atom + "|" + quotedUser + ")"
  	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
  	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
  	var matchArray=emailStr.match(emailPat)
  	if(matchArray==null) {
    	switch(lingua){
	   		case "ita":
	     		alert("Indirizzo e-mail non valido");
	     		break;
	   		case "eng":
	     		alert("E-mail address not valid");
	     		break;
	   		default:
	     		alert("Indirizzo e-mail non valido");
		}//fine switch
	 	return false
  	}
  	var user=matchArray[1]
  	var domain=matchArray[2]
  	if(user.match(userPat)==null) {
		switch(lingua){
	   		case "ita":
	     		alert("Indirizzo e-mail non valido");
	     		break;
	   		case "eng":
	     		alert("E-mail address not valid");
	    		break;
	   		default:
	     		alert("Indirizzo e-mail non valido");
		}//fine switch
		return false
  	}
  	var IPArray=domain.match(ipDomainPat)
  	if(IPArray!=null) {
		for(var i=1;i<=4;i++) {
			if(IPArray[i]>255) {
		 		switch(lingua){
	            	case "ita":
		          		alert("Indirizzo e-mail non valido");
		          		break;
	            	case "eng":
		          		alert("E-mail address not valid");
		          		break;
					default:
		          		alert("Indirizzo e-mail non valido");
	          	}//fine switch
		      	return false
	    	}
	 	}
	 	return true
   	}
   	var domainArray=domain.match(domainPat)
   	if(domainArray==null) {
	   	switch(lingua){
	     	case "ita":
	       		alert("Indirizzo e-mail non valido");
		   		break;
	     	case "eng":
		   		alert("E-mail address not valid");
		   		break;
		 	default:
		   		alert("Indirizzo e-mail non valido");
	     	}//fine switch
		 	return false
   	}
   	var atomPat=new RegExp(atom,"g")
   	var domArr=domain.match(atomPat)
   	var len=domArr.length
   	if(domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3){
		switch(lingua){
	    	case "ita":
	       		alert("Indirizzo e-mail non valido");
		   		break;
	     	case "eng":
		   		alert("E-mail address not valid");
		   		break;
		 	default:
		   		alert("Indirizzo e-mail non valido");
	   	}//fine switch
	   	return false
	}
	if(len<2) {
	    switch(lingua){
	    	case "ita":
		    	alert("Indirizzo e-mail non valido");
		     	break;
	        case "eng":
		      	alert("E-mail address not valid");
		      	break;
			default:
		      	alert("Indirizzo e-mail non valido");
	    }//fine switch
		return false
	}
	return true
}

function checkOrder(field){
 	if(field.value==""){
    	alert("Il campo ordine non può essere vuoto");
    	field.value=field.defaultValue;
 	}else if(isNaN(field.value)){
 		alert("L\'ordine deve essere numerico");
 		field.value=field.defaultValue;
 	}
 	return true;
}

function checkStep1(f){
	if(f.Nome.value==""){
		alert("Manca il Nome");
	  	return false;
	}
	if(f.Cognome.value==""){
		alert("Manca il Cognome");
	  	return false;
	}
	if(!checkDate(f.aNascita.value,f.mNascita.value,f.gNascita.value)){
		alert("La Data di nascita non è valida");
	  	return false
	}
	var cf=f.cd_Fiscale.value;
	if(cf==""){
		alert("Manca il Codice Fiscale");
		return false;
	}else if(!codiceFiscale(cf)){
		alert("Codice Fiscale errato");
      	return false;
	}
	if(f.Nascita_Nazione[1].checked){
		//stato estero
		if(f.idStato.selectedIndex==0){
			alert("Manca lo Stato di nascita");
			return false;
		}
	}else{
		//italiano
		if(f.provNascita.selectedIndex==0){
			alert("Manca la Provincia di nascita");
			return false;
		}
		if(f.provNascita.selectedIndex==1){
			alert("Provincia di Nascita incompatibile con la nazionalità");
			return false;
		}
		if(f.comuneNascita.selectedIndex==0){
			alert("Manca il Luogo di nascita");
			return false;
		}
	}
	if(f.statoCivile.value==""){
		alert("Manca lo Stato Civile");
	  	return false;
	}
	if(f.ResIndirizzo.value==""){
		alert("Manca l\'indirizzo di residenza");
	  	return false;
	}
	if(f.ResNazione[0].checked){
		//italiano
		if(f.ResProvincia.selectedIndex==0){
			alert("Manca la Provincia di Residenza");
			return false;
		}
		if(f.ResProvincia.selectedIndex==1){
			alert("Provincia di Residenza incompatibile con la nazionalità");
			return false;
		}
		if(f.ResComune.selectedIndex==0){
			alert("Manca il Comune di residenza");
			return false;
		}
	}
	if(f.ResCAP.value==""){
		alert("Manca il CAP della Residenza");
	  	return false;
	}
	if(f.DomEqualRes[1].checked){
		//il domicilio è diverso dalla residenza
		if(f.DomIndirizzo.value==""){
			alert("Manca l\'indirizzo del domicilio");
	  		return false;
		}
		if(f.DomNazione[0].checked){
			//italiano
			if(f.DomProvincia.selectedIndex==0){
				alert("Manca la Provincia di Domicilio");
				return false;
			}
			if(f.DomProvincia.selectedIndex==1){
				alert("Provincia di Domicilio incompatibile con la nazionalità");
				return false;
			}
			if(f.DomComune.selectedIndex==0){
				alert("Manca il Comune di Domicilio");
				return false;
			}
		}
		if(f.DomCAP.value==""){
			alert("Manca il CAP del Domicilio");
	  		return false;
		}
	}
	if(f.Tel.value==""){
		alert("Manca il Telefono/Cellulare");
	  	return false;
	}
	if(f.mail.value==""){
	  	alert("Manca l\'indirizzo E-mail");
	  	return false 
    }else {
	  	if(!checkMail(f.mail.value,'ita')){
	     	return false;
	  	}
    }
	return true;
}//fine checkStep1

function checkStep2(f){
	if(f.nomeTitolo1.selectedIndex==0){
		alert("Manca il Titolo di studio");
		return false;
	}
	if(!checkDate(f.aTitolo1.value,f.mTitolo1.value,1)){
		alert("La Data del primo titolo di studio non è valida");
	  	return false
	}
	if( (f.descTitolo2.value!='') || (f.votoTitolo2.value!='') || (f.istitutoTitolo2.value!='') || (f.localitaTitolo2.value!='') || 
	    (f.noteTitolo2.value!='') ){
		if(f.nomeTitolo2.selectedIndex==0){
			alert("Secondo Titolo di studio non selezionato");
			return false;
		}
		if(!checkDate(f.aTitolo2.value,f.mTitolo2.value,1)){
			alert("La Data del secondo titolo di studio non è valida");
	  		return false;
		}
	}
	if( (f.descTitolo3.value!='') || (f.votoTitolo3.value!='') || (f.istitutoTitolo3.value!='') || (f.localitaTitolo3.value!='') || 
	    (f.noteTitolo3.value!='') ){
		if(f.nomeTitolo3.selectedIndex==0){
			alert("Terzo Titolo di studio non selezionato");
			return false;
		}
		if(!checkDate(f.aTitolo3.value,f.mTitolo3.value,1)){
			alert("La Data del secondo titolo di studio non è valida");
	  		return false
		}
	}
	for(var i=1;i<=4;i++){
		if( (f.elements['lingua'+i].selectedIndex!=0) && (f.elements['livello'+i].selectedIndex==0) ){
			alert("Deve selezionare il livello di conoscenza dalla "+i+"° lingua estera");
			return false;
		}
	}
	return true;
}//fine checkStep2

function checkStep3(f){
	for(var i=1;i<=4;i++){
		if( (f.elements['descCorso'+i].value!='') || (f.elements['enteCorso'+i].value!='') || (f.elements['sedeCorso'+i].value!='') ||
		    (f.elements['durataCorso'+i].value!='') || (f.elements['timeCorso'+i].selectedIndex!=0) || (f.elements['noteCorso'+i].value!='') ){
			if(f.elements['titoloCorso'+i].value==''){
				alert("Deve specificare il "+i+"° titolo conseguito");
				return false;
			}
			if((f.elements['durataCorso'+i].value!='') && (f.elements['timeCorso'+i].selectedIndex==0)){
				alert("La durata del "+i+"° corso non è valida");
	  			return false
			}
			if(f.elements['aCorso'+i].value!='aaaa'){
				if(!checkDate(f.elements['aCorso'+i].value,f.elements['mCorso'+i].value,f.elements['gCorso'+i].value)){
					alert("La data del "+i+"° corso non è valida");
	  				return false
				}
			}
		}
	}
	return true;
}//fine checkStep3

function checkStep4(f){
	for(var i=1;i<=7;i++){
		if( (f.elements['azienda'+i].value!='') || (f.elements['settore'+i].selectedIndex>0) ||
		    (f.elements['divisione'+i].value!='') || (f.elements['ruolo'+i].value!='') ||
			(f.elements['descRuolo'+i].value!='') || (f.elements['qualifica'+i].selectedIndex>0) ||
			(f.elements['tipoRapporto'+i].selectedIndex>0) || (f.elements['tipoContratto'+i].selectedIndex>0) ||
			(f.elements['retribuzione'+i].value!='') || (f.elements['premi'+i].value!='') || 
			(f.elements['benefit'+i].value!='') || (f.elements['inquadramento'+i].value!='') ||
			(f.elements['descAttivita'+i].value!='') || (f.elements['motivoCambiamento'+i].value!='') ){
			
			if(!checkDate(f.elements['aInizio'+i].value,f.elements['mInizio'+i].value,f.elements['gInizio'+i].value)){
				if(i==1){
					alert("La data di inizio impiego attuale non è valida");
				}else{
					alert("La data di inizio "+(i-1)+"° impiego precedente non è valida");
				}
	  			return false
			}
			if(f.elements['aFine'+i].value!='aaaa'){
				if(!checkDate(f.elements['aFine'+i].value,f.elements['mFine'+i].value,f.elements['gFine'+i].value)){
					if(i==1){
						alert("La data di fine impiego attuale non è valida");
					}else{
						alert("La data di fine "+(i-1)+"° impiego precedente non è valida");
					}
	  				return false
				}
			}
			zona=f.elements['zona'+i];
			if(zona[1].checked){
				//stato estero
				if(f.elements['idStato'+i].selectedIndex==0){
					if(i==1){
						alert("Manca lo Stato Estero dell'impiego attuale");
					}else{
						alert("Manca lo Stato Estero del "+(i-1)+"° impiego precedente");
					}
					return false;
				}
			}else{
				//italiano
				if(f.elements['prov'+i].selectedIndex==0){
					if(i==1){
						alert("Manca la provincia dell'impiego attuale");
					}else{
						alert("Manca la provincia del "+(i-1)+"° impiego precedente");
					}
					return false;
				}
				if(f.elements['prov'+i].selectedIndex==1){
					if(i==1){
						alert("La provincia dell'impiego attuale è incompatibile con la zona");
					}else{
						alert("La provincia del "+(i-1)+"° impiego precedente è incompatibile con la zona");
					}
					return false;
				}
			}
		}
	}
	return true;
}//fine checkStep4

function checkStep5(f){
	if(f.interesse.selectedIndex==0){
		alert("Manca l\'Area di interesse primaria");
	  	return false;
	}
	if(f.curriculum.value!=''){
		var fileAllowedExts= new Array("doc","pdf","DOC","PDF");
		var nomefile = f.curriculum.value;
		estensione = nomefile.substr(nomefile.lastIndexOf(".")+1);
		if(fileAllowedExts.join().indexOf(estensione)==-1){
			alert("Il curriculum è in un formato non consentito");
  			return false;
		}
	}
	if(f.privacy[1].checked){
		alert("Per procedere deve autorizzare il trattamento dei dati");
	  	return false  
	}
	return true;
}

function comboStatus(field,value){
	 switch (field){
	 	case "Nascita_Nazione":
			if(value=="I"){
				document.step1.idStato.disabled=true;
				document.step1.idStato.selectedIndex=0;
				document.step1.provNascita.selectedIndex=0;
				getComuneNascita();
				document.step1.comuneNascita.disabled=false;
				document.step1.provNascita.disabled=false;
			}else{
				document.step1.idStato.disabled=false;
				document.step1.provNascita.disabled=true;
				document.step1.provNascita.selectedIndex=1;
				document.step1.comuneNascita.disabled=true;
				document.step1.comuneNascita.selectedIndex=0;
			}
			break;
		case "ResNazione":
			if(value=="I"){
				document.step1.ResProvincia.selectedIndex=0;
				getComuneResidenza();
				document.step1.ResComune.disabled=false;
				document.step1.ResProvincia.disabled=false;
			}else{
				document.step1.ResProvincia.disabled=true;
				document.step1.ResProvincia.selectedIndex=1;
				document.step1.ResComune.disabled=true;
				document.step1.ResComune.selectedIndex=0;
			}
			break;
		case "DomNazione":
			if(value=="I"){
				document.step1.DomProvincia.selectedIndex=0;
				getComuneResidenza();
				document.step1.DomComune.disabled=false;
				document.step1.DomProvincia.disabled=false;
			}else{
				document.step1.DomProvincia.disabled=true;
				document.step1.DomProvincia.selectedIndex=1;
				document.step1.DomComune.disabled=true;
				document.step1.DomComune.selectedIndex=0;
			}
			break;
		case "zona1":
			if(value=="I"){
				document.step4.idStato1.disabled=true;
				document.step4.idStato1.selectedIndex=0;
				document.step4.prov1.selectedIndex=0;
				document.step4.prov1.disabled=false;
			}else{
				document.step4.idStato1.disabled=false;
				document.step4.prov1.disabled=true;
				document.step4.prov1.selectedIndex=1;
			}
			break;
		case "zona2":
			if(value=="I"){
				document.step4.idStato2.disabled=true;
				document.step4.idStato2.selectedIndex=0;
				document.step4.prov2.selectedIndex=0;
				document.step4.prov2.disabled=false;
			}else{
				document.step4.idStato2.disabled=false;
				document.step4.prov2.disabled=true;
				document.step4.prov2.selectedIndex=1;
			}
			break;
		case "zona3":
			if(value=="I"){
				document.step4.idStato3.disabled=true;
				document.step4.idStato3.selectedIndex=0;
				document.step4.prov3.selectedIndex=0;
				document.step4.prov3.disabled=false;
			}else{
				document.step4.idStato3.disabled=false;
				document.step4.prov3.disabled=true;
				document.step4.prov3.selectedIndex=1;
			}
			break;
		case "zona4":
			if(value=="I"){
				document.step4.idStato4.disabled=true;
				document.step4.idStato4.selectedIndex=0;
				document.step4.prov4.selectedIndex=0;
				document.step4.prov4.disabled=false;
			}else{
				document.step4.idStato4.disabled=false;
				document.step4.prov4.disabled=true;
				document.step4.prov4.selectedIndex=1;
			}
			break;
		case "zona5":
			if(value=="I"){
				document.step4.idStato5.disabled=true;
				document.step4.idStato5.selectedIndex=0;
				document.step4.prov5.selectedIndex=0;
				document.step4.prov5.disabled=false;
			}else{
				document.step4.idStato5.disabled=false;
				document.step4.prov5.disabled=true;
				document.step4.prov5.selectedIndex=1;
			}
			break;
		case "zona6":
			if(value=="I"){
				document.step4.idStato6.disabled=true;
				document.step4.idStato6.selectedIndex=0;
				document.step4.prov6.selectedIndex=0;
				document.step4.prov6.disabled=false;
			}else{
				document.step4.idStato6.disabled=false;
				document.step4.prov6.disabled=true;
				document.step4.prov6.selectedIndex=1;
			}
			break;
		case "zona7":
			if(value=="I"){
				document.step4.idStato7.disabled=true;
				document.step4.idStato7.selectedIndex=0;
				document.step4.prov7.selectedIndex=0;
				document.step4.prov7.disabled=false;
			}else{
				document.step4.idStato7.disabled=false;
				document.step4.prov7.disabled=true;
				document.step4.prov7.selectedIndex=1;
			}
			break;
	}
}//fine comboSatus()

function codiceFiscale(cfins){
	var cf = cfins.toUpperCase();
	var cfReg = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/;
	if (!cfReg.test(cf))return false;
	var set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
	var s = 0;
	for( i = 1; i <= 13; i += 2 )
		s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	for( i = 0; i <= 14; i += 2 )
		s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	if ( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )return false;
	return true;
}//fine codiceFiscale

function credits(url,width,height){
	var cntx = 500
	var cnty = 350
	var aa = window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
}

function displayDiv(field,value,obj){
	switch (field){
	 	case "DomEqualRes":
			if(value=="No"){
				if (!document.getElementById(obj).style.display || document.getElementById(obj).style.display == "none"){
					document.getElementById(obj).style.display = "block";
				}
			}else{
				document.getElementById(obj).style.display = "none";
			}
			break;
	}
}

function getComuneDomicilio(){
	provincia=document.forms[0].DomProvincia.options[document.forms[0].DomProvincia.selectedIndex].value;
	jsrsExecute("procedure/getComuneDomicilio.php",listComuneDomicilio,"getComune",provincia);
}
function getComuneNascita(){
	provincia=document.forms[0].provNascita.options[document.forms[0].provNascita.selectedIndex].value;
	jsrsExecute("procedure/getComuneNascita.php",listComuneNascita,"getComune",provincia);
}
function getComuneResidenza(){
	provincia=document.forms[0].ResProvincia.options[document.forms[0].ResProvincia.selectedIndex].value;
	jsrsExecute("procedure/getComuneResidenza.php",listComuneResidenza,"getComune",provincia);
}
function listComuneDomicilio(comune){
	jsrsExecute("foo.php",callBack,"blankFunc");
	document.forms[0].DomComune.options.length=0;
	document.forms[0].DomComune.options[0]=new Option("-- Selezionare il comune --","");
	options=comune.split("|");
	for(var i=1;i<options.length;i++){
		if(options[i]!=""){
			nameValue=options[i].split("~");
			document.forms[0].DomComune.options[i]=new Option(nameValue[0],nameValue[1]);
		}
	}
}
function listComuneNascita(comune){
	jsrsExecute("foo.php",callBack,"blankFunc");
	document.forms[0].comuneNascita.options.length=0;
	document.forms[0].comuneNascita.options[0]=new Option("-- Selezionare il comune --","");
	options=comune.split("|");
	for(var i=1;i<options.length;i++){
		if(options[i]!=""){
			nameValue=options[i].split("~");
			document.forms[0].comuneNascita.options[i]=new Option(nameValue[0],nameValue[1]);
		}
	}
}
function listComuneResidenza(comune){
	jsrsExecute("foo.php",callBack,"blankFunc");
	document.forms[0].ResComune.options.length=0;
	document.forms[0].ResComune.options[0]=new Option("-- Selezionare il comune --","");
	options=comune.split("|");
	for(var i=1;i<options.length;i++){
		if(options[i]!=""){
			nameValue=options[i].split("~");
			document.forms[0].ResComune.options[i]=new Option(nameValue[0],nameValue[1]);
		}
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function newPwd(f){
	if(f.mail.value==""){
	  	alert("Manca l\'indirizzo E-mail");
	  	return false 
    }else if(!checkMail(f.mail.value,'ita')){
	     return false;
    }else{
		return true;
	}
}

function popForm(f,name,width,height){
	f.target=name;
	if (document.all){
    	var x = window.screenLeft;
      	var y = window.screenTop;
      	var w = window.document.body.offsetWidth;
      	var h = window.document.body.offsetHeight;
 	} else {
   		var x = window.screenX;
   		var y = window.screenY;
   		var w = window.outerWidth;
   		var h = window.outerHeight;
 	}
 	var cntx = x + Math.round((w - width) / 2);
 	var cnty = y + Math.round((h - height) / 2);
 	var aa = window.open ('', name, 'resizable=yes,scrollbars=yes,left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
}

function popScroll(url,name,width,height){
 	var cntx = 350
 	var cnty = 150
 	var pop = window.open (url, name, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height + ',scrollbars=yes');
 	pop.focus();
}

function popUp(url,name,width,height){
 	if (document.all){
    	var x = window.screenLeft;
      	var y = window.screenTop;
      	var w = window.document.body.offsetWidth;
      	var h = window.document.body.offsetHeight;
 	} else {
   		var x = window.screenX;
   		var y = window.screenY;
   		var w = window.outerWidth;
   		var h = window.outerHeight;
 	}
 	var cntx = x + Math.round((w - width) / 2);
 	var cnty = y + Math.round((h - height) / 2);
 	var aa = window.open (url, name, 'resizable=yes,scrollbars=no,left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
}

function removeSection(obj){
	document.getElementById(obj).style.display = "none";
}

function resettaCorso(i){
	titolo=document.forms[0].elements['titoloCorso'+i];
	titolo.value='';
	desc=document.forms[0].elements['descCorso'+i];
	desc.value='';
	ente=document.forms[0].elements['enteCorso'+i];
	ente.value='';
	sede=document.forms[0].elements['sedeCorso'+i];
	sede.value='';
	durata=document.forms[0].elements['durataCorso'+i];
	durata.value='';
	time=document.forms[0].elements['timeCorso'+i];
	time.selectedIndex=0;
	giorno=document.forms[0].elements['gCorso'+i];
	giorno.selectedIndex=0;
	mese=document.forms[0].elements['mCorso'+i];
	mese.selectedIndex=0;
	anno=document.forms[0].elements['aCorso'+i];
	anno.value='aaaa';
	note=document.forms[0].elements['noteCorso'+i];
	note.value='';
}


function resettaTitolo(i){
	titolo=document.forms[0].elements['nomeTitolo'+i];
	titolo.selectedIndex=0;
	desc=document.forms[0].elements['descTitolo'+i];
	desc.value='';
	mese=document.forms[0].elements['mTitolo'+i];
	mese.selectedIndex=0;
	anno=document.forms[0].elements['aTitolo'+i];
	anno.value='aaaa';
	voto=document.forms[0].elements['votoTitolo'+i];
	voto.value='';
	istituto=document.forms[0].elements['istitutoTitolo'+i];
	istituto.value='';
	localita=document.forms[0].elements['localitaTitolo'+i];
	localita.value='';
	note=document.forms[0].elements['noteTitolo'+i];
	note.value='';
}

function resettaImpiego(i){
	gInizio=document.forms[0].elements['gInizio'+i];
	gInizio.selectedIndex=0;
	mInizio=document.forms[0].elements['mInizio'+i];
	mInizio.selectedIndex=0;
	aInizio=document.forms[0].elements['aInizio'+i];
	aInizio.value='aaaa';
	gFine=document.forms[0].elements['gFine'+i];
	gFine.selectedIndex=0;
	mFine=document.forms[0].elements['mFine'+i];
	mFine.selectedIndex=0;
	aFine=document.forms[0].elements['aFine'+i];
	aFine.value='aaaa';
	azienda=document.forms[0].elements['azienda'+i];
	azienda.value='';
	settore=document.forms[0].elements['settore'+i];
	settore.selectedIndex=0;
	divisione=document.forms[0].elements['divisione'+i];
	divisione.value='';
	ruolo=document.forms[0].elements['ruolo'+i];
	ruolo.value='';
	descRuolo=document.forms[0].elements['descRuolo'+i];
	descRuolo.value='';
	qualifica=document.forms[0].elements['qualifica'+i];
	qualifica.selectedIndex=0;
	tipoRapporto=document.forms[0].elements['tipoRapporto'+i];
	tipoRapporto.selectedIndex=0;
	tipoContratto=document.forms[0].elements['tipoContratto'+i];
	tipoContratto.selectedIndex=0;
	retribuzione=document.forms[0].elements['retribuzione'+i];
	retribuzione.value='';
	premi=document.forms[0].elements['premi'+i];
	premi.value='';
	auto=document.forms[0].elements['auto'+i];
	for(var j=0;j<auto.length;j++){
		auto[j].checked=false;
	}
	benefit=document.forms[0].elements['benefit'+i];
	benefit.value='';
	zona=document.forms[0].elements['zona'+i];
	for(var j=0;j<zona.length;j++){
		if(j==0){
			zona[j].checked=true;
		}else{
			zona[j].checked=false;
		}
	}
	idStato=document.forms[0].elements['idStato'+i];
	idStato.selectedIndex=0;
	prov=document.forms[0].elements['prov'+i];
	prov.selectedIndex=0;
	inquadramento=document.forms[0].elements['inquadramento'+i];
	inquadramento.value='';
	descAttivita=document.forms[0].elements['descAttivita'+i];
	descAttivita.value='';
	motivoCambiamento=document.forms[0].elements['motivoCambiamento'+i];
	motivoCambiamento.value='';
	note=document.forms[0].elements['note'+i];
	note.value='';
	
}