function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}


function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('content').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			}
			else {
				footerElement.style.top = '0px';
			}
		}
	}
}

function addOnload(f) {
	if (window.onload) {
		var fold = window.onload;
		window.onload = function() { fold(); f(); };
	}
	else {
		window.onload = f;
	}
}

//Event.observe(window, 'load', setFooter, false);
//Event.observe(window, 'resize', setFooter, false);

function preloadButtons() {
	var menu = $('menuu');
	var images = menu.getElementsByTagName("IMG");
	var img;


	for (var i = 0; i < images.length; i++) {
		if (images[i].rollover) {
			img = new Image();
			img.src = images[i].rollover;
			images[i].rollIn = img;
			img = new Image();
			img.src = images[i].src;
			images[i].rollOut = img;

			images[i].onmouseover = function() {
				this.src = this.rollIn.src;
			}

			images[i].onmouseout = function() {
				this.src = this.rollOut.src;
			}
		}
	}
}

function popup(url) {
	var windowHeight = screen.height;
	
	if (windowHeight >= 640) {
		wHeight = 640;
	}
	else {
		wHeight = 580;
	}
	
	window.open(url, 'popup', 'width=550,height=' + wHeight + ',scrollbars=1');
	return false;
}

function showEle() {
	for (var i = 0; i < arguments.length; i++) {
		var ele = $(arguments[i]);
		ele.style.display = '';
	}
}

function hideEle() {
	for (var i = 0; i < arguments.length; i++) {
		var ele = $(arguments[i]);
		ele.style.display = 'none';
	}
}

window.addEvent("domready", function() {
	var scroll = new Fx.Scroll('content');
	
	$('up').addEvent('mousedown', function(){ 
		scroll.toTop();
	} );
	
	$('up').addEvent('mouseup', function(){ 
		scroll.cancel();
	} );
	
	$('down').addEvent('mousedown', function(){ 
		scroll.toBottom();
	} );
	
	$('down').addEvent('mouseup', function(){ 
		scroll.cancel();
	} );
	
	$('content').addEvent('mousewheel', function(e) {
		var c = $('content');
		
		c.scrollTo(0, c.getScroll().y-(e.wheel*13) );
	});
});

//Event.observe(window, 'load', preloadButtons, false);

