
function setOpacity(obj,opacity){
	opacity=(opacity==100) ? 99.999 : opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";  // IE/Win
	obj.style.KHTMLOpacity = opacity/100; // Safari<1.2, Konqueror
	obj.style.MozOpacity = opacity/100;   // Older Mozilla and Firefox
	obj.style.opacity = opacity/100;      // Safari 1.2, newer Firefox and Mozilla, CSS3
}

var ob, op;
function fadeIn(obj,opacity) {
	//window.status = obj+" "+opacity;
	if(opacity <= 100){
	  setOpacity(obj,opacity);
	  op = opacity += 2;
	  ob = obj;
	  setTimeout("fadeIn(ob,op)", 60);
	}
}	

function fadeOut(obj,opacity) {
	if(opacity > 20){
	  setOpacity(obj,opacity);
	  op = opacity -= 5;
	  ob = obj;
	  setTimeout("fadeOut(ob,op)", 20);
	}
}	


var news;

function crea_frecce(element, target){
var nscroll,
	up,down,news,
	up_zoom,
	do_zoom,
	velocity=2,
	img = document.getElementById(element).getElementsByTagName('img'),
	iconUp, iconDown,
	news = document.getElementById(target),
	nscroll=0,
	up_zoom=0,
	do_zoom=0;
	for(i=0; i<img.length; i++){
		if(img[i].name=="up") iconUp=img[i];
		if(img[i].name=="down") iconDown=img[i];		
	}	
	//iconUp.style.position = "absolute";
	//iconDown.style.position = "absolute";
	iconUp.style.zIndex = "100";
	iconDown.style.zIndex = "100";
	iconUp.style.display ="block";
	iconDown.style.display ="block";
	//news.style.position = "relative";


	iconUp.onmouseover = function(){
		up=true;
	}
	iconDown.onmouseover = function(){
		down=true;
	}		
	iconUp.onmouseout = function(){
		up=false;
	}
	iconDown.onmouseout = function(){
		down=false;
	}		
	
	document.onkeydown = function keyhandler(e) {
    	if (document.layers)
        	key = e.which;
    	else
        	key = window.event.keyCode;
			
		if(key==38) up=true; 
		if(key==40) down=true; 
	}
	document.onkeyup = function keyhandler(e) {	
		up=false;
		down=false;
	}
	
	this.run = function(){
		// 400= dimensione del clip
		//window.status = news.offsetHeight+" "+nscroll;
		if(up && !down && (nscroll<0)) news.style.top = (nscroll+=velocity) +'px';			
		if(!up && down && (nscroll>-news.offsetHeight+350)) news.style.top = (nscroll-=velocity) +'px';		
		
		if (up && up_zoom<10) up_zoom+=2; else if(!up && up_zoom>0)up_zoom-=4;
		if (down && do_zoom<10) do_zoom+=2; else if(!down && do_zoom>0)do_zoom-=4;
		
		iconUp.style.width= 50-up_zoom+"px";
		iconUp.style.height= 50-up_zoom+"px";
		iconUp.style.marginBottom = 50+up_zoom+do_zoom+"px";
		iconUp.style.marginLeft = up_zoom/2+"px";
		
		iconDown.style.marginLeft = do_zoom/2+"px";				
		iconDown.style.width= 50-do_zoom+"px";
		iconDown.style.height= 50-do_zoom+"px";			
	}
		
}




/************************[stextScroller]**************************************/

function hex(r,g,b) {
esadec='0123456789ABCDEF';
r2=Math.floor(r/16)
stringar=esadec.charAt(r2)
r1=(r%16)
stringar+=esadec.charAt(r1)
r2=Math.floor(g/16)
stringar+=esadec.charAt(r2)
r1=(g%16)
stringar+=esadec.charAt(r1)
r2=Math.floor(b/16)
stringar+=esadec.charAt(r2)
r1=(b%16)
stringar+=esadec.charAt(r1)
stringa='#'
stringa+=stringar
return stringa
}


var vn=0, obj, text, c, os, osWidth;

/*function col(){
	if(vn>-osWidth) vn--; else vn=0;
	
	for (var i=0;i<text.length; i++)
	{	
		var xx= vn+i*6;
		if (xx>0 && xx<260){
		    c++;
			o = document.getElementById('tx'+i);	  
			k=150+(c*2)%105;
			o.style.color = hex(k,k,k);		
		}
		else c = 0;
	}
	os.style.left = vn+"px";
	if (vn==0)
	setTimeout("col()",1000);
	else
	setTimeout("col()",25);
}*/
function col(){
	if(vn>-osWidth) vn--; else vn=0;
	os.style.left = vn+"px";
	if (vn==0)
	setTimeout("col()",1000);
	else
	setTimeout("col()",15);
}
function startcol(){
 obj = document.getElementById('scrollTxt');
 /*text = obj.innerHTML;
 opt="";
	for (var i=0;i<text.length; i++)
	{
		ch = text.charAt(i);
		if (ch==' ') ch="&#160;";
		opt+="<div id=tx"+i+" style=\"display:inline;\">"+ch+"</div>";
	}
	obj.innerHTML=opt;*/
	os = document.getElementById('scroll');
	osWidth = os.clientWidth
	col();
}


/*_____________________LINK ANIM________________________________*/

var objH2, objH2v=380;
function moveLinkUp(){
	if(objH2v>0) 
	{
		objH2v-=4; 	
		objH2.style.top = objH2v+"px";	
		setTimeout("moveLinkUp()",15);
	}
}
function moveLinkDown(){
	if(objH2v<400) 
	{
		objH2v+=10; 
		objH2.style.top = objH2v+"px";	
		setTimeout("moveLinkDown()",15);
	}	
}
function moveLinkInit(){
	objH2 = document.getElementById("linkBox");
	objH2.style.top = "400px";
	objH2.style.visibility = "visible";
	document.getElementById("cnt").onclick = function(){moveLinkDown()}
}