/*
 * $Id: featuredblock-front.js,v 1.4 2007/02/05 21:21:48 srude Exp $
 */

var fb_currentid = 1;
var fb_keep_going = true;

$(document).ready(function(){
  fb_timeout = setTimeout(featuredblock_fire, 7000);
});

function featuredblock_select(us) {
  $(us).addClass('selected');
  for(i=1;i<=4;i++) {
    var slot = $('#fblock_slot'+i).children('a');
    if ($(us).parent().attr('id') != 'fblock_slot'+i) {
		$(slot).addClass('link');
      	$(slot).removeClass('selected'); 
    }
    else {
		//alert(slot.html() + "\n==\n" + $(us).html());
   		$('#fblock_main').html($('#fblock_main'+i).html());
    }
  }
}

function featuredblock_click(us) {
  fb_keep_going = false;
  return featuredblock_select(us);
}

function featuredblock_fire() {
  if (fb_keep_going == true) {
    fb_timeout = setTimeout(featuredblock_fire,7000);
  }
  else {
    return true;
  }
  fb_currentid++;
  if (fb_currentid == 5) {
    fb_currentid=1;
  }
  featuredblock_select($('#fblock_slot'+fb_currentid).children('a'));
}

