$(document).ready(function(){

	// sets the menu to the centered position with some space to the border
	var _left = $("#frame").css("margin-left") ; 
	_left = parseInt(_left) ; // left comes in format: 123px
        _left = _left + $("#frame").position().left;

	$("div#page_menu").css({ left: (_left+ 100)+'px' });  
	$("div#info_design").css({ left: (_left+ 100)+'px' });  


	// delete fade-areas if vierport.width is too small (1024 + fade width)
	if (window.innerWidth >= 1164) {
		//_left = _left - parseInt($("div#fade_left").css("width"));
		$("div#fade_left").css({ left: _left+'px' });  
		$("div#fade_right").css({ right: _left+'px' });  
	} else {
		$("div#fade_left").remove();
		$("div#fade_right").remove();
	}

	// height of background div (letztes div: top+height+margin+20px to be save
	var _height = $("#content_contact").position().top + parseInt($("#content_contact").css("height")) + parseInt($("#content_contact").css("margin-top")) + parseInt($("#content_contact").css("margin-bottom")) +
	20;
	$("#page_content").css({height: _height+'px'});


	// scroll to selected menu item
	$("span.menu_link").click(function(event){

		var _$target = $(this).attr("title");
		var _$targetAnchor = $("div#"+_$target);

		$.scrollTo( _$targetAnchor, 1);

	});

});

