jQuery(document).ready(function(){
// -------------------------------------------------------
//Mouseover Image Function
  jQuery(function() {
    jQuery('.rollover').hover(function() {
        var currentImg = jQuery(this).attr('src');
        jQuery(this).attr('src', jQuery(this).attr('hover'));
        jQuery(this).attr('hover', currentImg);
    }, function() {
        var currentImg = jQuery(this).attr('src');
        jQuery(this).attr('src', jQuery(this).attr('hover'));
        jQuery(this).attr('hover', currentImg);
    });
  })
// End of Mouse over Image Function


// -------------------------------------------------------
//Mainnav Drowdown Function
  jQuery('#menu li ul').css({
    display: "none",
    left: "auto"
  });
  jQuery('#menu li').hover(function() {
    jQuery(this)
      .find('ul')
      .slideDown('fast', function () {
      jQuery('#content').fadeTo('fast',0.90); //Set to .90 Transparent
    });
  }, function() {
    jQuery(this)
      .find('ul')
      .fadeOut('fast');
  });
// End of Mainnav Drowdown Function



// -------------------------------------------------------
//SIGN IN Drowdown Function
  jQuery('#nav li').hover(
    function () {
      //show its submenu
      jQuery('ul', this).slideDown('fast');

    },
    function () {
      //hide its submenu
      jQuery('ul', this).slideUp('fast');
    }
  );

// -------------------------------------------------------



// About Us && Funds & Performance Details sub pages
//Default Action

  jQuery(".description").hide(); //Hide all content
  if(location.href != "") {
    var original_target = location.href.split("?")[1];

  // If there is an Anchor in the URL,
  // Split the target and anchor
  if(original_target != null){
    var anchor = original_target.split("#")[1];
    var target = original_target.split("#")[0];
    }

  if(target == null){
    //Set First tab as Default
    //jQuery("ul.tabs li a:first").addClass("active").show(); //Activate first tab
    jQuery(".description:first").show();                    //Show first tab content
  } else {
      jQuery('#'+target).show();
      if (anchor != null) {  // If anchor has a value
        location.href="#" + anchor; // Go to anchor
      }
      var activeTab = "ul.tabs li a."+target;
      jQuery(activeTab).addClass("active").show();

    //To change the Page Title Images on Fund & Performance Details pages
      if (document.location.href.indexOf('?'+target) > 0) {
        jQuery("img.sectionImg").attr("src", "images/marketing_site/hdr_"+target+".gif");
      }
    }
  }

  //On Click Event from the SubTab link
  jQuery("ul.tabs li a").click(function() {
    jQuery("ul.tabs li a").removeClass("active"); //Remove any "active" class
    jQuery(this).addClass("active");              //Add "active" class to selected tab
    jQuery(".description").hide();                //Hide all tab content
  });

   //For About Us page, fix the issue on link within Tab copy
  jQuery("a.research_service").click(function() {
    var activeTab = '?research_service';
    jQuery(".description").hide();                 // hide all copy in the description
    jQuery("ul.tabs li a").removeClass("active");  // remove all class in the subnav
    jQuery('ul.tabs li a.research_service').addClass("active").show();
    jQuery('research_service').show();
  });

// End of About Us & Fund and Performance Detilas Sub Pages Function


// -------------------------------------------------------
// Membership Plans
// Expand and Collapse function

  jQuery('.membership_detail').hide(); // Hide the all details rows
  jQuery('div.membership_expand').click(function() {
    jQuery(this).toggleClass("membership_collapse");
    jQuery(this).next('.feature').toggleClass("feature2");
    jQuery(this).parent().next('#membership_row_detail').slideToggle('fast');
    return false;
  });
// End of  Membership Plans


// -------------------------------------------------------
// Research Library
// Expand and Collapse function

  jQuery('.research_library_detail').hide(); // Hide the all details rows
  jQuery('div.research_library_expand').click(function() {
    jQuery(this).toggleClass("research_library_collapse");
    jQuery(this).parent().next('#research_library_detail').slideToggle('fast');
    return false;
  });
// End of Research Library




});
