

function preloadimages(){

	if (document.images) {
		menu_products = new Image
		menu_shop = new Image
		menu_custom = new Image
		menu_contact = new Image
		menu_products_o = new Image
		menu_shop_o = new Image
		menu_custom_o = new Image
		menu_contact_o = new Image
		
		
		menu_products.src = "ui/m_products.gif"
		menu_shop.src = "ui/m_shop.gif"
		menu_custom.src = "ui/m_custom.gif"
		menu_contact.src = "ui/m_contact.gif"
		menu_products_o.src = "ui/m_products_o.gif"
		menu_shop_o.src = "ui/m_shop_o.gif"
		menu_custom_o.src = "ui/m_custom_o.gif"
		menu_contact_o.src = "ui/m_contact_o.gif"
		
	}
}


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



				
function setFooter() {
	var windowWidth = getWindowWidth();
	var windowHeight = getWindowHeight();
	var contentHeight = document.getElementById('container').offsetHeight;
	var footerElement = document.getElementById('footer');
	var footerHeight  = footerElement.offsetHeight;
	var footerWidth  = footerElement.offsetWidth;
	
	//alert("win:"+windowHeight+" container:"+contentHeight)
	
	
	if (windowHeight - (contentHeight + footerHeight) >= 0) {
		
		//footerElement.style.padding = 100 + 'px';
		//footerElement.style.marginTop = (windowHeight - (contentHeight + footerHeight)) + 'px';
		
		document.getElementById('spacer').style.height = (windowHeight - contentHeight - footerHeight) + 'px';
	}else {
		footerElement.style.top = '0px';
	}
	
	/*
	if (windowHeight - (contentHeight + footerHeight) >= 0) {
		
		footerElement.style.marginTop = (windowHeight - contentHeight - footerHeight) + 'px';
		
		
		//document.getElementById('container').style.height = windowHeight+'px';
		//document.getElementById('container').style.height = windowHeight - footerHeight+'px';
		//document.getElementById('footer').style.marginTop = '100px';
		
		//alert("smaller")
		
		
	}else {
		//footerElement.style.top = (contentHeight - 24) + 'px';
	}
	*/
	//alert("win:"+windowHeight+" cont:"+contentHeight)
	//alert(windowWidth)
	
}





function setFooterORIG() {
	var windowHeight = getWindowHeight();
	var contentHeight = document.getElementById('container').offsetHeight;
	var footerElement = document.getElementById('footer');
	var footerHeight  = footerElement.offsetHeight;
	
	if (windowHeight - (contentHeight + footerHeight) >= 0) {
		footerElement.style.top = (windowHeight - footerHeight) + 'px';
	}else {
		footerElement.style.top = (contentHeight - 24) + 'px';
	}
}

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 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;
}






			

