// JavaScript Document
function fontPlus()
{
	var att = $("div#testo").css("font-size");
	att = parseInt(att.substr(0,2));
	if (att < 16)
		$("div#testo").css("font-size",(att+1)+"px");
}

function fontMinus()
{
	var att = $("div#testo").css("font-size");
	att = parseInt(att.substr(0,2));
	if (att > 10)
		$("div#testo").css("font-size",(att-1)+"px");
}

$(document).ready(function()
{
	$("#b4").hover(
		function()
		{
			$("div#s4").dequeue();
			
			$("div#s4").animate({left: 130, top: 174},200);
		},
		function()
		{
			$("div#s4").dequeue();
			$("div#s4").animate({left: 208, top: 208},200);
		}
	);
	var temp;
	var interval;
	/*
	var i = 1;
	function siti()
	{
		id = "#s"+i;
		$(id).animate({fontSize: "18px"},500);
		$(id).css("text-shadow","0px 0px 5px #FFF");
		
		setTimeout(function()
		{
			$(id).animate({fontSize: "12px"},500);
			$(id).css("text-shadow","0px 0px 0px");
		},2500);
		
		if (i <= 7)
			i++;
		else i = 1;
	}
	setTimeout(function(){interval = setInterval(siti,2600);},1000);
	var tempScrollTop, currentScrollTop = 0; 
	
	$(document).scroll(function(){ 
		
		currentScrollTop = $(document).scrollTop();
		if (tempScrollTop < currentScrollTop ) 
			//$("div#vMenu").css("margin-top",(substr(0,($("div#vMenu").css("margin-top").length-2)+5)+"px"));
			alert($("#vMenu").css("margin-top"));
		else if (tempScrollTop > currentScrollTop ) 
			$("div#vMenu").css("margin-top",(substr(0,($("div#vMenu").css("margin-top").length-2)-5)+"px"));
		
		tempScrollTop = currentScrollTop; 
	});*/
	var width = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;

	setTimeout(function()
	{
		$("#bagliore img").animate({left: width+"px"},2500);
		$("#bagliore img").animate({left: "-140px"},0);
		$("#bagliore img").animate({left: width+"px"},2500);
		$("#bagliore img").animate({left: "-140px"},0);
	},2500);

	setInterval(function()
	{
		$("#bagliore img").animate({left: width+"px"},2500);
		$("#bagliore img").animate({left: "-140px"},0);
		$("#bagliore img").animate({left: width+"px"},2500);
		$("#bagliore img").animate({left: "-140px"},0);
	},8000);
	

	var pathname = window.location.pathname;
	var url = pathname.split("/");
	if (url.length < 4)
	{
		setTimeout(function()
		{
		$("#siti").stop().animate({height:'50px'},{queue:false, duration:1600, easing: 'easeOutBounce'});
		},900);
	}
	else
	{
		
		var aperto = false;
		$("#soluzioni").hover(
			function()
			{
				if (!aperto)
					$("#siti").stop().animate({height:'15px'},{queue:false, duration:1000});
			},
			function()
			{
				if (!aperto)
					$("#siti").stop().animate({height:'0px'},{queue:false, duration:1000});
			}
		);
				
		$("#soluzioni").bind("click",function()
		{
			if (aperto)
			{
				$("#siti").stop().animate({height:'0px'},{queue:false, duration:1000});
				aperto = false;
			}
			else
			{
				$("#siti").stop().animate({height:'50px'},{queue:false, duration:1000});
				aperto = true;
			}
		});
	}
	
	$("#vMenu").find("a").hover(
		function()
		{
			$(this).dequeue();
			$(this).find("img").attr("src","../img/sfera-h.png");
		},
		function()
		{
			$(this).dequeue();
			$(this).find("img").attr("src","../img/sfera.png");
		}
	);
	/*
	setTimeout(
	function()
	{
		$("#header").animate({ marginLeft: (-900 +"px")}, 500 );
	},3000)
	
	var altezza = $("div#contentGeneral").css("height");	
	var meta = (altezza.substr(0,(altezza.length-2))/2)+"px";
	*/
	
	$(".menu2D").hover(
		function()
		{
			$(this).css("background","url(../img/bD.png) right");
			$(this).stop().animate({
				width: '240px'
		  }, 500);
		},
		function()
		{
			$(this).stop().animate({
				width: '205px'
		  	}, 500);

			$(this).css("background","url(../img/gD.png) right");
		}
	);
	
	$(".menu2S").hover(
		function()
		{
			$(this).css("background","url(../img/bS.png) left");
			$(this).stop().animate({
				width: '240px'
		  }, 500);
		},
		function()
		{
			$(this).stop().animate({
				width: '205px'
		  	}, 500);

			$(this).css("background","url(../img/gS.png) left");
		}
	);
	
	//alert($("div#contentGeneral").css("height")+" - "+$("div#vMenu").css("height"));
});
