var img = null;
var paper = null;
var circle = null;
var luce = null;
var mask = null;
window.onload = function(){
	/*document.body.setAttribute("style", "overflow:hidden;");
	var divBgAnim = document.createElement("div");
	divBgAnim.setAttribute("id", "bg_anim");
	divBgAnim.setAttribute("style", "background-color:#000; position:absolute; filter:alpha(opacity=70); opacity: 0.7; -moz-opacity:0.7; width:100%; z-index:999; top:0px; left:0px; height:" + getEntireDocumentHeight() + "px");
	document.body.appendChild(divBgAnim);*/
	paper = new Raphael("canvas", 640, 480);
	var candela  = paper.image("http://www.ristorodelbrigante.it/media/images/animation/flames.gif", 203, 250, 15, 22);
	candela.toFront();
	
	img = paper.image("http://www.ristorodelbrigante.it/media/images/animation/ristoro.png", 0, 52, 640, 428);
	effettoIniziale();	
}

function effettoIniziale(){
	mask = paper.image("http://www.ristorodelbrigante.it/media/images/animation/mask.png", -290, -220, 1000, 1000);
	luce = paper.image("http://www.ristorodelbrigante.it/media/images/animation/luce.png", 190, 240, 40, 40);
	luce.animate({
		scale: 2,
	}, 3000, "bounce", function(){
		effettoLuce();
	});
}

function effettoLuce(){
	mask.animate(
		{
			scale:15,
		},
		10000,
		"<",
		function(){
			/*document.body.removeChild(document.getElementById("video_container"));
			document.body.removeChild(document.getElementById("bg_anim"));
			document.body.setAttribute("style", "overflow:auto;");*/
			window.location = "http://www.ristorodelbrigante.it/index.php/home";
		}
	);
}

function getEntireDocumentHeight(){
	var body = document.body, html = document.documentElement;
	return Math.max( body.scrollHeight, body.offsetHeight, 
                       html.clientHeight, html.scrollHeight, html.offsetHeight );
}
