function OpenWindowFromTree( arguments ) // Argomenti separati da un pipe
{
	 // alert(arguments);	
	var args = arguments.split('|');
	var title = '';
	var rootId = -1;
	
	// Questa correzzione serve per poter impostare un rootId != da -1 nel caso fosse necessario sfruttato l'argomento 1
	if ( args[1].split('-').length > 1 )
	{	
		rootId = parseInt( args[1].split('-')[1] );
		title = 	args[1].split('-')[0] + '_' + args[2]; 
	}
	else
		title = args[1]+'_'+args[2]
		
		
	
	if ( rootId != parseInt( args[2] ) )	
		OpenStandardWindow(args[0],title,args[2],'id='+args[2],800,600,true);
	else
		alert('Necessario selezionare un elemento valido per poter aprire la maschera di dettaglio');
	
}

//  panel text 
function __setValues(text, value, hiddenTextID, hiddenValueID, labelID) {

   
    document.all[labelID].innerText = text;
    document.all[hiddenTextID].value = text;
    document.all[hiddenValueID].value = value;


    return false;

}
          
              

function OpenStandardWindow(url, title, argument, query, width, height, moveleft)
{
		var int_windowLeft = 0;
		var int_windowTop = 0;

		if ( moveleft == null )		
			moveleft = false;

		if ( ! moveleft )
		{
			int_windowLeft = (screen.width - width) / 2;
			int_windowTop = (screen.height - height) / 2;
		}
		else
		{		
				int_windowLeft = window.screenLeft+50;
				int_windowTop = window.screenTop+50;
		}
	

		var url = url + '?' + query;
		var par = 'top='+int_windowTop+',left='+int_windowLeft+', width=' + width + ', height=' + height + ',fullscreen=no, directories=no, location=no, menubar=no, resizable=yes, titlebar=no, scrollbars=no, titlebar=no, toolbar=no, status=no';			
		var win = open(url,title,par);		
		
		
		win.dialogArgument = argument; 
		win.focus();   
  
		
        return win;
}

function OpenScrollableWindow(url, title, argument, query, width, height)
{ 			
		var url = url + '?' + query;
		var par = 'top=0,left=0, width=' + width + ', height=' + height + ',fullscreen=no, directories=no, location=no, menubar=no, resizable=yes, titlebar=no, scrollbars=yes, titlebar=no, toolbar=no, status=no';			
		var win = open(url,title,par);			
		win.dialogArgument = argument; 
		win.focus();                   
		
        return win;
}

function GetQueryValue(name)
{
		var stringaParametri = location.search
		
		stringaParametri = stringaParametri.substring(1);
		
		arrParam = stringaParametri.split("&");
		
		for (var i=0; i<arrParam.length;i++)
		{
			arrElement = arrParam[i].split("=");
			if (arrElement[0].toLowerCase() == name.toLowerCase())
				return arrElement[1];
		}
		
		return "";
		
}
