function init(){
 
	var myWidth = 0, myHeight = 0;
	
	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 (parseInt(myHeight) > 600){
		var cHeight = myHeight;
	} else {
		var cHeight = 600;
	}	

	if (parseInt(myWidth) > 1000){
		var cWidth = myWidth;
	} else {
		var cWidth = 1000;
	}
	
    if (cHeight < 700) {
		var barHeight = cHeight*0.10;
	} else {
		var barHeight = cHeight*0.15;
	}

	var barWidth = cWidth ;
	var space = cWidth * 0.01;

	var back			= document.getElementById('back');
	var topbar			= document.getElementById('topbar');
	var logo 			= document.getElementById('logo');
	var logo_im 		= document.getElementById('logo_im');
	var bottombar 		= document.getElementById('bottombar');
	var presentation 	= document.getElementById('presentation');
	var presentation_text 	= document.getElementById('presentation_text');
	var images 			= document.getElementById('images');
	var frame 			= document.getElementById('frame');
	var menu 			= document.getElementById('menu');
	var lang 			= document.getElementById('lang');
	var square 			= document.getElementById('square');
	var square2 		= document.getElementById('square2');
	var line 			= document.getElementById('line');
	var intro			= document.getElementById('intro');
	
	intro.style.width = parseInt(cWidth)+'px';
	intro.style.height = parseInt(cHeight)+'px';
	
	back.style.height = parseInt(cHeight-2 * barHeight)+'px';
	back.style.width = parseInt(cWidth) + 'px';
	back.style.top = parseInt(barHeight) + 'px'
	back.innerHTML ='<img src="../images/back.png" style="width:'+parseInt(cWidth)+'px; height:'+ parseInt(cHeight-2 * barHeight)+'px">';
	
	topbar.style.height = parseInt(barHeight) + 'px';
	topbar.style.width 	= parseInt(barWidth) + 'px';

	line.style.top 		= parseInt(barHeight) -4 + 'px';

	logo.style.width 	= 250 + 'px';//220 + 'px';
	logo.style.top 		= barHeight - (parseInt(logo.style.width)*0.2587)*0.55 + 'px';
	logo.style.left 	= cWidth - parseInt(logo.style.width) - 1 + 'px';


	bottombar.style.top = parseInt(cHeight - barHeight) + 'px';
	bottombar.style.height = parseInt(barHeight) + 'px';
	bottombar.style.width = parseInt(barWidth) + 'px';

	presentation.style.top = parseInt(barHeight + 20) + 'px';
	presentation.style.left = parseInt(cWidth * 0.13) + 'px';
	presentation.style.height = parseInt(cHeight - 2*barHeight - 30 ) + 'px';
	presentation.style.width = parseInt(cWidth * 0.23) + 'px';
	presentation_text.style.height = parseInt( (cHeight - 2*barHeight - 30) * 0.725 )+ 'px';


	var fontSize = 20;
	presentation_text.style.fontSize = parseInt(fontSize) +'px';

	/*
	presentation_text.innerHTML += (presentation_text.clientHeight);
	presentation_text.innerHTML += (presentation_text.offsetHeight);
	presentation_text.innerHTML += (presentation_text.scrollHeight); // su FireFox funziona solo questa
	presentation_text.innerHTML += (presentation_text.style.height); // e naturalmente questa
	*/

	while (presentation_text.scrollHeight > presentation_text.clientHeight) {
		fontSize -= 1;
		presentation_text.style.fontSize = parseInt(fontSize) + 'px';
	}

	images.style.top = parseInt(barHeight + 20) + 'px';
	images.style.left = parseInt(cWidth * 0.13 + cWidth * 0.23 + space) + 'px';
	images.style.height = parseInt(cHeight - 2*barHeight - 30) + 'px';
	images.style.width = parseInt(cWidth * 0.1) + 'px';

	frame.style.top = parseInt(barHeight + 20) + 'px';
	frame.style.left = parseInt(cWidth * 0.13 + cWidth * 0.23 + cWidth*0.1+ 2*space) + 'px';
	frame.style.height = parseInt(cHeight - 2*barHeight - 30 ) + 'px';
	frame.style.width = parseInt(cWidth * 0.40) + 'px';

	menu.style.top = parseInt(barHeight - 25) + 'px';
	menu.style.left = parseInt(cWidth * 0.13) + 'px';

	lang.style.top = parseInt(barHeight - 20) + 'px';

    square.style.top = cHeight - barHeight - 90 + 'px';
	square.style.left = parseInt(frame.style.left) - 100 +'px';

    square2.style.top = parseInt(barHeight + 20 ) + 20 + 'px';
	square2.style.left = parseInt(cWidth * 0.13) +(cWidth*0.23/2.0) + 100 +'px';
}

function mOn(td){
  if((document.all && !(document.getElementById)) || document.getElementById){
    td.style.color = "#FFCC66";
    }
}

function mOut(td){
  if((document.all && !(document.getElementById)) || document.getElementById){
    td.style.color = "white";
  }
}

function lOn(td){
  if((document.all && !(document.getElementById)) || document.getElementById){
    td.style.color = "yellow";
    }
}

function lOut(td){
  if((document.all && !(document.getElementById)) || document.getElementById){
    td.style.color = "red";
  }
}


var startMenu;
function go(elem){

	startMenu = parseInt(document.getElementById('menu').style.left);
	
	document.getElementById('frame').innerHTML = document.getElementById(elem).innerHTML;
	var step = 114;
	var offset = 10;
	
	if (elem == 'home')       document.getElementById('line').style.left = startMenu + offset + 'px';
	if (elem == 'curriculum') document.getElementById('line').style.left  = startMenu + step * 1 + offset +  'px';
	if (elem == 'servizi')    document.getElementById('line').style.left  = startMenu + step * 2 + offset + 'px';
	if (elem == 'frammenti')  document.getElementById('line').style.left  = startMenu + step * 3 + offset + 'px';
	if (elem == 'contatti')   document.getElementById('line').style.left  = startMenu + step * 4 + offset + 'px';
	if (elem == 'link')       document.getElementById('line').style.left  = startMenu + step * 5 + offset + 'px';

}

function onRes(){
    var curMenu = parseInt(document.getElementById('menu').style.left);
    document.getElementById('line').style.left =  parseInt(document.getElementById('line').style.left) + (curMenu - startMenu) +'px'; 
    startMenu = parseInt(document.getElementById('menu').style.left);
}

var op = 100;
var interval;
var iter=0;
var startTime;


function setOpacity(elem, step) {
	iter +=1;
	op -= step; 
	element = document.getElementById(elem);
	element.style.opacity = op/100.0;
	element.style.MozOpacity = op/100.0;
	element.style.filter = 'alpha(opacity=' + op + ')';
	
	var time_b = new Date();
	var stopTime = time_b.getTime();
	if (op <= 0 || (stopTime - startTime) >= 2500) {
		window.clearInterval(interval);
		element.style.display="none";
	}
}

function swfFinished() {
	var time_a = new Date();      
	startTime = time_a.getTime(); 

	var nVer = parseFloat(navigator.appVersion);
	var nAgt = navigator.userAgent;
	var browserName = "";

	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
		browserName  = "IE";
	}
	
		

	if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		browserName  = "Firefox";
	}
	
	if ( ((browserName == "Firefox") && (nVer >= 3)) || ((browserName == "IE") && (nVer >= 4)) )  {
		interval = window.setInterval("setOpacity('intro', 2);", 50);
	}  else {
		document.getElementById('intro').style.display = "none";
	}
}

