function dissolvi(cosa)
{
		
		if (cosa.getStyle('opacity')=='1' || cosa.getStyle('opacity')<0.002)
		{
			cosa.setStyle('opacity',1); 
			var myTransition = new Fx.Transition(Fx.Transitions.Expo, 3);
			var fx2 = new Fx.Morph(cosa,{duration: 6000, transition: myTransition.easeInOut});
			fx2.start({'opacity': '0.001'});
		}

}


function openClose(nome)
{

		$(nome).setStyle('display','block');
		
                     
			                                                                                                       

		var c1Height = $(nome + 'Interno').getStyle('height');
		var n1Height = parseInt(c1Height.replace("px","")) + 56 + 52;	

		if($(nome).getStyle('height').toInt() > 0)
		{
			//hide
			closeLayer(nome)
			
			
		}
		else
		{
			openLayer(nome)
	

			
		}

}



function openLayer(nome)
{

		$(nome).setStyle('display','block');
		
                     
			                                                                                                       

		var c1Height = $(nome + 'Interno').getStyle('height');
		var n1Height = parseInt(c1Height.replace("px","")) + 56 + 52;	


			//show

			$('freccia_'+nome).src='img/frecciaarancio.gif'
			$('barra_'+nome).src='img/barraarancio.gif'
			$('label_'+nome).setStyle('color','#FF5300');
			var myTransition = new Fx.Transition(Fx.Transitions.Expo , 3);                                         
			var b1Toggle = new Fx.Morph($(nome),{duration: 2000, transition: myTransition.easeInOut});  
		  	b1Toggle.addEvent('onComplete',function(){
													

													
													});			
			
			
			b1Toggle.start({'height':n1Height});
	



}


function closeLayer(nome)
{

		$(nome).setStyle('display','block');
		
                     
			                                                                                                       

		var c1Height = $(nome + 'Interno').getStyle('height');
		var n1Height = parseInt(c1Height.replace("px","")) + 56 + 52;	


		//hide
		var myTransition = new Fx.Transition(Fx.Transitions.Expo , 3);                                         
		var b1Toggle = new Fx.Morph($(nome),{duration: 2000, transition: myTransition.easeInOut});  	
		b1Toggle.addEvent('onComplete',function(){
												
												$('freccia_'+nome).src='img/frecciablu.gif'
												$('barra_'+nome).src='img/barrablu.gif'
												$('label_'+nome).setStyle('color','#0759DD');
												
												});				
		b1Toggle.start({'height':0});
		
		

}


function setCatastaleLocalitaStato()
{
	if ($('NAZNASCITA').value.toUpperCase()!="ITALIA")
	{
		$('spanDummyNascita').setStyle('visibility','hidden');	
		$('DNLOCNASCLI').value = $('NAZNASCITA').value;
	}
	else
	{
		$('spanDummyNascita').setStyle('visibility','visible');	
		$('DNLOCNASCLI').value = $('dummyDNLOCNASCLI').value;
	}
}



function setCatastaleLocalitaStatoCoo()
{
	if ($('NAZNASCITACOO').value.toUpperCase()!="ITALIA")
	{
		$('spanDummyNascitaCOO').setStyle('visibility','hidden');	
		$('DNLOCNASCOO').value = $('NAZNASCITACOO').value;
	}
	else
	{
		$('spanDummyNascitaCOO').setStyle('visibility','visible');	
		$('DNLOCNASCOO').value = $('dummyDNLOCNASCOO').value;
	}
}


function setIndirizzoDatoreLavoro()
{
	valore =  $('DNINDSOCCLI').value; // + " " + $('dummyDNLOCSOCCLI').value + " " + $('customPRODATLAV').value;
	$('DNINDSOCCLI').value = valore.replace(defaultCombo,"");
}

function callDart(id)
{

			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			
			 var req = new Request.HTML({
				 method: 'get',
				 url: 'https://fls.doubleclick.net/activityi;src=1652414;type=newfo442;cat=' + id + ';ord=1;num='+ a + '?',
				 data: {},
				 onRequest: function() {},
				 onComplete: function(response) {}
			 }).send();
}


function facoltativoDataAssunzione()
{
	$('imgNMMESEATTCLI').set('src','img/null.gif');
	$('imgNMANNOATTCLI').set('src','img/null.gif');
}

function obbligatorioDataAssunzione()
{
	$('imgNMMESEATTCLI').set('src','img/req.gif');
	$('imgNMANNOATTCLI').set('src','img/req.gif');
}


function facoltativoRedditoMensilita()
{
	$('imgIMREDDCLI').set('src','img/null.gif');
	$('imgNMMENSCLI').set('src','img/null.gif');
	$('imgNMMESEATTCLI').set('src','img/null.gif');
	$('imgNMANNOATTCLI').set('src','img/null.gif');	
	
	
	
}


function obbligatorioRedditoMensilita()
{
	$('imgIMREDDCLI').set('src','img/req.gif');
	$('imgNMMENSCLI').set('src','img/req.gif');
	$('imgNMMESEATTCLI').set('src','img/req.gif');
	$('imgNMANNOATTCLI').set('src','img/req.gif');	
}


function fissaReddito()
{

	$('IMREDDCLI').value = "1";
	$('NMMENSCLI').value = "12";
	
	$('RMLAY').setStyle('visibility','hidden');
	$('NMLAY').setStyle('visibility','hidden');


}


function sbloccaReddito()
{

	$('RMLAY').setStyle('visibility','visible');
	$('NMLAY').setStyle('visibility','visible');
	
}


var cX = 0; var cY = 0; var rX = 0; var rY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX-10) + "px";
d.style.top = (cY+20) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}




var abiCabResponse = false;
function verificaAbiCab(abi,cab)
{

	if ((abi!="") && (cab!=""))
	{
		
		 var req = new Request.HTML({
		 method: 'get',
		 async: false,
		 url: 'abicab.asp',
		 data: { 'abi' : abi, 'cab' : cab },
		 onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
					if  (responseHTML=="true")
					{
						abiCabResponse = true;
					}
					else
					{
						abiCabResponse = false;
					}
			 
			 }
	 }).send();
	
	}
	else
	if (abi!="")
	{
		
		 var req = new Request.HTML({
		 method: 'get',
		 async: false,
		 url: 'abi.asp',
		 data: { 'abi' : abi },
		 onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
					if  (responseHTML=="true")
					{
						abiCabResponse = true;
					}
					else
					{
						abiCabResponse = false;
					}
			 
			 }
	 }).send();
	
	}
	else
	if (cab!="")
	{
		
		 var req = new Request.HTML({
		 method: 'get',
		 async: false,
		 url: 'cab.asp',
		 data: { 'cab' : cab },
		 onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
					if  (responseHTML=="true")
					{
						abiCabResponse = true;
					}
					else
					{
						abiCabResponse = false;
					}
			 
			 }
	 }).send();
	
	}	
return abiCabResponse;
	
	



}




function gestisciData(obj)
{
	valore = obj.get('value');
																
	valore = valore.replace("/","");
	valore=valore.substring(0,9);
	
	
	
	if (valore.length<=1)
	{
	// nulla..
	}
	else if (valore.length<=4)
	{
	valore = valore.substring(0,2) + "/" + valore.substring(2);	
	}
	else
	{
	valore = valore.substring(0,2) + "/" + valore.substring(2,4) + "/" + valore.substring(4);
	}
																
	
	
	valore = valore.replace("//","/");
	obj.set('value',valore);
	
}




function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

