// JavaScript Document
var working=0;
	
	
	function openfb(){
		if (working==1)
		return;
		working=1
		div = document.getElementById("scheda-facebook");
		div2 = document.getElementById("anim-fan");
		div.cont=0;
		div.limit=185;
		div.inc=8;
		div.freq=30;
		div.w=0;
		slidebox(div,div2,1);
	
	}
	
	function chiudifb(){
		if (working==1)
		return;
		working=1
		div = document.getElementById("scheda-facebook");
		div.cont=0;
		div.limit=185;
		div2 = document.getElementById("anim-fan");
		div.inc=8;
		div.freq=30;
		div.w=0;
		slidebox(div,div2,0);
	}
	
function slidebox(div,div2,direzione){
	if (direzione==0)
	{
		div.timer = setInterval(function()
		{
		riduci(div,div2);
		},div.freq);
	}
	else
	{
		div.timer = setInterval(function()
		{
		esplodi(div,div2);
		},div.freq);
	}
}
	
	function esplodi(div,div2){
	
	if(div.limit-div.w==0)
	{
		clearInterval(div.timer);
		div.style.width=(div.limit)+"px";
		div2.style.marginLeft="0px";
		working=0;
		bottfb(0);
	}
	else
	{
		/*div.style.display="block";*/
		div.res=Math.ceil((div.limit-div.w)/10)
		div.style.width=(div.w+div.res)+"px";
		div2.style.marginLeft=((div.limit-(div.w+div.res))*-1)+"px";
		div.w=div.w+div.res;
		}
	}
	function riduci(div,div2){
	if(div.limit-div.w==0){
		div.style.width="0px";
		div2.style.marginLeft="-185px";
		//div.style.display="none";
		clearInterval(div.timer);
		working=0;
		bottfb(1);
	}else{
		div.res=Math.ceil((div.limit-div.w)/10)
		div.style.width=(div.limit-(div.w+div.res))+"px";
		div2.style.marginLeft=((div.w+div.res)*-1)+"px";
		div.w=div.w+div.res;
	}
} 
function bottfb(dir){
	div = document.getElementById("botton-facebook");
if (dir==0)
	{
		div.val=-6;
		div.timer = setInterval(function()
		{
		nascondi(div,dir);
		},10);
	}
	else
	{
		div.val=-44;
		div.timer = setInterval(function()
		{
		nascondi(div,dir);
		},10);
	}
}
function nascondi(div, dir){
	if(dir == 0){
		if(div.style.marginLeft=="-44px"){
			clearInterval(div.timer);
		}else{
			div.val=div.val-2;
			div.style.marginLeft=div.val+"px";
		}
	}else{
		if(div.style.marginLeft=="-5px"){
			clearInterval(div.timer);
		}else{
			div.val=div.val+1;
			div.style.marginLeft=div.val+"px";
		}
		
		}
	}
function overfb(dir){
	div = document.getElementById("botton-facebook");
if (dir==0)
	{
		div.style.marginLeft = "0px";
	}
	else
	{
		div.style.marginLeft = "-5px";
	}
}
