
$(document).ready(function () {
    $('img.menu_class').click(function () {
		var posArr=findPos(getElementIDFix('button'));
		$('#the_menu_overlay').css({'width':($(window).scrollLeft()+$(window).width()), 'height':($(window).scrollTop()+$(window).height()), 'left': '0', 'top':'0', 'display':'block'});
		$('ul.the_menu').css({'top':posArr[1]+24, 'left':posArr[0]});
		$('ul.the_menu').slideToggle(500);
    });
	
    $('#the_menu_overlay').click(function () {
		$('ul.the_menu').slideUp(500);
		$('#the_menu_overlay').css({'display':'none'});
    });

	var footposArr=findPos(getElementIDFix('footer'));
	if (footposArr[1] < 760) {
		$('#footer').css({'top':174});
	}
});

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
		curleft += obj.offsetLeft;
		curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
} 

function getElementIDFix(layerId)
{
	var elem;
	if( document.getElementById ){ // this is the way the standards work
		elem = document.getElementById(layerId);
	}else if( document.all ){ // this is the way old msie versions work
		elem = document.all[layerId];
	}else if( document.layers ){ // this is the way nn4 works
		elem = document.layers[layerId];
	}
	return elem;
}

