$(document).ready(
	function()
	{
		$(window).resize(resized);
		$('nav li').click(navigate);
		$('body').append('<div id="topscroller"></div>');
		$('#topscroller').css(
			{
				width: $(window).width()
			}
		);
		
		$("a.gallery-image").fancybox({'hideOnContentClick': true});

		
		function navigate(event)
		{
			if(!$(event.target).hasClass('crossed'))
			{
				var target_id = $(event.target).attr('id').replace('nav-', '');
				
				var target_pos = $('#' + target_id).offset();
				
				//alert(target_pos.top + 220);
				
				$.scrollTo({top: target_pos.top - 220, left: 0}, 800);			
			}
		}
		
		if ($('#map').length)
		{
			function initialize()
			{
    			var latlng = new google.maps.LatLng(50.13646606931592, 8.161768913269043);
    			var map_options = {
      				zoom: 13,
     				center: latlng,
      				mapTypeId: google.maps.MapTypeId.TERRAIN,
      				mapTypeControl: false,
      				scaleControl: false,
      				navigationControl: true,
					navigationControlOptions:
					{
						style: google.maps.NavigationControlStyle.SMALL
					},
					streetViewControl: false 
    			};
    			
    			var map = new google.maps.Map(document.getElementById("map"), map_options);
    			var marker = new google.maps.Marker(
    			{
		      		position: latlng, 
					map: map
			  	});
  			}
			
			initialize();
		}
		
		function resized(event)
		{
			$('#topscroller').css
			(
				{
					width: $(window).width()
				}
			);
		}
	}
);
