String.prototype.trim = function () {
    var s = this.replace(/^\s*/, "");
    return s.replace(/\s*$/, "");
}
	
function setPosition() {
	if ($('container').getSize().y < window.getSize().y - 100) {
		var footerTop = window.getSize().y - $('footer').getSize().y - parseInt($('footer').getStyle('margin-top'));
		$('footer').setStyle('top', footerTop);
	}
	$('footer').setStyle('visibility', 'visible');
}

window.addEvents({
	'domready': function() { 
		$$('.headButton', '#linkmatrix td').addEvents({
			'click': function() {
				link = this.getElement('a');
				if (link) top.location.href = link.get('href');
			},
			
			'mouseover': function() { 
				link = this.getElement('a');
				
				if (link) {
					link.setStyle('color', '#ffffff');
					this.setStyle('background-color', '#f68a33'); 
					this.setStyle('cursor', 'pointer'); 
				}
			},
			'mouseout': function() { 
				link = this.getElement('a');
				if (link) {							
					link.setStyle('color', '#f68a33');
					this.setStyle('background-color', '#ffffff'); 
					this.setStyle('cursor', 'auto');
				} 
			}
		});
	},
	'load': function() { setPosition(); },
	'resize': function() { setPosition(); }
});