function filter(imagename, objectsrc) {
  if(document.images){
    document.images[imagename].src = eval(objectsrc+'.src');
  }
}

var showhide_groups = new Array();
var showhide_names = new Array();

function lj_show(id) {
  var el = document.getElementById(id);
  var cl = el.className;
  if(cl.indexOf('hide')!=-1) {
    if(cl.indexOf(' hide')==-1) {
      el.className = cl.replace('hide','');
    } else {
      el.className = cl.replace(' hide','');
    }
  }
}

function lj_hide(id) {
  var el = document.getElementById(id);
  var cl = el.className;
  if(cl.indexOf('hide')==-1) {
    el.className += ' hide';
  }
}

function lj_shgrp(id,group) {
  var i = shFindGroupId(group);
  if(i==-1) { return false; }
  // hide whole group...
  var j = 0;
  while(j<showhide_groups[i].length) {
    lj_hide(showhide_groups[i][j]);
    j++;
  }
  lj_show(id);
}

function shFindGroupId(name) {
  var i = 0;
  while(i<showhide_names.length) { if(showhide_names[i] == name) { break; } i++; }
  if(i>=showhide_names.length) { return -1; } else { return i; }
}

function shAddGroup(name,members) {
  var i = shFindGroupId(name);
  if(i==-1) { i = showhide_names.length; showhide_names[i] = name; }
  showhide_groups[i] = members;
}

// specific to blog...
var showhide_dockgrp = new Array();
showhide_dockgrp[0] = 'blog_cooldock_latest';
showhide_dockgrp[1] = 'blog_cooldock_categories';
showhide_dockgrp[2] = 'blog_cooldock_archive';
shAddGroup('blog_dock',showhide_dockgrp);

// jquery stuff for dock effects
/*
$( function() {
  $( '.category' ).click( function() {
    $( this ).toggleClass( 'active' );
    $( this ).siblings( '.dropdown' ).toggle();
    $( this ).find( '.indicator' ).toggleClass( 'indicator-active' );
    return false;
  } );

  $( 'div#blog_cooldock_latest > li' ).hover( function() {
    $( '.latest' ).fadeOut( 'fast' );
    $( this ).addClass( 'dock-active' );
    $('div#blog_cooldock_latest > span').html('set by jquery');
    $( this ).children( 'span' ).fadeIn( 200 );
  }).bind( 'mouseleave', function() {
    $( this ).removeClass( 'dock-active' );
    $( this ).children( 'span' ).fadeOut( 200 );
  } );

  $( 'div#blog_cooldock_latest > ul' ).bind( 'mouseleave', function() {
    $( '.latest' ).fadeIn( 1000 );
  } );
} );
*/

$(document).ready( function() {
  $('div#blog_cooldock_latest li').hover( function() {
    var txt = $(this).children('span').text();
    $(this).addClass('blog_cooldock_latest_active');
    $('div#blog_cooldock_latest > span').html(txt);
  }, function() {
    $(this).removeClass('blog_cooldock_latest_active');
    $('div#blog_cooldock_latest > span').html('&nbsp;');
  } );
  $('div#blog_cooldock_selector li').hover( function() {
    $(this).addClass('blog_cooldock_selector_active');
  }, function() {
    $(this).removeClass('blog_cooldock_selector_active');
  } );
  $('div#blog_cooldock_selector li').click( function() {
    $(this).children('a').click();
  } );
} );