
(function ($) {
  Drupal.Panels = {};

  Drupal.Panels.autoAttach = function() {
    if ($.browser.msie) {
      // If IE, attach a hover event so we can see our admin links.
      $("div.panel-pane").hover(
        function() {
          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
        },
        function() {
          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
        }
      );
      $("div.admin-links").hover(
        function() {
          $(this).addClass("admin-links-hover"); return true;
        },
        function(){
          $(this).removeClass("admin-links-hover"); return true;
        }
      );
    }
  };

  $(Drupal.Panels.autoAttach);
})(jQuery);
;
/**
 * jquery.newsfade.1.0.js
 * 
 * A news rotator plugin for using with jQuery.
 *
 * Copyright (c) 2011 Muneer Saheed <muneer AT encodez DOT com>
 *
 * http://www.encodez.com/plugins/jquery/quick-news-fader.html
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
(function( $ ){
  $.fn.newsFade = function(options) {
    var properties = 
    {
      count         : 0
      ,current       : 0
      ,news_fader_t  : null
      ,component     : null
      ,items         : []
    }
    var defaults = {
      interval  : 5000
      ,style    : "fadeIn"
      ,limit    : 1
      ,auto     : false
      ,motionSpeed : 500
      ,height   : null
    };
    var options = $.extend(defaults, options);
    if (options.height !== null)
      $(this).find(".news-fade-wrapper").css({"height": options.height});
    var methods =
    {
      loopNews : function(arg) {
        $(properties.component).find("li").remove();
        properties.current = arg;
        for (var i = 0; i < options.limit; i++)
        {
          var tmpNews = '<li>' + 
                methods.getNews() + 
                '</li>';
          $(properties.component).find("ul").append(tmpNews);
        }
        $("ul", properties.component).hide();        
        switch(options.style) {
          case "fadeIn" :
            $(properties.component).find("ul").fadeIn(options.motionSpeed);
            break;
          case "slideDown" :
            $(properties.component).find("ul").slideDown(options.motionSpeed);
            break;
          default :
            $(properties.component).find("ul").fadeIn(options.motionSpeed);
        }        
        if (defaults.auto)
        {
          properties.news_fader_t = window.setTimeout(function(i) {
             methods.loopNews(properties.current);
          }, options.interval);
        }
      },
      prev : function() {
        properties.current = properties.current-2;
        clearTimeout(properties.news_fader_t);
        methods.loopNews(properties.current);
      },
      next : function() {
        clearTimeout(properties.news_fader_t);
        methods.loopNews(properties.current);
      },
      play : function() {
        clearTimeout(properties.news_fader_t);
        options.auto = true;
        methods.loopNews(properties.current);
      },
      item : function() {
        clearTimeout(properties.news_fader_t);
        options.auto = true;
        methods.loopNews(properties.current);
      },
      pause : function() {
        options.auto = false;
        clearTimeout(properties.news_fader_t);
      },
      getNews : function() {
        if (properties.current === undefined) properties.current = 0;
        if (properties.current >= properties.count)
          properties.current = 0;
        else if (properties.current < 0)
          properties.current = properties.count - 1;
        
        return properties.items[properties.current++];
      }
    }
    properties.component = this;
    if (properties.component !== null) {
      $("a#prev", properties.component).click(function(e) {
        e.preventDefault();
        return methods['prev'].apply( this, Array.prototype.slice.call( options, 1 ));
      });
       $("a.item", properties.component).click(function(e) {
        e.preventDefault();
        return methods['item'].apply( this, Array.prototype.slice.call( options, 1 ));
      });
      $("a#next", properties.component).click(function(e) {
        e.preventDefault();
        return methods['next'].apply( this, Array.prototype.slice.call( options, 1 ));
      });
      $("a#play", properties.component).click(function(e) {
        e.preventDefault();
        return methods['play'].apply( this, Array.prototype.slice.call( options, 1 ));
      });
      $("a#pause", properties.component).click(function(e) {
        e.preventDefault();
        return methods['pause'].apply( this, Array.prototype.slice.call( options, 1 ));
      });
      $(this).find("li").each(function(index) {
        properties.items.push($(this).html());
        $(this).remove();
      });
      properties.count = properties.items.length;
      return methods['loopNews'].apply( this, Array.prototype.slice.call( options, 1 ));
    }
  }
  
  
  $(document).ready(function() {
    $("#top-news").newsFade({
      auto:true,
      interval:5000
    });
  });
  
  
})( jQuery );

;

