// JavaScript Document

var Scrolling = {
	
	init: function(){
		// if necessary objects exists: 
		// call the init function onload (ev. link in the style sheet)
		// and set up the scrolling settings
	  	if(dw_scrollObj.isSupported()){
		  	//dw_writeStyleSheet('css/scroll.css');
		  	dw_Event.add(window, 'load', Scrolling.init_dw_scroll);
			Scrolling.scrolling_settings();
	  	}
	},
	
	init_dw_scroll: function(){
		var wndo = new dw_scrollObj('scroll_images', 'scroll_first_layer', 'scroll_images_container');
		wndo.setUpScrollControls('scroll_links');
	},
	
	scrolling_settings: function(){
		if($('scroll_links')){
			if($$('#scroll_images_container tr td').getElements('img').length < 2){
				$$('#scroll_links span').setStyle('display', 'none');
				//$('scroll_images').setStyle('height', '356px');
				//$('scroll_first_layer').setStyle('height', '356px');
				$('scroll_links').setStyle('margin', '0px 0px 25px 0px');
			}else{
				$('scroll_image_caption').setStyle('display', 'none');
				$('scroll_links').setStyle('margin', '19px 0px 25px 0px');
			}	
		}
	}
	
}

// Mootools DOM ready
window.addEvent('domready', function(){
		if($('scroll_images') && $('scroll_first_layer') && $('scroll_images_container')){
			Scrolling.init();
		}
	}
);
