function DrawLine(divID,cssProperty,startValue,endValue,duration) {
	var OrizontalLineFX = new Fx.Tween(divID, { 
		property: cssProperty, 
		duration: duration, 
		transition: Fx.Transitions.Quart.easeInOut
	});

	$(divID).setStyle(cssProperty,0);
	$(divID).setStyle('opacity',1);

	OrizontalLineFX.start(startValue,endValue);
}

function ShowItemWithFade(divID, duration) {
	var divFX = new Fx.Tween(divID, {
		property: 'opacity', 
		duration: duration, 
		transition: Fx.Transitions.Quad.easeOut
	});
	divFX.start(1);
}

function MenuDynamic(){
	var buttons = $$('#menu li img');
	var fx = new Fx.Elements(buttons, {wait: false, duration: 200, transition: Fx.Transitions.Quart.easeOut});
	buttons.each(function(button, i){
		button.addEvent('mouseenter', function(e){
			var obj = {};
			
			if (i<=7) {
				obj[i] = {
					'margin-top': [button.getStyle('margin-top').toInt(), -3] ,
					'padding-bottom': [button.getStyle('padding-bottom').toInt(), 3]
				};
			}
			// resetto tutti gli altri
			buttons.each(function(other, j){
				if (j!=i) {
					obj[j] = {
						'margin-top': [other.getStyle('margin-top').toInt(), 0] ,
						'padding-bottom': [other.getStyle('padding-bottom').toInt(), 0]
					};
				}
			});
			
			fx.start(obj);
		});
	
		button.addEvent('mouseleave', function(e){
			var obj = {};
			// resetto tutti gli altri
			buttons.each(function(other, j){
				if (j<=7) {
					obj[j] = {
						'margin-top': [other.getStyle('margin-top').toInt(), 0] ,
						'padding-bottom': [other.getStyle('padding-bottom').toInt(), 0]
					};
				}
			});
			fx.start(obj);
		});
	
	});
	
}

function ShowMenu() {
	var timer = 0;
	var sideblocks = $$('#menu li a');
	
	var slidefxs = [];
	var colorfxs = [];
	
	sideblocks.each(function(el, i){
		el.setStyle('opacity', '0');
		timer += 150;
		slidefxs[i] = new Fx.Tween(el, {
			property: 'opacity',
			duration: 4000,
			transition: Fx.Transitions.backOut,
			wait: false
		});
		slidefxs[i].start.delay(timer, slidefxs[i], 1);

	}, this);
}



function MoveDIV(divID,cssProperty,startValue,endValue,duration) {
	var DivFX = new Fx.Tween(divID, {
		property: cssProperty,
		duration: duration, 
		transition: Fx.Transitions.Back.easeOut // Bounce.easeOut
	});
	// $(divID).effect(cssProperty).set(0);
	//$(divID).effect(cssProperty).set(endValue);
	
	if (startValue != null) {
		DivFX.start(startValue,endValue);
	}else {
		DivFX.start(endValue);
	}
}


NumeroPaneDefault=1;

// Precaricamento delle immagini
BottoneImgOff=new Image();
BottoneImgOff.src="immagini/marker_off.gif";
BottoneImgOver=new Image();
BottoneImgOver.src="immagini/marker_on.gif";

function OverPaneButton(numero) {
	if (numero != NumeroPaneDefault) {
		document.getElementById( 'pane_' + String(numero) ).src=BottoneImgOver.src;
  		if (NumeroPaneDefault!=0) {  		
			document.getElementById( 'pane_' + String(NumeroPaneDefault) ).src=BottoneImgOff.src;
  		}
  	}
	// window.status=BottoneDescr[numero];
}

function OutPaneButton(numero) {
	if (numero != NumeroPaneDefault) {
  		document.getElementById( 'pane_' + String(numero) ).src=BottoneImgOff.src;
  		if (NumeroPaneDefault!=0) { 
			document.getElementById( 'pane_' + String(NumeroPaneDefault) ).src=BottoneImgOver.src;  
  		}
  	}
  	// window.status="";
}

function ClickPaneButton(numero) {
	OverPaneButton(numero);
	MoveDIV('photobrowser-content','margin-left',null,-(numero-1)*200,1000);
	NumeroPaneDefault=numero;
}

function ClickLeftButton() {
	if (NumeroPaneDefault>1) {
		ClickPaneButton(NumeroPaneDefault-1);	
	}
}

function ClickRightButton() {
	if (NumeroPaneDefault<3) {
		ClickPaneButton(NumeroPaneDefault+1);
	}
}



function ApriFinestraPrivacyPolicy(pageURL) {
	finestra=window.open(pageURL,'PrivacyPolicy','resizable=yes,scrollbars=yes,status=no,top=20,left=20,width=620,height=560');
	finestra.focus();
}

