var selected=2;	

var scroll = new Fx.Scroll('maingallerycont',
		{
		wait: false,
		wheelStops:false,
		duration: 1000,
		transition: Fx.Transitions.Quad.easeOut,
		onComplete: function()
   		{
			if (selected>4) 
			{
				selected=1;
				scrollfast.toElement("mainpic1");
			}
			if (selected<1) 
			{
				selected=4;
				scrollfast.toElement("mainpic4");
			}			
   		}
		});


var scrollfast = new Fx.Scroll('maingallerycont',
		{
		wait: false,
		wheelStops:false,
		duration: 1,
		transition: Fx.Transitions.Quad.easeOut
		});

window.addEvent('domready', function() {
//jQuery(document).ready(function(){
selected=2;
scrollfast.toElement("mainpic2");
});



$('nextimagebutton').addEvent('click', function(event) {


	selected++;
	if (selected>5)	selected=1;
				
	togo="mainpic"+selected;
	scroll.toElement(togo);
});
$('previmagebutton').addEvent('click', function(event) {
	selected--;
	if (selected<0)	selected=4;


	togo="mainpic"+selected;
	scroll.toElement(togo);
		
});


