        window.addEvent('domready', function(){
			var scroll = new Fx.Scroll('scroller', {
				wait: false,
				duration: 500,
				offset: {'x': -0, 'y': -0},
				transition: Fx.Transitions.Quad.easeInOut
			});
		
		    var pos = 0;	
			var scrolls = $$('.section');
			
			var nexts = $$('.next');
			nexts.each(function(next,i){
			    next.addEvent('click',
			        function(event){
			            event = new Event(event).stop();
			            if(pos<scrolls.length -1)
			                {
			                pos++;
			                scroll.toElement(scrolls[pos].id);			        
			                }
			            else
			            {			        
			                pos=0;
			                scroll.toElement(scrolls[pos].id);
			            }   	        
    			        var clsRemove = $$('.section-controls');
							clsRemove.each(function(sec, j){
							sec.removeClass('on');
						});
			
						var ele = $('a'+pos);
						ele.addClass('on');
			        });
			});		
			
						
			var secBtn = $$('.section-controls');
		    
		    secBtn.each(function(section , i){
		    if( i < scrolls.length){		   
		    section.addEvent('click',
		    function(event){
		        event = new Event(event).stop();
		        scroll.toElement(scrolls[i].id);
		        var clsRemove = $$('.section-controls');
		            clsRemove.each(function(sec, j){
		                sec.removeClass('on');
		            });
		        section.addClass('on');
		        pos = i;
		        });		    
		        }
		    });						
			
		});


		window.addEvent('domready', function(){
		        new SmoothScroll();
		        });
		


				var moopop = {
				  width: 0,
				  height: 0,
				  
				  captureByRel: function(attrVal, parent) {
				    this.capture($ES('a', parent || document).filterByAttribute('rel', '*=', attrVal));
				  },

				  capture: function(el, width, height) {
				    if ($defined(width) && $defined(height)) {
				      this.width = width;
				      this.height = height;
				    }

				    switch ($type(el)) {
				      case 'element':
				        this.add_pop_to(el);
				        break;
				      case 'string':
				      case 'array':
				        $$(el).each( function(el) {
				          this.add_pop_to(el);
				        }, this);
				        break;
				    }

				    this.width = null;
				    this.height = null;
				  },

				  
				  add_pop_to: function(el) {
				    el.addEvent('click', function(e){ new Event(e).stop(); this.popup(el); }.bind(this));

				    var size = el.getAttribute('rel').match(/\[(\d+),\s*(\d+)\]/) || ['', this.width, this.height];

				    if (size[1]) el.setAttribute('popupprops', 'width=' + size[1] + ', height=' + size[2] );
				  },

				  
				  popup: function(el) {
				    window.open(el.href, '', el.getAttribute('popupprops') || '');
				  }
				};

				
				window.addEvent('domready', function () {
				  moopop.captureByRel('popup');
				});
