$(document).ready(function() 
{
    $("#relatednews li > div").hover(function() {
       $(this).css("background-color", "#c2dfff");
       $(this).css("cursor", "pointer");
   },
   function() {
        $(this).css("background-color", "");
   });
   
   $("#relatednews li > div").click(function() {
        link = $(this).children("a:first"); 
        if(link.size()) 
            window.location = link.attr("href");
   });
	
  var toggleMinus = 'http://www.marketshuttle.com/dividend/images/icon_minus.gif';
  var togglePlus = 'http://www.marketshuttle.com/dividend/images/icon_plus.gif';
  var $subHead = $('.dividendYear');
  $subHead.prepend('<img src="' + toggleMinus + '" alt="Collapse this section" />&nbsp;');	  
	$subHead.hover(function() {
  	$(this).addClass('dividendYearSelect');
  }, function() {
   $(this).removeClass('dividendYearSelect');
	});
	
	$subHead.click(function() {
    var toggleSrc = $('img', this).attr('src');
    if ( toggleSrc == toggleMinus ) {
      $('img', this).attr('src', togglePlus)
      .parents('#dividendHistory tr').siblings().fadeOut('fast');

    } else {
      $('img', this).attr('src', toggleMinus)
      .parents('#dividendHistory tr').siblings().fadeIn('fast');
    };
  });
  $('img', $('.dividendYear:gt(0)')).trigger("click");
    $(".dr").hover(function() {
        $(this).addClass("hc");
    },
    function() {
        $(this).removeClass("hc");
    });
    
    $(".imgcalendar").each(function() {
        var inputField = this.id.split("_");
        Calendar.setup({
          inputField     :    inputField[0],     // id of the input field
          ifFormat       :    "%m/%d/%Y",      // format of the input field
          button         :    this.id,  // trigger for the calendar (button ID)
          align          :    "B1",           // alignment (defaults to "Bl")
          range          :    new Array(2003,2009),
          singleClick    :    true
        });
    });
    
    $(".dr").click(function() {
        link_d = $(this).find("a:first"); 
        if(link_d.size()) {
            window.location = link_d.attr("href");
        }
    });
   
});

