window.onload = function(){

		var scrollContent;
		
		if(scrollContent = $('scrollContent')){		
			var steps = $('scrollBody').offsetHeight - 300;
			var curstep = 0;
			if(steps <= 0){
				steps = 0;
			}else{

				var scrollBar = document.createElement('div');
				scrollBar.id = "scrollBar";
				var scrollKnot = document.createElement('div');
				scrollKnot.id = "scrollKnot";
				
				scrollBar.appendChild(scrollKnot);
				scrollContent.parentNode.appendChild(scrollBar);

				mySlide = new Slider($(scrollBar), $(scrollKnot), {
					'steps': steps,
					'mode': 'vertical',
					'onChange': function(step){
						curstep = step;
						scrollContent.scrollTo(0, step);
					}
				}).set(0);
				
				function downClick(x){
					if(!x){ x = 1; }
					curstep+=(5*x);
					if(curstep > steps){ curstep = steps }
					mySlide.set(curstep);
				}

				function upClick(x){
					if(!x){ x = 1; }
					curstep-=(5*x);
					if(curstep < 0){ curstep = 0 }
					mySlide.set(curstep);
				}

				scrollContent.addEvent('mousewheel', function(event){
					event = new Event(event);
					
					if(window.opera){
						event.wheel *= -1;
					}
					
					if(event.wheel > 0){
						upClick(event.wheel);
					}else if(event.wheel < 0){
						downClick(event.wheel * -1);
					}
				});
			}
			
			$('scrollerArrUp').onclick = function(){ upClick(4); }
			$('scrollerArrDown').onclick = function(){ downClick(4); }
			
		}
		
		
		
		
		startGallery();
		
		/* menu */
		
		// Window.disableImageCache(); // Not sure it is required but I left it
	//	$('nav').getElements('a')
	
		var list = $$('#nav a');
		var listTitle = $$('#nav a span');
	//	alert(list);
		
		
		list.each(function(element) {		 
			var fx = new Fx.Styles(element, {duration:300, wait:false});		 
			element.addEvent('mouseenter', function(){
				fx.start({
					
					'padding-right': '15',				
					'color': '#793a17'
				});
			});
		 
			element.addEvent('mouseleave', function(){
				fx.start({
				
					'padding-right': '0',			
					'color': '#793a17'
				});
			});
		 
		});
		
		
		
		
		var footer_link = $('footer_link');
		var xy = 0;

		list.each(function(ell) {	
			if(xy == 0){
				link = new Element('a', {
					'styles': {
						'color': '#ac4927',
						'font-size': '11px',
						'text-decoration': 'none',
						'font-weight': 'normal',
						'border-left': '0px #ac4927 solid',
						'padding': '0 5px 0 10px'
					},
					'events': {
					   'mouseenter': function(){
				            this.setStyles({
							   'text-decoration': 'underline'
							});
				        },
						'mouseleave': function(){
				            this.setStyles({
							   'text-decoration': 'none'
							});
				        }
					},
					
					'href': list[xy]
				});
			}else{
				link = new Element('a', {
					'styles': {
						'color': '#ac4927',
						'font-size': '11px',
						'text-decoration': 'none',
						'font-weight': 'normal',
						'border-left': '1px #ac4927 solid',
						'padding': '0 5px 0 10px'
					},
					'events': {
					   'mouseenter': function(){
				            this.setStyles({
							   'text-decoration': 'underline'
							});
				        },
						'mouseleave': function(){
				            this.setStyles({
							   'text-decoration': 'none'
							});
				        }
					},
					
					'href': list[xy]
				});
			}
			
					
			
			link.appendText(listTitle[xy].getText());	
			
			footer_link.parentNode.appendChild(link);
			xy++;		 
		});
		
	
}

