(function ($) {
  Drupal.behaviors.chd7_theme = {
    attach: function (context, settings) {
      /*$('.view-id-chd_marketplace_featured .views-field-field-vendor-items a').hover(
        function () {
          $(this).prepend('<div class="view-hover">view</div>');
        }, 
        function () {
          $(this).find("div.view-hover").remove();
        }
      );*/
      /*
      $('.view-id-chd_inspiration_room .views-field-field-gallery-image a').hover(
        function () {
          $(this).prepend('<div class="view-hover">view rooms</div>');
        }, 
        function () {
          $(this).find("div.view-hover").remove();
        }
      );*/
      
      /*$('.view-id-chd_magazine .views-field-field-magazine-cover a, .view-id-chd_house_tours .views-field-field-gallery-image a').hover(
        function () {
          $(this).prepend('<div class="view-hover">look inside</div>');
        }, 
        function () {
          $(this).find("div.view-hover").remove();
        }
      );*/
      
      $('.view-id-chd_magazine .views-view-grid td .cell-container, .view-id-chd_house_tours .views-view-grid td .cell-container, .view-id-chd_house_tour_detail .views-view-grid td .cell-container, .view-id-chd_house_tour_rooms .views-row').hover(
        function () {
          $cell = $(this);
          $cell.children('div:first-child').find('img').before('<div class="view-hover">look inside</div>');
          $cell.addClass('hovered');
        }, 
        function () {
          $cell = $(this);
          $cell.find("div.view-hover").remove();
          $cell.removeClass("hovered");
        }
      );
      
      $('.view-id-chd_inspiration_room .views-view-grid td .cell-container, .view-id-chd_inspiration_room_detail .views-view-grid td .cell-container, .view-id-chd_inspiration_rooms_rooms .views-row').hover(
        function () {
          $cell = $(this);
          $cell.children('div:first-child').find('img').before('<div class="view-hover">view rooms</div>');
          $cell.addClass('hovered');
        }, 
        function () {
          $cell = $(this);
          $cell.find("div.view-hover").remove();
          $cell.removeClass("hovered");
        }
      );
      
      $('.view-id-chd_marketplace_featured .views-view-grid td .cell-container, .view-id-chd_product_finds_more .views-view-grid td .cell-container, .view-id-chd_blog_related .views-view-grid td .cell-container, .view-id-chd_front_featured_product_fins .views-row').hover(
        function () {
          $cell = $(this);
          $cell.children('div:first-child').find('img').before('<div class="view-hover">view</div>');
          $cell.addClass('hovered');
        }, 
        function () {
          $cell = $(this);
          $cell.find("div.view-hover").remove();
          $cell.removeClass("hovered");
        }
      );      
      
      $('.view-id-chd_magazine .views-view-grid td .cell-container, .view-id-chd_house_tours .views-view-grid td .cell-container, .view-id-chd_inspiration_room .views-view-grid td .cell-container, .view-id-chd_inspiration_room_detail .views-view-grid td .cell-container, .view-id-chd_house_tour_detail .views-view-grid td .cell-container, .view-id-chd_marketplace_featured .views-view-grid td .cell-container, .view-id-chd_marketplace_featured .views-view-grid td .cell-container, .view-id-chd_product_finds_more .views-view-grid td .cell-container, .view-id-chd_blog_related .views-view-grid td .cell-container, .view-id-chd_inspiration_rooms_rooms .views-row').click(function(){
        window.location.href = $(this).find('img').parents('a').attr('href');
      });
      
      
      
      $('.view-id-chd_house_tours_all_rooms .views-field-field-zoom-image, .view-id-chd_inspiration_rooms_all_rooms .views-field-field-zoom-image').hover(
        function () {
          $(this).find('.view-hover').show();
        }, 
        function () {
          $(this).find('.view-hover').hide();
        }
      );
      
      
      
      /*$('.view-id-chd_house_tours .views-field-field-gallery-image, .view-id-chd_house_tours .views-field-view-node,  .view-id-chd_house_tours .views-field-view-node a').bind({
        mouseenter : function (e) {
          e.stopPropagation();
          $(this).siblings('.views-field-view-node').show();
        }, 
        mouseleave :function (e) {
          e.stopPropagation();
          $(this).siblings('.views-field-view-node').hide();
        }
      });*/
      
      
      /*$('.zt-container, .node-type-house-tour-room .custom-pager').bind({
        mouseenter : function (e) {
          e.stopPropagation();
          //$(this).prepend('<div class="view-hover">look inside</div>');
          $('.node-type-house-tour-room .custom-pager .previous, .node-type-house-tour-room .custom-pager .next').show();
        }, 
        mouseleave : function (e) {
          e.stopPropagation();
          $('.node-type-house-tour-room .custom-pager .previous, .node-type-house-tour-room .custom-pager .next').hide();
        }
      });      
      
      $('.zt-container, .node-inspiration-rooms-room .custom-pager').bind({
        mouseenter : function (e) {
          e.stopPropagation();
          //$(this).prepend('<div class="view-hover">look inside</div>');
          $('.node-inspiration-rooms-room .custom-pager .previous, .node-inspiration-rooms-room .custom-pager .next').show();
        }, 
        mouseleave : function (e) {
          e.stopPropagation();
          $('.node-inspiration-rooms-room .custom-pager .previous, .node-inspiration-rooms-room .custom-pager .next').hide();
        }
      });*/      
             
    }
  }

}(jQuery));;

