/* Elenco delle funzioni
	- OpenCloseNews
	- OpenClosePopUp
	- PrintContent
	- ChangeBgImageOrColor
	- SaveCookies
	- FindOnlyCookies
	- FindCookies
	- CreateTimer
	- moveItem
	- CreateDragObject
	- Collapse
	- OpenCloseId
	- OpenCloseClass
	- OpenCloseEffect
	- FocusId
	- moveTo
	- IsPresent
	- RefreshTicker
	- CurrentTime
	- MovePrimoPiano
	- MoveMorph
	- CheckSearchValue
	- ChangeFontStyle
	- CreateToolTip
	- ChangeBackGround
	- OpenAllWindow
	- FilterClass
	- ViewAllComment
	- ChangeStyleClass
	- ChangeContentValue

*/

<!-- Begin
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + $('Container').scrollLeft;
tempY = event.clientY + $('Container').scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY + $('Container').scrollTop;
} 
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
//document.Show.MouseX.value = tempX;
//document.Show.MouseY.value = tempY;
return true;
}
//  End -->

/* Questa funzione consente di aprire una sezione sovrapposta dell' articolo con effetto sfumato */	
	function OpenCloseNews (pIdBackGround,pId,pIdPosition,pOpenCloseType){
	  var pPosition = $('Container').scrollTop;
	  if( pOpenCloseType == 'O' ){
	    var DimW = document.body.scrollWidth + 'px';
	    //$('Container').setStyle({width:'100%'});
	    $(pIdBackGround).setStyle({width:DimW});
	    $(pIdBackGround).style.height = $('Container').scrollHeight + 8000;
	    $(pIdBackGround).style.display='block';
	
		  $(pIdBackGround).style.opacity = 9/10;
			$(pIdBackGround).style.filter = 'alpha(opacity=' + 9*10 + ')';

			if( pId != 'Box_Articolo' )
			  pPosition = parseInt( pPosition + ( document.body.scrollHeight / 4 ) );

	  	//$(pId).setStyle({top:pPosition + 'px'});

	    $(pId).style.display='block';

	    //$(pId).style.height=document.body.offsetHeight - 20;
	   
	    //$(pId).innerHTML='<center><img src=\'./images/Loading.gif\' border=\'0\'></center>';
	    //Effect.ScrollTo(pId, {duration: 1.0});
	    //$('Container').style.overflow='hidden';
	    $('track2').setStyle({display:'none'});
	  } else if( pOpenCloseType == 'C' ){
	    if( $('MultimediaPrimoPiano') ){
	    	$('MultimediaPrimoPiano').innerHTML='';
	    	$('MultimediaPrimoPiano').style.display='none';
	    }
	    /*
		    Effect.multiple([pIdBackGround, pId, MultimediaPrimoPiano], Effect.Fade, {afterFinish:function(){$('Container').style.overflow='auto';}});
	    else
		    Effect.multiple([pIdBackGround, pId], Effect.Fade, {afterFinish:function(){$('Container').setStyle({overflow:'auto'});}});
	    */
	    //$('Container').style.overflow='none';
	    $('track2').setStyle({display:'block'});
	    $(pIdBackGround).setStyle({display:'none'});
	    Effect.Fade(pId);
	    
	  }
	}

/* Quasta funzione consente di aprie una finestra di popup in funcione della posizione del Mouse */
	function OpenClosePopUp (pId,pOpenCloseType){
	  if( pOpenCloseType == 'O' ){
	  	$(pId).setStyle({top:(tempY-100) + 'px', left:tempX + 'px'});
	    $(pId).style.display='block';
	  } else if( pOpenCloseType == 'C' ){
	    $(pId).style.display='none';
	  }
	    
	}

/* Stampa il contenuto di una sezione */
	function PrintContent(pId, pLogo){
	    pArticolo=document.getElementById(pId).innerHTML;
	    newwin=window.open('','printwin','left=100,top=100,width=900,height=3000')
	    newwin.document.write('<HTML>\n<HEAD>\n')
	    newwin.document.write('<TITLE>Print Page</TITLE>\n')
	    newwin.document.write('<script>\n')
	    newwin.document.write('function chkstate(){\n')
	    newwin.document.write('if(document.readyState=="complete"){\n')
	    newwin.document.write('window.close()\n')
	    newwin.document.write('}\n')
	    newwin.document.write('else{\n')
	    newwin.document.write('setTimeout("chkstate()",2000)\n')
	    newwin.document.write('}\n')
	    newwin.document.write('}\n')
	    newwin.document.write('function print_win(){\n')
	    newwin.document.write('window.print();\n')
	    newwin.document.write('chkstate();\n')
	    newwin.document.write('}\n')
	    newwin.document.write('<\/script>\n')
	    newwin.document.write('</HEAD>\n')
	    newwin.document.write('<BODY onload="print_win()">\n')
	    newwin.document.write('<center>\n')
	    newwin.document.write("<img src='images/Loghi/" + pLogo + "'/>\n")
	    newwin.document.write('</center>\n')
	    newwin.document.write(pArticolo)
	    newwin.document.write('</BODY>\n')
	    newwin.document.write('</HTML>\n')
	    newwin.document.close()
	}


	/* Cambia il colore di sfondo di tutto il contesto */
	function ChangeBgImageOrColor (pValue){
					var IsImage = pValue.search(/\./i);
	        if( IsImage != -1 ){
	          $('WappsBody').style.backgroundColor = "";
	          $('WappsBody').style.backgroundImage = "url(./images/BackGrounds/" + pValue + ")";
	        } else {
	          $('WappsBody').style.backgroundImage = "";
	          $('WappsBody').style.backgroundColor = pValue;
	        }
	};


	/* Salva i Cookie delle HomePage */
	function SaveCookies(pParam, pValue, pWebSite, pSection){
	    var pBG     = $('WappsBody').getStyle('backgroundImage');
			var IsImage = pBG.search(/\./i);

			if( IsImage == -1 )
				pBG = $('WappsBody').getStyle('backgroundColor');
			var BG = new Cookies();

			BG.set('HomePage_BackGround' + pWebSite + pSection, pBG);

			if( pParam == 'Box' || pParam == 'BoxBlock' ){
				var Display  = new Cookies();
				for(i=0;i<pValue;i++){
		 			BoxNumber = i + 1;
		 			pBoxBlock=$(pParam + '_' + BoxNumber);
		 			if( pBoxBlock ){
						pDisplay  = $(pParam + '_' + BoxNumber).getStyle('display');
						if( pDisplay != null )
						  Display.set('HomePage_Show' + pParam + '_' + BoxNumber + pWebSite + pSection, pDisplay);
						else  
						  Display.set('HomePage_Show' + pParam + '_' + BoxNumber + pWebSite + pSection, 'block');
					}
				}
			} else {
				var CookiesGen = new Cookies();
				CookiesGen.set(pParam + pWebSite + pSection, pValue);
			}
			/*
			if( pParam == 'Focus' ){
				var WinFocus = new Cookies();
						pFocus   = $('ButtonFocus').checked;
						if( pFocus == true )
					  	WinFocus.set('HomePage_' + pParam + '_'+ pWebSite, 1);
					  else
					  	WinFocus.set('HomePage_' + pParam + '_'+ pWebSite, 0);
			}
			*/
			// Questo blocco di salvataggio deve essere eseguito solo quando ho i box creati manualmente
/*
			if( pParam == 'BoxSelect' ){
				var Select  = new Cookies();
				for(i=0;i<pValue;i++){
		 			BoxNumber = i + 1;
					pSelect  = $(pParam + '_' + BoxNumber).value;
					if( pSelect != null )
					  Select.set('HomePage_' + pParam + '_' + BoxNumber, pSelect);
				}
			}
*/
			return true;
	}

	/* Recupero di un songolo valore di Cookies */
	function FindOnlyCookies(pName){
		var pCookies = new Cookies();
		return pCookies.get(pName);
	}
	
	function FindCookies(pParam, pValue, pWebSite, pSection){
			var BG = new Cookies();
			var pBG = BG.get('HomePage_BackGround' + pWebSite + pSection);
			if( pBG != null && pBG != "" && pBG != false ){
					var IsImage = pBG.search(/\./i);
	        if( IsImage != -1 ){
	          $('WappsBody').style.backgroundColor = "";
	          $('WappsBody').style.backgroundImage = pBG;
	        } else {
	          $('WappsBody').style.backgroundImage = "";
	          $('WappsBody').style.backgroundColor = pBG;
	        }
			}

			if( pParam == 'Box' || pParam == 'BoxBlock' ){
				var Display = new Cookies();
				for(i=0;i<pValue;i++){
					BoxNumber = i + 1; 
					var pDisplay = Display.get('HomePage_Show' + pParam + '_' + BoxNumber + pWebSite + pSection);
					if( pDisplay != null && pDisplay != ''){
					  $( pParam + '_' + BoxNumber).style.display = pDisplay;
					  if( pDisplay == 'none' && pParam == 'Box' ){
					  	$( pParam + 'Mini_' + BoxNumber).show();
					  	$(pParam + 'Mini_' + BoxNumber).style.backgroundColor = '#0067AD';
					  }
					}
				}
			}
			/*
			if( pParam == 'Focus' ){
				var WinFocus = new Cookies();
				var pFocus   = WinFocus.get('HomePage_' + pParam + pWebSite);
						if( pFocus == 1 )
							$('ButtonFocus').checked = true;
					  else
							$('ButtonFocus').checked = false;
			}
*/
	}

	/* Creazione dei timer per il refresh dei blocchi */
	function CreateTimer(pt, pCallBack, pTime){
		pt = new PeriodicalExecuter(pCallBack, pTime);
	}

	/* Sposta un elemento nel blocco pArea */
	function moveItem( DRAGGABLE ){
	   var pId = DRAGGABLE.id;
	   $(pId).hide();
	   pId = pId.replace('Box', 'BoxMini');
	   $(pId).show();
	}

	/* Creazione un elemento draggabile */
	function CreateDragObject(pId, pArea){
		new Draggable(pId, { revert: true, constraint:"vertical" });
	}

	/* Richiude la window */
	function Collapse(pId, pIdImage){
		Effect.toggle(pId, 'Slide', {duration:1});

		if( pIdImage != '' ){
			var pImage = $(pIdImage).className;
			if( pImage.search(/Minimize/i) == -1 ){
				$(pIdImage).className  = 'Button_Minimize';
				
			}else{	
				$(pIdImage).className  = 'Button_Maximize';
			}
		}
	}

	/* OpenClose di un Id */
	function OpenCloseId(pId, pOpenCloseType, pEffect){
			pDisplay = $(pId).getStyle('display');
			if( pDisplay == 'block' && pOpenCloseType == 'O' )
				return;
			if( pOpenCloseType == 'O' ){
				if( pEffect != '' )
					$(pId).appear();
				else	
					$(pId).setStyle({ display:'block' });
			} else {
				if( pEffect != '' )
					$(pId).puff();
				else	
					$(pId).setStyle({ display:'none' });
			}				
	}
	
	/* OpenClose di una classe */
	function OpenCloseClass(pClass, pColor, pBorder){
		$$(pClass).each(
		   function (e) {
		      e.setStyle({borderLeft: pBorder + 'px solid ' + pColor, borderRight: pBorder + 'px solid ' + pColor}); 
		   } 
		);
	}

	/* OpenClose di una classe */
	function OpenCloseEffect(pClass, pEffect){
		$$(pClass).each(
		   function (e) {
		   	if( pEffect == 'Fade')
		   		Effect.Fade(e);
		   	if( pEffect == 'Appear')
		   		Effect.Appear(e);
		   	if( pEffect == 'Show')
		   		e.show();
		   	if( pEffect == 'Hide')
		   		e.hide();
		   	if( pEffect == 'Grow')
		   		Effect.Grow(e);
		   	if( pEffect == 'SlideUp')
		   		Effect.SlideUp(e);
		   	if( pEffect == 'SlideDown')
		   		Effect.SlideDown(e);
		   } 
		);
	}


	/* Mette a fuoco solo id passato */
	function FocusId(pId, pPrefisso, pNum){
		for(i=1;i<(pNum + 1);i++){
			if( !$(pPrefisso + i) )
				continue;
			if( pPrefisso + pId == pPrefisso + i ){
			  $(pPrefisso + i).style.opacity = '';
				$(pPrefisso + i).style.filter = '';
			} else {
			  $(pPrefisso + i).style.opacity = 5/10;
				$(pPrefisso + i).style.filter = 'alpha(opacity=' + 5*10 + ')';
			}
		}
	}

	/* Mette a fuoco solo id passato */
	function FocusAll(pPrefisso, pNum){
		for(i=1;i<(pNum + 1);i++){
			if( !$(pPrefisso + i) )
				continue;
			  $(pPrefisso + i).style.opacity = '';
				$(pPrefisso + i).style.filter = '';
		}
	}

	/* Sposta un blocco */
	function moveTo(pId, pX, pY, pEffect)
	{
		pTop    = $(pId).getStyle('top');
		pHeight = $(pId).getStyle('height');
			
		if( pTop == null ){
			$(pId).setStyle({ top: '0px'});
			pTop = '0px';
		}

		pTop       = pTop.substring(0, pTop.length - 2 );
		pHeight    = pHeight.substring(0, pHeight.length - 2 );
		pOffsetTop = $(pId).offsetTop;

		if( pY > 0 && ( pTop == 0 || pTop > 0 ) ){
			$(pId).setStyle({ top: '0px'});
			return;
		}

		if( pY < 0 && ( ( pOffsetTop - 500 ) < -(pHeight) ) ){
			return;
		}

	  if( pEffect == 'Linear' )
	      new Effect.Move(pId, { x: pX, y: pY, transition: Effect.Transitions.linear  });
	  if( pEffect == 'Spring' )
	      new Effect.Move(pId, { x: pX, y: pY, transition: Effect.Transitions.spring });
	  if( pEffect == 'Sinoidal' )
	      new Effect.Move(pId, { x: pX, y: pY, transition: Effect.Transitions.sinoidal });
	} 

	/* Controlla se nei blocchi c'è già la funzione chiamata */
	function IsPresent(pValue, pNumberOfBlock){
		alert(pValue);
		for(i=0;i<pNumberOfBlock;i++){
			BoxNumber = i + 1;
			if( $('BoxSelect_' + BoxNumber).value == pValue ){
				alert('This block is present'); 
				return false;
			}
		}
		return true;
	}


	/* Consente di effettuare il refresh nelle zone Ticker */
	function RefreshTicker(pId, pQuery, pTypeOfScroll){
		pIdTicker           = pId;
		pQueryTicker        = pQuery;
		pTypeOfScrollTicker = pTypeOfScroll;
		if( $(pIdTicker) == null ){
			pRefreshTicker = 0;
			return;
		}
		if( pQuery != '' )
	  	ChangeCtx('', pIdTicker, 'Aggiorna', './Standard/', 'Query', pQueryTicker, '', '', '', '');
		if( pTypeOfScrollTicker == 'V' )
			 	new verticalMarquee  (pIdTicker);
		else	 	
				new horizontalMarquee(pIdTicker, {speed:1, control:true}); 
		pRefreshTicker = 1;
	}
	
	/* Restituisce l'ora coorente */
	function CurrentTime(){
		var d = new Date();
		var Hours=d.getHours();
		var Minutes=d.getMinutes();
		var Seconds=d.getSeconds();
		return Hours + " : " + Minutes + " : " + Seconds;
	}
	
	/* Blocco da muovere U = up D = down */
	function MovePrimoPiano(pId, pDirection, pStep){
		if( $(pId).getStyle('display') == 'block' )
			pId = pId;
		else if	( $(pId + '_Foto' + pStyleOfNews).getStyle('display') == 'block' )
			pId = pId + '_Foto';
		else if	( $(pId + '_Video' + pStyleOfNews).getStyle('display') == 'block' )
			pId = pId + '_Video';
			
		if( pDirection == 'D' ){
			moveTo(pId, 0, -(pStep), 'Sinoidal');
		} else if( pDirection == 'U' ){
			moveTo(pId, 0, pStep, 'Sinoidal');
		} else if( pDirection == 'I' ){
			$(pId).setStyle({top:'0px'});
		} else {
			moveTo(pId, 0, pStep, 'Sinoidal');
		}
	}

	/* Consente di muovere il Blocco e Modificare le dimensioni */
	function MoveMorph(pId, pW, pH){
		if( pW == 0 ){
			new Effect.Morph(pId, {
			  style: 'width:-' + pW +';', // CSS Properties
			  duration: 0.8 // Core Effect properties
			});
		} else {
			new Effect.Morph(pId, {
			  style: 'width:' + pW +';', // CSS Properties
			  duration: 0.8 // Core Effect properties
			});
		}
	}
	
	/* Controlla il testo inserito nel box di ricerca */
	function CheckSearchValue(pId, pKeyCode){
		if( $(pId).value == 'Inserire qui il testo'){
			$(pId).value = '';
			$(pId).setStyle({ color: '#000000'});
			return false;
		}
		if(pKeyCode == 13 ){
			if( $(pId).value == '' ){
				alert('Testo immesso non valido');
				return false;
			}
			if( $(pId).value.length < 3 ){
				alert('Testo immesso troppo corto');
				return false;
			}
		}
		return true;
	}
	
	/* Cambia lo stile di font: Color, Size e  Weight */
	function ChangeFontStyle(pClass, pColor, pFontSize, pFontWeight){
		$$(pClass).each(
			function (e){		
				if( pFontSize == '' )
					pFontSize = 10;
				if( pFontSize == '-1' )
					pFontSize = parseInt(e.getStyle('fontSize')) - 1;
				if( pFontSize == '1' )
					pFontSize = parseInt(e.getStyle('fontSize')) + 1;
				if( pFontWeight == '' )
					pFontWeight = 'normal';
				if( pColor == '' )
					pFontWeight = '#000000';
				if( pFontSize < 10 || pFontSize > 18 )
					return;
				e.setStyle({ color: pColor, fontSize: pFontSize + 'px', fontWeight: pFontWeight });
			}
		);
	} 

	/* Crea un ToolTip */
	function CreateToolTip(pId, pIdToolTip){
		if( $(pIdToolTip) )
	  	new Tooltip(pId, pIdToolTip);
	} 


	// Cambia l' immagine di sfondo
	function ChangeBackGround(pId, pImage){
		$(pId).style.backgroundImage = "url(./images/BackGrounds/" + pImage + ")";
	}

	// Chiama la funzione ChangeCtx
	function CallQuery(pIdForm, pParam){
		pParam = pParam.replace(/&amp;/gi,"&");
		ChangeCtx('', pIdForm,   'Aggiorna', './Standard/', 'Query', pParam, '', '', '', '');
	}
	
	// Controllo dei parametri
	function ControlloParametro (pValue, pName, pType){
	        if( pType == '' ){
	          if( pValue == '' || pValue == null){
	            alert(pName + ': Invalid value');
	            return false;
	          }
	            
	        }
	
	        if( pType == 'email' ){
	          	var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	          	if (!espressione.test(pValue))
	          	{
	          	    alert("La mail inserita non è valida!");
	          	    return false;
	          	}
	        }
	
	};	

	// Consente di Aprire tutte le finestre chiuse
	function OpenAllWindow(pNumber, pOpenClose){
		for(i=0;i<pNumber;i++){
			pCurrNumber = i + 1;
			if( !$('BoxBlock_' + pCurrNumber) )
				continue;
			if( pOpenClose == 'O' ){
				new Effect.Appear('BoxBlock_' + pCurrNumber);
			} else {
				new Effect.Fade('BoxBlock_' + pCurrNumber);
			}
		}
	}

	/* Filtra in base al parametro passato */
	function FilterClass(pValue){
		if( pValue == "" || pValue == " " )
			return;
		pValue = pValue + " ";
		pClass = '.Mattina,.Pomeriggio,.Sera,.Notte';
		OpenCloseEffect(pClass,'Show');
		$$(pClass).each(
		   function (e) {
		   	var OriginalValue = e.innerHTML;
	   		OriginalValue = OriginalValue.replace(/Evidenzia/gi, "");
		   	var StripValue    = OriginalValue.replace(/(<([^>]+)>)/ig,"");
		   	pMatchValue       = StripValue.match(new RegExp(pValue, "i"));
		   	if( pMatchValue == null ){
		   		e.hide();
		   	} else {
		   		e.innerHTML   = OriginalValue.replace(new RegExp(pMatchValue, "gi"), "<font class='Evidenzia'>"+pMatchValue+"</font>");
		   	}
		   } 
		);
	}

	/* Visualizza tutti i commenti */
	function ViewAllComment(){
		pClass = '.Comment';
		OpenCloseEffect(pClass,'Show');
	}

	/* Cambia Stile in una classe */
	function ChangeStyleClass(pClass, pValue){
		$$(pClass).each(
		   function (e) {
				e.setStyle({color:pValue});
		   } 
		);
	}

	/* Cambia il contenuto di un blocco */
	function ChangeContentValue(pId, pValue){
		$(pId).innerHTML = pValue;
	}
	
	// Creazione di uno Scroller
	function CreateScroller(pId, pIdArea){
			// vertical slider control
			var Slider = new Control.Slider(pId + 'Handle',  pId + 'Track', {
				axis: 'vertical',
				onSlide: function(v) { scrollVertical(v, $(pIdArea), Slider);  },
				onChange: function(v) { scrollVertical(v, $(pIdArea), Slider); }
			});
			
			
			// disable vertical scrolling if text doesn't overflow the div
			//if ($('Scrollable' + pId).scrollHeight <= $('Scrollable' + pId).offsetHeight) {
			//	Slider.setDisabled();
			//	$('Wrap' + pId).hide();
			//}



	}

			// scroll the element vertically based on its width and the slider maximum value
			function scrollVertical(value, element, slider) {
				element.scrollTop = Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight));
			}

    var contaId = 0;
    var IndiceFinestra = 0;

		function CambiaContesto(purl){
						contaId = contaId +1;

			new Ajax.Updater('IdContext',purl,{
        history : {
            id    : 'page',
            state : contaId,
            cache : true,
            onhashchange : function(contaId) {
                History.setTitle(History.getTitle() + ' - ' + contaId);
            }
        },
				onCreate:function(){
				      document.getElementById("Loader").style.visibility = "visible";
				},
				onComplete:function(){
				      document.getElementById("Loader").style.visibility = "hidden";
				}
				}
				);			
		}
		
		function ChangeCtx(pSessionId, pIdContext, pIdLoader, pDirUrl, pUrl, Pars, pIdForm, pMethod, pRestart, pParamRestart){
			contaId = contaId +1;			
			var pParams = '';
			
			pUrl = pDirUrl + pUrl + '.php';
			
			if( pMethod == '' || pMethod == 'get' )
				pMethod = 'get';
			
			if( pIdForm != '' ){
				pParams = $(pIdForm).serialize();
			}
						
			if(pParams != '' )
				Pars = pParams;
			
			if( pSessionId != '' ){
				if( Pars != '' )
					Pars = Pars + '&SessionId=' + pSessionId;
				else
					Pars = Pars + '?SessionId=' + pSessionId;
			}
			
			new Ajax.Updater(pIdContext,pUrl,{
				method: pMethod,
				parameters: Pars,
				onCreate:function(){
			      $(pIdLoader).style.visibility = "visible";
				},
        onSuccess: function(){
  		    	getResponse;
	  		    if( pRestart != '' ){
	    		    From        = pParamRestart.search("&Id=");
    		    	pIdContext2 = pParamRestart.substr(From + 4);
    					ChangeCtx('',pIdContext2,pIdLoader,pDirUrl,pRestart,pParamRestart,'','','','');
    				}
        },
		  	onLoading:function(){
	  				$('DataLoading').innerHTML='<font style=\'font-family:SpaceAge;\'>Data loading...<font>';
		  	},
				onComplete:function(){
	  				$('DataLoading').innerHTML='';
			      $(pIdLoader).style.visibility = "hidden";
            //ConvertFontSize($('Tabella').value,'All',parseInt(Sliders.values));
				},
				onFailure: reportError
				}
				);
		}
		
		
		function ChangeCtxWin(pWin, pTitolo, pW, pH, pT, pL, pSessionId, pIdContext, pIdLoader, pDirUrl, pUrl, Pars, pIdForm, pMethod, pRestart, pParamRestart){

                        if ( Get_Cookie( 'WinClassName' ) ){
                                pClassName = Get_Cookie('WinClassName');
                        } else {
                                Set_Cookie( 'WinClassName', 'mac_os_x', '1', '/', '', '' );
                                pClassName = 'mac_os_x';
                        }

                        if ( Get_Cookie( 'WinBlurClassName' ) ){
                                pBlurClassName = Get_Cookie('WinBlurClassName');
                        } else {
                                Set_Cookie( 'WinBlurClassName', 'blur_os_x', '1', '/', '', '' );
                                pBlurClassName = 'blur_os_x';
                        }

  		        $(pIdLoader).style.visibility = "visible";

                        if( pW == '' ){
                                pW = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
                                pW = pW - 30;
                        }
                        
                        if( pH == '' ){
                                pH = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
                                pH = pH - 200;
                        }
                        
                        pTitolo = '<b>' + pTitolo + '</b>'; 

			var pParams = '';
			pUrl = pDirUrl + pUrl + '.php';
			
			if( pMethod == '' || pMethod == 'get' )
				pMethod = 'get';
			
			if( pIdForm != '' ){
				pParams = $(pIdForm).serialize();
			}
						
			if(pParams != '' )
				Pars = pParams;
			
			if( pSessionId != '' ){
				if( Pars != '' )
					Pars = Pars + '&SessionId=' + pSessionId;
				else
					Pars = Pars + '?SessionId=' + pSessionId;
			}
                        var win = new Window({id: pTitolo + IndiceFinestra, className: pClassName, blurClassName: pBlurClassName, title: pTitolo, showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, width: pW, height: pH, top: pT, left: pL,url: pUrl+'?'+Pars, parent:$('Context')}); 
                        Event.observe($$("#theme select").first(), "change", changeTheme); 
                        win.setDestroyOnClose(); 
                        win.setConstraint(true, {left:0, right:0, top: 40, bottom:10})
                        win.show();
                        win.toFront();
                        
                        $(pIdLoader).style.visibility = "hidden";


		}

		function getResponse(oReq) {
			$('Dettaglio').innerHTML = oReq.responseText;
		}


		function reportError(request){
			alert("Sorry. There was an error." + request)
		}

