/**
 * Essentially, these are one-off effects.
 * 
 * @author David Miles
 * @package isc
 */
$(function(){
  // Timeout for sliders
  var timeout = 250;
  
  // Splash panels
  $('#splash li').click(function(e){
    if($(this).find('a').attr('href') !== undefined){
      window.location.href = $(this).find('a').attr('href');
    }
  });
  
  // Profile lists
  $('.profileList li').click(function(e){
    if($(this).find('h3>a').attr('href') !== undefined){
      window.location.href = $(this).find('h3>a').attr('href');
    }
  });
  
  // Quick login
  $('#quickLoginLink').click(function(e){
    $('#quickLogin').stop(true).slideToggle(timeout);
    e.preventDefault();
  });
  
  // Menu
  $('#siteNavigation>li>a:first').addClass('roundLeft');
  $('#siteNavigation>li>a:last').addClass('roundRight');
  
  // Portal
  $('#portalBar').hover(function(){
    $('#portalList').stop(true, true).toggle(timeout);
  });
  
  // Messages
  $('#messages').delay(10000).slideUp(function(){
	  // Remove the element completely so that CSS :first-child targets the correct element
	  $(this).remove();
  });
  
  // Content height fixes
  $('div.label+div.horizontal').each(function(i){
    var h = $(this).prev('div.label').height();
    if($(this).height() < h){
      $(this).height(h);
    }
  });
});
