var now = new Date();
var i = now.getTime();
var header;
var footer;

change = function ()
{
   i = i+0.01;
   var r = parseInt(Math.abs( 200 * Math.cos(i) ));
   var g = parseInt(Math.abs( 100 * Math.cos(2*i) ));
   var b = parseInt(Math.abs( 100 * Math.cos(3*i) ));

   var bg = 'rgb(' + r + ',' + g + ',' + b +')';

   header.style['background'] = bg;
   footer.style['background'] = bg;
}
start = function () 
{
   header = document.getElementById("header");
   footer = document.getElementById("footer");
   setInterval(change, 100);
   //change();
}

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 setHeight() {
	if (document.getElementById) {

		var windowHeight = getWindowHeight();

		if (windowHeight > 0) {

		   var wrap = document.getElementById('wrap');
		   var header = document.getElementById('header');
		   var content = document.getElementById('content');
   		var footer = document.getElementById('footer');


			if (windowHeight > header.offsetHeight + content.offsetHeight + footer.offsetHeight ) {
            wrap.style.height = (windowHeight)+'px';
            content.style.height = (windowHeight - header.offsetHeight - content.offsetHeight - footer.offsetHeight)+'px';
			} else
			{
            document.getElementById('footer').style.position = 'static';
			}
		}
	}
}

window.onload = function() {
	setHeight();
}
window.onresize = function() {
	setHeight();
}
