$(document).ready(function() {
	var w = $(this).width()
	$('#header_bg').width(w-220)
	$("#menu").lavaLamp({
		fx: "backout", 
		speed: 800,
		click: function(event, menuItem) {
			return false;
		}
	});
})



/* attach onload event start */
if ( typeof(window.onload) != "function" ) {
    window.onload = mainOnLoad;
} else {
    
    var oldOnLoad = window.onload;
    window.onload = function() {
        oldOnLoad();
        mainOnLoad();
    };
}
/* attach onload event end */




/* mainOnLoad start */
function mainOnLoad() {
    adjustHeight();
}
/* mainOnLoad end */




/* getInnerDimension start */
function getInnerDimension() {
    var dimension = new Array();
    dimension["width"] = 0;
    dimension["height"] = 0;
    
    if( typeof( window.innerWidth ) == 'number' ) {
        dimension["width"] = window.innerWidth;
        dimension["height"] = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        dimension["width"] = document.documentElement.clientWidth;
        dimension["height"] = document.documentElement.clientHeight;
    } 
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        dimension["width"] = document.body.clientWidth;
        dimension["height"] = document.body.clientHeight;
    }
    
    return dimension;
}
/* getInnerDimension end */




/* adjustHeight start */
function adjustHeight(){
    var innerDimension = getInnerDimension();
    var page = document.getElementById("wrapper");
    var footer = document.getElementById("always_bottom");
    
    if( !page || !footer )
        return;
    
    var pageHeight = (footer.style.position == "absolute") ? (page.offsetHeight + footer.offsetHeight) : page.offsetHeight;
    
    if( pageHeight <= innerDimension["height"] )
        footer.style.position = "absolute";
    else
        footer.style.position = "static";
    
    setTimeout("adjustHeight()", 100);
}
/* adjustHeight end */

