// Tilapia javascript library

// requires Prototype javascript library

function preparePage()	{
	/*
	var pageHeight = document.viewport.getHeight();
	containerHeight = $('container').getHeight();
	var containerMarginTop = (pageHeight - containerHeight) / 2;
	$('container').setStyle({ marginTop: containerMarginTop + 'px' });
	$('container').show();
	*/
	Event.observe('pressKit', 'click', function() { location.href= 'pressKit.html'; });
	Event.observe('buyDVD', 'click', function() { location.href= '/shop/catalog/'; });
	Event.observe('screenings', 'click', function() { location.href= 'screenings.html'; });
	Event.observe('reviewsAndAwards', 'click', function() { location.href= 'reviewsAndAwards.html'; });
	if($('saveSonnysSea'))	{
		Event.observe('saveSonnysSea', 'mouseover', function() { $('saveSonnysSea').setAttribute('src', 'images/savethesea_button_HIT.png'); });
		Event.observe('saveSonnysSea', 'mouseout', function() { $('saveSonnysSea').setAttribute('src', 'images/savethesea_button_NOR.png'); });
	}
	if($('previousScreenings'))	{
		Event.observe('previousScreenings', 'mouseover', function() { $('previousScreenings').setAttribute('src', 'images/previousHIT.png'); });
		Event.observe('previousScreenings', 'mouseout', function() { $('previousScreenings').setAttribute('src', 'images/previousNOR.png'); });
	}
}
function mover(node) {
	moutAll();
	$(node + 'On').show();
}
function moutAll() {
	$('filmOn').hide();
	$('placeOn').hide();
	$('peopleOn').hide();
	$('filmmakersOn').hide();
	$('trailerOn').hide();
}
var Popup = {
	open: function(options) {
		this.options = {
			url: '#',
			width: 300,
			height: 300
		}
		Object.extend(this.options, options || {});
		window.open(this.options.url, '', 'width=' + this.options.width + ',height=' + this.options.height + ',top=100,left=300,location=no');
	}
}
// scroll the element vertically based on its width and the slider maximum value
function scrollVertical(value, element, slider) { 
	element.scrollTop = Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight)); 
}

