// JavaScript Document

var height = 0;
var imageHeight = 0;
var myFx = null;
var images;
var options = {
	top: 270,
	bottom: 32,
	images: 20,
	duration: 60*60*30
};

window.addEvent('domready', function() {
	setHeight();
	window.addEvent('resize', setHeight);
	
	var html = $('secondary_images_content').get('html');
	$('secondary_images_content').set('html', html+html+html+html+html+html+html+html+html);
	
	images = $('secondary_images_content').getSize();
	
	myFx = new Fx.Tween('secondary_images_content', {unit: 'px', duration: options.duration, transition: Fx.Transitions.linear});
	
	scrollImages();
	scrollImages.periodical(options.duration+25)
});

function scrollImages() {
	//secondary_images_content
	$('secondary_images_content').setStyles({
		'marginTop': height+'px'
	});
	
	var tmp = images.y+20;
	myFx.start('marginTop', '-'+tmp);
	
	//scrollImages.delay(options.duration+10);
}

function setHeight() {
	
	height = window.getHeight() - options.top - options.bottom;
	imageHeight = height-options.images
	
	$('content').setStyle('height', height+'px');
	$('secondary_images').setStyle('height', imageHeight+'px');
	
}