// JavaScript Document

var promoTIME = 21;	
var promoTimer=0;
var promoSecondi=0;
var simbolo_euro="";
//variabili per lo scroll
var mexTimer=0;		//timer dei messaggi
var divH=60;		//altezza del div
var numMex=0;
var mexVideo=0;
var spazioTick=0;
var margTop=5
var tWidth='540px';                  // width (in pixels)
var tHeight='60px';                  // height (in pixels)
var tcolour='none';               // background colour:
var moStop=false;                     // pause on mouseover (true or false)
var fontfamily = 'arial,sans-serif'; // font for content
var tSpeed=3;                        // scroll speed (1 = slow, 5 = fast)

// enter your ticker content here (use \/ and \' in place of / and ' respectively)
var content='';


function mostra_messaggi()
{	
	if(mexVideo==numMex)mexVideo=0;
	var messaggi_scroll= new Array();
	messaggi_scroll=messaggi_db.split("|");
	numMex=messaggi_scroll.length;
	var contTemp=new Array();
	contTemp=messaggi_scroll[mexVideo].split("*");
		
	content='<table style="height:'+divH+'px;cursor:pointer" cellspacing="0" border="0" width="100%" height="100%" '+contTemp[2]+' align="left"><tr height="'+divH/4+'" ><td height="'+divH/4+'" class="titolo_news" >'+contTemp[0]+'</td></tr><tr height="'+(divH/4)*3+'" ><td height="'+(divH/4)*3+'" class="testo_news">'+contTemp[1]+'</td></tr></table>';
		
	mexVideo++;
	mexTimer=setTimeout("mostra_messaggi()",10000);
	spazioTick=1;
	startticker();
}
var cps=tSpeed; 
var aw, mq; 
var fsz = parseInt(tHeight) - 4; 
function startticker(){
	if (document.getElementById) 
	{
	var tick = '<div style="position:relative;width:'+tWidth+';height:'+tHeight+';overflow:hidden;background-color:'+tcolour+'"'; 
		if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=tSpeed"'; 
		tick +='><div id="mq" style="position:absolute;left:0px;top:0px;font-family:'+fontfamily+';font-size:'+fsz+'px;white-space:nowrap;"><\/div><\/div>';
		document.getElementById('ticker').innerHTML = tick;
		mq = document.getElementById("mq"); 
		mq.style.top=(parseInt(tHeight)+10)+"px"; 
		mq.innerHTML='<span id="tx" align="left">'+content+'<\/span>'; 
		aw = document.getElementById("tx").offsetHeight; 
		scrollticker();
		}
	}
	function scrollticker()
	{
		if(parseInt(mq.style.top)>margTop)
		{
			mq.style.top =parseInt(mq.style.top)-cps+"px";
			setTimeout("scrollticker()",50);
		}
		//mq.style.top = (parseInt(mq.style.top)>0) ?parseInt(mq.style.top)-cps+"px" : parseInt(tHeight)+10+"px";spazioTick=spazioTick-cps;
	}

//***************************************************** ANIMAZIONI MAIN ************************************************//
var spostX=1;
function motion_in()
{
	var divs=getElement("snai_div");
	divs.style.left = (parseInt(spostX)-506)+"px";
	var divb=getElement("bc_div");
	divb.style.left = (1015-parseInt(spostX))+"px";
	if (spostX<500)spostX=spostX+20;
	else {spostX++;}
	if (spostX<506)setTimeout("motion_in()",10);
	else{spostX=506;}
}
function motion_out()
{
	var divs=getElement("snai_div");
	divs.style.left = (parseInt(spostX)-506)+"px";
	var divb=getElement("bc_div");
	divb.style.left = (1015-parseInt(spostX))+"px";
	if (spostX>10)spostX=spostX-20;
	else {spostX--;}
	if (spostX>1)setTimeout("motion_out()",10);
	else{spostX=1;document.location.href=strlink+'';}
}
var spostINV=1;

function invito_in()
{
var divs=getElement("boxAccettaInvito");
	divs.style.left = (parseInt(spostINV)-281)+"px";	
	if (spostINV<270)spostINV=spostINV+10;
	else {spostINV++;}
	if (spostINV<281)setTimeout("invito_in()",10);
	else{spostINV=281;}
}
function invito_out()
{
	var divs=getElement("boxAccettaInvito");
	divs.style.left = (parseInt(spostINV)-281)+"px";	
	if (spostINV>10)spostINV=spostINV-10;
	else {spostINV--;}
	if (spostINV>1)setTimeout("invito_out()",10);
	else{spostINV=1;
	getElement("boxAccettaInvito").style.display = "none";
	getElement("ultimaNews").style.display = "block";}
}
