Drupal.behaviors.covenant_house = function (context) {
  $(".map").hide();
  $(".bar .toggle").click(function() {
    $(".map").slideToggle('slow', function() {
      $.scrollTo($('#sitemap'), 1000);
    });
    $(this).toggleClass("open");
    if($(this).is('.open')){
      $(this).html("Collapse Sitmap");
    }else{
      $(this).html("Expand Sitmap");
    }
  });
  
  $("#block-views-our_kids-block_1 .views-row").hover(
    function() {
      $("#block-views-our_kids-block_1 .views-row").removeClass("active");
      $(this).addClass("active");
    },
    function() {
      $(this).removeClass("active");
    }
  );
  
  $('#content blockquote, #content div.callout').wrapInner('<div class="wrapper"></div>');
  
  /**
   * @author:   Richard Castera
   * @date:     6/1/2010
   * @comments  Added back to top links to animate scrolling to the top
   **/
  $('p.back-to-top a').click(function() {
    $('html, body').animate({scrollTop:0}, 'slow');  
  });
  
  /**
   * @author:   Richard Castera
   * @date:     6/1/2010
   * @comments  Add an icon to pdf downloads - Requested by Molly
   **/
  $("a[href$='.pdf']").addClass('pdf_link_icon');
  
  /**
   * @author:   Richard Castera
   * @date:     6/15/2010
   * @comments  Modify Giving Options
   * @ticket    https://snac.sankyserver.com/projects/144/tickets/68
   **/
  $('#planned_giving_link a').click(function() {
    $('#planned_giving_options').slideToggle('fast', function() {
        if($('#planned_giving_options').is(':hidden')) {
            $('#planned_giving_link a').css('background-position', '200px 3px');
        }
        else {
            $('#planned_giving_link a').css('background-position', '200px -16px');
        }
    });  
  });
  
  $('#other_ways_to_give_link a').click(function() {
    $('#other_ways_to_give_options').slideToggle('fast', function() {
        if($('#other_ways_to_give_options').is(':hidden')) {
            $('#other_ways_to_give_link a').css('background-position', '200px 3px');
        }
        else {
            $('#other_ways_to_give_link a').css('background-position', '200px -16px');
        }
    });  
  });
}


function newWindow(url, title, width, height, scroll) {
    var left = (screen.width/2)-(width/2);
    var top = (screen.height/2)-(height/2);
    
    if(!scroll) {
        scroll = 'yes';
    }
    var targetWin = window.open (url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars='+scroll+', resizable=yes, copyhistory=no, width='+width+', height='+height+', top='+top+', left='+left);
} 