// <script language='javaScript'>

//
// winResize: allarga alla massima dimensione verticale il div di scorrimento centrale
//
function winResize (wide) {
var bottomHeight = 0;
	try {
		if (wide) {
			var topHeight = document.getElementById ('main').offsetTop;
			if (document.getElementById ('byCast')) 
				bottomHeight = (document.getElementById ('byCast').offsetHeight);
			var bodyHeight = (document.body.clientHeight - (topHeight + bottomHeight));
	
			document.getElementById ('mainTd').style.overflow = 'auto';
			document.getElementById ('mainTd').style.height = bodyHeight;
			}
		else {
			document.getElementById ('mainTd').style.overflow = 'auto';
			document.getElementById ('mainTd').style.height = null;
			}	
		}
	catch (e) {}
}

// homeResize: inzialmente aggiungevo una cornice intorno quando il video era molto largo, ora l'ho tolta
//             questa cosa, poi vedremo (ho amumentato il limite)
//			   doScroll indica se andare in scroll del body oppure no
//
function homeResize() {
var nWidth = document.body.offsetWidth;
var doScroll = document.body.clientHeight >= 720 && document.body.clientWidth >= 1000;

/*	
	il sistema qui sotto è da mettere a punto: dovrei verificare il top di ogni parent
	per arrivare bene alla conclusione: per ora soprassiedo e calcolo doScroll
	in modo approssimativo	
	
	document.body.clientHeight > 
		(parseInt(document.getElementById('infoDiv').offsetTop,10) + 
		 parseInt(document.getElementById('infoDiv').offsetHeight,10));
*/
	
	// alla fine ho fatto questa scelta, se lo schermo è troppo largo limito la larghezza
	// massima del div principale, e basta....
		 
	if (screen.availWidth > 1280) {
		document.getElementById('bodyDiv').style.width = '1280px';
		//document.body.style.marginLeft = 50;
		//document.body.style.marginRight = 50;
		}
	else {
		document.getElementById('bodyDiv').style.width = '100%';
		//document.body.style.marginLeft = 0;
		//document.body.style.marginRight = 0;
		}
	//
	//
	// metto lo scrolling nel div centrale solo se lo schermo è almeno 1280 in larghezza
	//		
	winResize(doScroll);
}

function homeLoad() {
	homeResize();
	msalceMainClick (1);
}

function zoomImg(img) {
var opt='dialogWidth:1024px; dialogHeight:800px; center:yes;';
	if (window.showModalDialog) 
		window.showModalDialog(img,null,opt);
	else 
		window.open(img,'name','height=800px,width=1024px,toolbar=no,directories=no,status=no,' +
					'menubar=no,scrollbars=no,resizable=no,modal=yes');	
}

var curCls = '';
function zoomOver (evt, lOnOff) {

	if (evt) {
		if (lOnOff) {
			curCls = evt.className;
			evt.className += 'Over';
			}
		else	
			evt.className = curCls;
	}

}


