// switchTableDisplay: display or not a table by changing its style class
function switchTableDisplay(tableName){
	tableObj = document.getElementById(tableName);
	if (tableObj.style.display == 'none'){
		tableObj.style.display = 'block';
	} else {
		tableObj.style.display = 'none';
	}
}

function doBack(){
	history.back();
}

function doClose(){
	self.opener = this;
	self.close();
}

function setLinkEmph(nome, flg) { 
	if (flg == 1) {
		document.getElementById(nome).style.color = "#FFFFFF" ;
	} else {
		document.getElementById(nome).style.color = "#333333" ;
	}					
}

function switchBodyColors(bodyName){
	alert("aa");
	bodyObj = document.getElementById(bodyName);
	bodyObj.style.backgroundColor = '#FFFFFF';
}

function setAbsoluteDivDisplay(refElemId, divId){
	divTarget = document.getElementById(divId);
	refElem = document.getElementById(refElemId);
	
	if (divTarget.style.visibility == 'hidden'){    		
		var incr = 1;
		if(! document.all){
			incr = 28;
		}
		divTarget.style.visibility = 'visible';
		divTarget.style.height = '105px';
		divTarget.style.width = '300px';
		divTarget.style.left = refElem.offsetLeft + 'px';	//???
		divTarget.style.top = parseInt(refElem.offsetTop) + parseInt(refElem.offsetHeight) + incr + 'px';
		divTarget.style.float = 'right';
		divTarget.style.position = 'absolute';	
	} else {
		divTarget.style.visibility = 'hidden';
		divTarget.style.height = '1px';
	}		
}	

/* Larghezza finestra */
var myWidth = 0, myHeight = 0, wleft = 15, wtop = 15;
function getWinSize(flag) {
  
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  } 
  
  if (flag) {
	  if (myWidth > 780){
		myWidth = myWidth - Math.floor(myWidth/10);
		myHeight = myHeight - Math.floor(myHeight/10);
	  }	else {
		myWidth = 780;
		myHeight = 550;
	  } 
  }
  
  /* centro la finestra */	  
  wleft = (screen.width - (myWidth + 32)) / 2;
  wtop = (screen.height - (myHeight + 96)) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
	wleft = 15;
  }
  if (wtop < 0) {
	wtop = 15;
  }
}