/**
 * @author Daniele Corti - GESTWEB Research s.r.l. * All the contents of this file belog to GESTWEB Research s.r.l. - Italy
 */
 
 var scrollerFx;

 function setScroller(idBody, idHead){
 	
	if ($(idBody)) {
		scrollerFx = new Fx.Scroll($(idBody).getElement('.Big'));
		
		$$('#' + idBody + ' .Big div').each(function(item, index){
			item.setStyle('display', 'block');
			item.setStyle('margin-left', (item.getStyle('width').toInt() + item.getStyle('padding-left').toInt() + item.getStyle('padding-right').toInt()) * index);
			item.setProperty('id', 'position' + (index + 1));
		})
		
		$$('#' + idHead + " h2").each(function(item, index){
			if (index == 0) {
				item.addClass('active');
			}
			item.addEvent('click', function(){
				$$('#' + idHead + " h2").each(function(it, ind){
					if (ind == index) 
						it.addClass('active');
					else 
						it.removeClass('active');
				})
				goToId('position' + (index + 1));
			})
		})
		
	}
 }
 
 function goToId(id){
 	if(!scrollerFx)
		return;
		
	scrollerFx.cancel();
	scrollerFx.toElement(id);
 }
