
function SetColumns(){
	var scrRes,colDim;
	var theCol1,theCol2,theCol3;

	try{
		scrRes = screen.width;		
		colDim = document.getElementById("s" + scrRes);

		if (colDim){
			var vDim = colDim.value.split(';');

			theCol1 = document.getElementById('col1');
			theCol2 = document.getElementById('col2');
			theCol3 = document.getElementById('col3');
							
			if (vDim.length > 0 && theCol1){
				theCol1.style.width = vDim[0];
			}
			if (vDim.length > 1 && theCol2){
				theCol2.style.width = vDim[1];
			}					
			if (vDim.length > 2 && theCol3){
				theCol3.style.width = vDim[2];
			}						
		}
	}catch(e){
		alert(e.description);
	}
}


function OpCl(thisEl){            
    try{  
		var thisId = "";
        var vId = thisEl.id.split(".");
		if (vId.length == 2){
			thisId = vId[1];
		}else{
			thisId = vId[0];
		}
        
        var myChild = document.getElementById(thisId + "_SUB"); 
            
        if(myChild){                                                                            
			if(myChild.style.display=="none"){
				myChild.style.display="block";
			}else{
				myChild.style.display="none";
			}
        }
    }catch(e){
        
    }                   
}  
  
  
function OpenWindow(strUrl,strWrite){
	try{
		var maxH = screen.availHeight - 45;
		var maxW = screen.availWidth - 20;	
		var strOpt = 'scrollbars=yes,resizable=yes,top=2,left=2,width=' + maxW + ',height=' + maxH + ',status=no,location=no,toolbar=no'

		var fgWin = window.open(strUrl,'',strOpt);	
		
		if (strWrite){
			fgWin.document.write(strWrite);
			//fgwin.close();
		}	
	}catch(e){
		alert('JS - OpenWindow : ' + e.description);
	}
}  


function GetParam(name){
	var strPar,vPar;
      	
     try{
		tmpPar = unescape(location.search.slice(1)).split('&');
      			      	
      	for (i=0;i<tmpPar.length;i++){
      		vPar = tmpPar[i].split('=');
      		if (vPar[0].toLowerCase() == name.toLowerCase()){
      			return vPar[1];
      		}
      	}
      	
      	return "";
     }catch(e){
      	alert(e.description);
     }	
}

function GetAllParams(){
	var tmpPar, strPar, vPar;
      	
     try{
		tmpPar = unescape(location.search.slice(1)).split('&');	
		
		vPar = new Array();
      	for (i=0;i<tmpPar.length;i++){		
      	    vPar[i] = tmpPar[i].split('=');		   				
      	}
      	
      	return vPar;
     }catch(e){
      	alert(e.description);
     }	
}


function ViewPrintable(elem){
    try{
		var newStyle = "<style type='text/css' media='print'>.noprint{display:none;}</style><style>.noprint#noprint{display:none;}</style>";
		var cmdPrint = ""; 

		var maxH = screen.availHeight - 60;
		var maxW = screen.availWidth - 120;	
		var strOpt = 'scrollbars=yes,resizable=yes,top=2,left=2,width=' + maxW + ',height=' + maxH + ',status=no,location=no,toolbar=no,menu=no'

		var html = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><HTML><HEAD>";

		var hTags = "";
		if (document.getElementsByTagName != null){
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0){
				hTags += headTags[0].innerHTML;
			}
		}
		
		html += hTags + newStyle + "</HEAD><BODY><div class='noprint' style='padding:3px;padding-bottom:12px;'><input type='button' class='titolo12' style='cursor:hand;width:140px;' value='Stampa' onclick='window.print();' ></div>";	
		html += "<DIV style='margin:3px;'>"
		
		if (elem){
			var printElem = elem.parentNode;
			
			if (printElem){
				html += printElem.innerHTML;						
			}					
		}else{
			alert("Nessun oggetto da stampare");
			return;
		}

		html += '</DIV></BODY></HTML>';

		var printWin = window.open("about:blank",'',strOpt);
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
	}catch(e){
		alert("Impossibile visualizzare la versione stampabile per il seguente motivo:\n\n" + e.description);
	}			
}



