// JavaScript Document

//-----------------------------------------

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 getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function getElementsByClassName(classname, node)  {
    if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function setFooter() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
		var windowWidth = getWindowWidth();
        if (windowHeight > 0 && windowWidth > 0) {
            
			var elems = getElementsByClassName('centerj');
			var marg = 0;
			
			windowWidth = windowWidth-1000;
			while(windowWidth > 1000)
			{windowWidth = windowWidth-1000;}
			
			marg = ((windowWidth/100)*2+1);
			if(marg < 0)
			{marg = 0;}
			
			for(var i=0,j=elems.length; i<j; i++)
			{elems[i].style.marginLeft = marg + '%';}
			
        }
    }
}

window.onload = function()
{
	setFooter();
}

window.onresize = function()
{
	setFooter();
}
