// JavaScript Document
var Box_Scroll_Inner;
var InitScroll = 0;
var lastCat = '';

function scrollNext(){
	var toScroll = InitScroll + $('ListImages').getSize().x;
	var maxScroll = $('ListImages').getScrollSize().x - $('ListImages').getSize().x;
	if (toScroll > maxScroll){
		toScroll = maxScroll;
	}
	InitScroll = toScroll;
	var myScroll = new Fx.Scroll('ListImages', {
		wait: false,
		duration: 1500,
		transition: Fx.Transitions.Cubic.easeInOut
		//transition: Fx.Transitions.linear
	});
	myScroll.start(toScroll, false);
}
function scrollPrev(){
	var toScroll = InitScroll - $('ListImages').getSize().x;
	if(toScroll < 0){toScroll = 0};
	InitScroll = toScroll;
	var myScroll = new Fx.Scroll('ListImages', {
		wait: false,
		duration: 2500,
		transition: Fx.Transitions.Cubic.easeInOut
	});
	myScroll.start(toScroll, false);
}

function clearInput(idObject) {
	getRef(idObject).value = "";
}

function openCloseLinkHome(x){
	if($('list_cat_'+x)) $('list_cat_'+x).toggleClass('active');
	Box_Scroll_Inner.refresh();
	window.location.href='#cat_'+x;
}

function openCloseLink(x){
	if($('list_cat_'+x)) $('list_cat_'+x).toggleClass('active');
	//window.location.href='#cat_'+x;
}

function openCloseCat(id){
	
	if (lastCat != id) {
		if($(lastCat)) $(lastCat).toggleClass('active');
		if($('link-'+lastCat)) $('link-'+lastCat).toggleClass('active');

		if($(id)) $(id).toggleClass('active');
		if($('link-'+id)) $('link-'+id).toggleClass('active');
	
		lastCat = id;

	} else {

		if($(id)) $(id).toggleClass('active');
		if($('link-'+id)) $('link-'+id).toggleClass('active');
	
		lastCat = '';
	
	}
	
}

function openClose(id){
	if($(id)) $(id).toggleClass('active');
}

Shadowbox.loadSkin('classic', '/javascript/shadowbox/skin');
Shadowbox.loadLanguage('it', '/javascript/shadowbox/lang');
Shadowbox.loadPlayer(['flv', 'img', 'swf', 'html', 'iframe'], '/javascript/shadowbox/player');
window.onload = function(){
    Shadowbox.init();
};

window.addEvent('domready', function() {  
	/* Barre di scorrimento */
	if ($('Box_Scroll_Inner')) Box_Scroll_Inner = new MooScroll({selector:'#Box_Scroll_Inner', disabledOpacity: 0});
});

