(function ($) {
  Drupal.behaviors.clicableRows = {
    attach: function(context) {
      //Klikkflater
      $(".views-row:has(.field):has(a)", context).not(".clickable").click(function(){
        window.location = $(this).find(".field a:first").attr("href")
      }).addClass("clickable");
    }
  };
 //Nytt vindu
jQuery(document).ready( function() {
   jQuery('.external,.field-name-field-vedlegg a,#block-block-6 a').click( function() {
        window.open(this.href);
        return false;
    });

});
//columns equal H
function equalHeight(group) {
   tallest = 0;
   group.each(function() {
      thisHeight = jQuery(this).height();
      if(thisHeight > tallest) {
         tallest = thisHeight;
      }
   });
  group.height(tallest+18);
};
jQuery(window).load(function() {
   equalHeight(jQuery("body.front .views-row article,body.context-front .views-row article,body.page-julefront .views-row article"));
});

//fade img
jQuery(document).ready(function(){
jQuery("#block-block-6 img,.view-articles-front img,.field-name-field-image-gallery img").fadeTo("slow", 1.0);
jQuery("#block-block-6 img,.view-articles-front img,.field-name-field-image-gallery img")
.hover(function(){
jQuery(this).fadeTo("slow", 0.4);
},function(){
jQuery(this).fadeTo("slow", 1.0);
});
});

})(jQuery);


(function($) {
  Drupal.behaviors.openlayers_gmap_grayscale = {
    'attach': function(context, settings) {
    var data = $(context).data('openlayers');
    if (data) {
      
      for (var key in data.openlayers.layers) {
        var layer = data.openlayers.layers[key];
        if (layer.CLASS_NAME == "OpenLayers.Layer.Google") {
          gmap = layer;
        }
      }      

      if (gmap) {
        var vj_style = [ 
          {
            featureType: "all",
            elementType: "all",
            stylers: [ { visibility: "on" }, { hue: "#9E0A0F" }, { saturation: -40 } ]
          }, {
            featureType: "road",
            elementType: "geometry",
            stylers: [{ visibility: "simplified" }, { lightness: -50 } ]
          }, {
            featureType: "water",
            stylers: [ { hue: "#00A7DA" }, { visibility: "on" }, { saturation: 50 } ]
          },
        ];

        var styledMapType = new google.maps.StyledMapType(vj_style, {name: "Vossa Jass"});

        gmap.mapObject.mapTypes.set('vj', styledMapType)
        gmap.type = 'vj';
        gmap.map.redraw;
      }

    }
  }
  };
})(jQuery);  
;

