// JavaScript Document

var scrolling = 1;
var delay = 150;
var movenews = true;

function browsercheck() {
	ver = navigator.appVersion;
	nome = navigator.appName;
	this.e = (ver.indexOf('MSIE')!=-1)?1:0;
	this.mac = (ver.indexOf('Macintosh')!=-1)?1:0;
	this.e5mac = (this.e && this.mac && (ver.indexOf('MSIE 5')!=-1))?1:0;
	this.e4 = (ver.indexOf('MSIE')!=-1 && !document.getElementById)?1:0;
	this.n4 = (ver.indexOf('4')!=-1 && document.layers)?1:0;
	this.strd = (document.getElementById && !this.e5mac)?1:0;
	this.n5 = (this.strd && nome.indexOf('Netscape')!=-1)?1:0;
	this.ceste = (!this.e4 && !this.n4 && !this.strd && !this.e5mac)?1:0;
	if (this.ceste){
        //alert('* site not supported by your browser * \n * sito non supportato dal tuo browser *');
    }
}

br = new browsercheck();

function OggLiv(ide, nest){
	nest = (!nest)?'':'document.'+nest+'.';
	this.elem = (br.e4 || br.e5mac)?document.all[ide]:(br.n4)?eval(nest+'document.'+ide):(br.strd)?document.getElementById(ide):null;
	this.css = (br.e4 || br.e5mac)?document.all[ide].style:(br.n4)?eval(nest+'document.'+ide):(br.strd)?document.getElementById(ide).style:null;
	this.x = (br.e4 || br.e5mac)?this.css.pixelLeft:(br.n4)?this.elem.left:(br.strd)?this.elem.offsetLeft:0;
	this.y = (br.e4 || br.e5mac)?this.css.pixelTop:(br.n4)?this.elem.top:(br.strd)?this.elem.offsetTop:0;
	this.h = (br.e4 || br.e5mac)?this.elem.scrollHeight:(br.n4)?this.elem.document.height:(br.strd)?this.elem.offsetHeight:0;
	this.w = (br.e4 || br.e5mac)?this.elem.scrollWidth:(br.n4)?this.elem.document.width:(br.strd)?this.elem.offsetWidth:0;
	this.obj = ide + "funk";
	eval(this.obj + "=this");
}

function initHeader2(){
	if (br.n5){
  		document.getElementById('interno').style.position = 'relative';
	}
   	liv1 = new OggLiv('esterno');
   	liv2 = new OggLiv('interno','esterno');
	liv2.h = liv2.h + 10;
}

function play() {

	movenews = true;
	setTimeout("move()",100);

}

function pause() {

	movenews = false;

}

function move() {
	/*s = "";
	for (var x in liv2 ) {
		s += x+" = " + eval("liv2." + x) + " - \n";
	}
	alert(s);*/
  if ( movenews ) {	
	if ( liv2.y >= (liv1.h - liv2.h) && (liv2.y <= 0) ) {
		var delay1 = delay;
		liv2.y -= scrolling;
  		liv2.css.top = liv2.y;
		if ( (liv2.y == 0) || liv2.y == (liv1.h - liv2.h) ) { 
			scrolling = -scrolling; 
			delay1 = 2000;
		}
		setTimeout("move()",delay1);
	} 
  }
}

var initFunctions = 'initHeader2();setTimeout("move()",2000);';

function initialize() {
	if(initFunctions != '') {
        eval(initFunctions);
    }
}