$(function(){

$('#masonwrap').masonry({
	      itemSelector: '.mason',
		  isFitWidth: true,
			columnWidth: 40,
	      isAnimated: !Modernizr.csstransitions
});

$(".masonry-brick").click(function(){
		$(".masonry-brick .precontent").show();
		$(".masonry-brick .content").hide();
		$(".precontent",this).hide();
		$(".masonry-brick").removeClass("grid_8").addClass("grid_4");
		$(this).removeClass("grid_4");
		$(this).addClass("grid_8");
		$('#masonwrap').masonry();
		setTimeout(function(){ 
			$.scrollTo( '.grid_8', 800 )
		}, 1000);
		$(".content",this).fadeIn();
});
		
$(".close").click(function(){
			$(".masonry-brick .precontent").show();
			$(".masonry-brick .content").hide();
			$(".masonry-brick").removeClass("grid_8").addClass("grid_4");
			$('#masonwrap').masonry();
			return false;
});
		
$('#contact-button').click(function() {
  		$('#contact').animate({
    		height: 'toggle'
  		}, 800, function() {
    		// ingenting
		});

});
	
$('#contact-button').one('click', function() { initialize(); });

$(window).scroll(function() {
			if($(this).scrollTop() >= 60) {
				$('#toTop').fadeIn();	
			} else {
				$('#toTop').fadeOut();
			}
});
 
$('#toTop').click(function() {
			$('body,html').animate({scrollTop:0},800);
});	

});//END Function


function initialize() {
        var myOptions = {
      		zoom: 15,
      		center: new google.maps.LatLng(57.779476,14.159198),
      		mapTypeId: google.maps.MapTypeId.ROADMAP,
      		disableDefaultUI: true
    	}
        var stylez = [
    	{
      		featureType: "all",
      		elementType: "all",
      		stylers: [
        		{ saturation: -100 } // <-- THIS
      	]
    	}
		];
        var map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);
        var mapType = new google.maps.StyledMapType(stylez, { name:"Grayscale" });    
		map.mapTypes.set('tehgrayz', mapType);
		map.setMapTypeId('tehgrayz');
		
		
		var image = 'http://www.designministeriet.se/wp-content/themes/designministeriet/_inc/images/dm-pin2.png';
   		var myLatLng = new google.maps.LatLng(57.779476,14.159198);
    	var beachMarker = new google.maps.Marker({
        		position: myLatLng,
        		map: map,
      		 	icon: image
    		});
};


