if(typeof window.getComputedStyle!="function") {
	window.getComputedStyle=function(elt,pseudoElt) {
		return (elt!=null && typeof	elt.currentStyle=="object")?elt.currentStyle:null;
	}
}

if(!(document.getElementById)){ 
	document.getElementById=function(id) {
		if(document.all && document.all[id] && document.all[id].style) return document.all[id];
		else if(document.layers && document.layers[id]) {
			document.layers[id].style=document.layers[id];
			return document.layers[id];
		} else return null;
	}
}

function getBrowserWidth() {
	if (window.innerWidth) return window.innerWidth;
	else if(document.documentElement && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; 
	else if(document.body) return document.body.clientWidth;
	return 0;
} 

function getBrowserHeight(){
	if (window.innerHeight)	return window.innerHeight;
	else if(document.documentElement && document.documentElement.clientHeight != 0)	return document.documentElement.clientHeight; 
	else if(document.body) return document.body.clientHeight;
	return 0;
}

function setPosition() {
	var thispage = document.getElementById('container_home0');
	var pageWidth = parseInt(getComputedStyle(thispage,'').width);
	var browserWidth = (getBrowserWidth() - pageWidth)/2;
	if(browserWidth<0) browserWidth=0;
	var pageHeight = parseInt(getComputedStyle(thispage,'').height);
	var browserHeight = (getBrowserHeight() - 600)/2;
	if(browserHeight<0) browserHeight=0;
	thispage.style.margin = 0;
	thispage.style.left = browserWidth+"px";
	thispage.style.top = browserHeight+"px";
}

function setPosition2() {
	var thispage = document.getElementById('container_home');
	var pageWidth = parseInt(getComputedStyle(thispage,'').width);
	var browserWidth = (getBrowserWidth() - pageWidth)/2;
	if(browserWidth<0) browserWidth=0;
	var pageHeight = parseInt(getComputedStyle(thispage,'').height);
	var browserHeight = (getBrowserHeight() - pageHeight)/2;
	if(browserHeight<0) browserHeight=0;
	thispage.style.margin = 0;
	thispage.style.left = browserWidth+"px";
	thispage.style.top = browserHeight+"px";
}

function addEvent( obj, type, fn ) {
	if(obj.addEventListener) obj.addEventListener(type, fn, false);
	else if(obj.attachEvent){
		obj["e"+type+fn] = fn;
		obj[type+fn] = function(){obj["e"+type+fn](window.event);}
		obj.attachEvent("on"+type, obj[type+fn]);
	}
}

/*******PARTE NEWS*****/
fadetimer = new Array();
opacities = new Array();

for(ind = 0; ind<20;ind++) {
	fadetimer[ind] = null;
	opacities[ind] = 0;
}

function setOpacity(obj,opacity){
	opacity=(opacity==100) ? 99.999 : opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
} 

function fadeIn(i){
	obj = document.getElementById('msg'+i);
	opacities[i] += 4;
	if(opacities[i] < 100){
		setOpacity(obj,opacities[i]);
  		fadetimer[i] = window.setTimeout("fadeIn('"+i+"')", 2);
	}
} 

function fadeOut(i){
	obj = document.getElementById('msg'+i);
	opacities[i] -= 4;
	if(opacities[i] > 0){
		setOpacity(obj,opacities[i]);
  		fadetimer[i] = window.setTimeout("fadeOut('"+i+"')", 2);
	} else {
		document.getElementById('box'+i).style.zIndex='1';
	}
} 


function show(i) {
	if(fadetimer[i]!=null) window.clearTimeout(fadetimer[i]);
	document.getElementById('box'+i).style.zIndex='1001';
	fadetimer[i] = window.setTimeout("fadeIn('"+i+"')", 100);
}

function hide(i) {
	if(fadetimer[i]!=null) window.clearTimeout(fadetimer[i]);
	fadetimer[i] = window.setTimeout("fadeOut('"+i+"')", 1);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


