$(document).ready(function(){

  //put commas in tag list in blog
  $('.post .tags a:not(.post .tags a:last-child)').after(',&nbsp;');
  													 
  //make entire div clickable
  $(".divHover").click(function(){
    window.location=$(this).find("a").attr("href"); return false;
  })


  $("#workList").accordion({
    active: false,
    header: '.header',
    alwaysOpen: false,
    navigation: true,
    autoheight: false
  });
  
  var settings = {
    'animationtype':    'fade',
    'speed':            1000,
    'timeout':          4000,
    'control':          '#select li span',
    'containerheight':  '303px'
  }
  
  $('#albumImage').innerfade(settings);
  $('#select li:first span').addClass('selected');

  $('#albumProjects a:not(.launch)').click(function() {
    var imgHref = '/get-album/albumImages'+$(this).attr("href");
    var controlHref = '/get-album/albumControl'+$(this).attr("href"); 

    if(typeof timeOut != 'undefined') {
      //alert('clearing timeout'); 
      clearTimeout(timeOut);
    }

    $('#albumImage').load(imgHref, {}, function() {
      $('#select').load(controlHref, {}, function() {
        $('#select li:first span').addClass('selected');
        $('#albumImage').innerfade(settings);
      });
    });   
    
    $('#albumProjects li').removeClass('projSel');
    $(this).parent().addClass('projSel');
      
    return false;
  });  
});

