/**
 * @author Antonello MAsini 
 * 
 * www.wmamba.it
 */

var logo=null;
var r=255;g=150;b=0;
var r1="";g1="";b1="";
var color="";
var p=0;
var p1="";
var ctimer=null;
var sgn=1;
var tm=50;


function GrigioBianco(){
	if(r<255){
		r+=5;
	}else{
		clearInterval(ctimer);
		r=255;
		ctimer=setInterval("BiancoGiallo()",tm);
		//window.status="fine GrigioBianco: r="+r+"; g="+g+"; b="+b;
		return;
	}
	g=r;b=r;
	r1=r.toString(16);
	g1=g.toString(16);
	b1=b.toString(16);
	if (r1.length==1)r1="0"+r1
	if (g1.length==1)g1="0"+g1
	if (b1.length==1)b1="0"+b1
	color="#"+r1+g1+b1;
	logo.style.backgroundColor=color;
}

function BiancoGiallo(){
	if(b>0){
		b--;
	}else{
		clearInterval(ctimer);
		ctimer=setInterval("GialloRosso()",tm);
		//window.status="fine Bianco giallo: r="+r+"; g="+g+"; b="+b;
		return;
	}
	b1=b.toString(16);
	if (b1.length==1)b1="0"+b1
	color="#ffff"+b1;
	logo.style.backgroundColor=color;
}

function GialloRosso(){
	if(g>0){
		g--;
	}else{
		clearInterval(ctimer);
		r=250;
		ctimer=setInterval("RossoNero()",5);
		return;
	}
	g1=g.toString(16);
	if (g1.length==1)g1="0"+g1
	color="#ff"+g1+"00";
	logo.style.backgroundColor=color;
}

function RossoNero(){
	if(r>0){
		r--;
	}else{
		clearInterval(ctimer);
		ctimer=setInterval("GrigioBianco()",5);
		return;
	}
	r1=r.toString(16);
	if (r1.length==1)r1="0"+r1
	color="#"+r1+"0000";
	logo.style.backgroundColor=color;
}

function RossoGrigio(){
	if(r>100){
		r--;
	}else{
		clearInterval(ctimer);
		ctimer=setInterval("GrigioBianco()",5);
		return;
	}
	if(g<100){
		g++;b=g;
	}
	r1=r.toString(16);
	g1=g.toString(16);
	b1=b.toString(16);
	if (r1.length==1)r1="0"+r1
	if (g1.length==1)g1="0"+g1
	if (b1.length==1)b1="0"+b1
	color="#"+r1+g1+b1;
	logo.style.backgroundColor=color;
}




