window.addEvent('domready',function() {
    // gallery scrolling
    try {
		if (cur && maxi) {
			var scroll = new Fx.Scroll(window, {
				wait: false,
				duration: 500,
				offset: {'x': -50, 'y': -300},
				transition: Fx.Transitions.Quad.easeInOut
			});
			$('nav_lft').addEvent('click', function(event) {
				event = new Event(event).stop();
				if (cur > 1) {
					$('ref'+cur).removeClass('hgh');
					if (cur > 2) {
						scroll.toElement('ref'+(--cur));
					} else {
						cur = 1;
						scroll.toElement('ref1');
					}
					$('ref'+cur).addClass('hgh');
				}
			});
			$('nav_rgt').addEvent('click', function(event) {
				event = new Event(event).stop();
				if (cur < maxi) {
					$('ref'+cur).removeClass('hgh');
					scroll.toElement('ref'+(++cur));
					$('ref'+cur).addClass('hgh');
				}
			});
			$('nav_rst').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('nav');
				$('ref'+cur).removeClass('hgh');
				cur=1;
				$('ref'+cur).addClass('hgh');
			});
			$('ref'+cur).addClass('hgh');
		}
	} catch(e) {
		// no gallery
	}
});


