
function createClickDowns() {
  /* find all div.clickdown and make their div.cont invisible, but visible when parent clicked. */
 	$('div.clickdown div.cont').hide();
	$('div.clickdown div.title').toggle( function() {
        $(this).parent().addClass('clickdown_active');
        $(this).siblings('div.cont').show();
    }, function() {
        $(this).parent().removeClass('clickdown_active');
        $(this).siblings('div.cont').hide();
    } );
}

function preloadImage(url) {
  imageObj = new Image();
  imageObj.src = url;
}

$(document).ready( function() {
  /* External links open in popup window */
  $('a[rel="external"]').click( function () {
    newwindow = window.open( $(this).attr('href'), 'name', 'width=490,height=95' );
    if (window.focus) { newwindow.focus(); }
  });
  
  $('a[rel="external"]').each( function() {
    name = $(this).attr('title') + ' (Popup)';
    $(this).attr('title', name);
	});
	
	/* Toggle buttons */
	createClickDowns();
	
	/* Fade animation on title screen */
	$('img[src="sftbotd_front.jpg"]')
	  .after('<img src="sftbotd_textoverlay.gif" id="fadeanim" />');
	  
	$('#fadeanim').hover( function() {
	  $(this).stop().fadeTo(2000,1);
	}, function() {
	  $(this).stop().fadeTo(2000,0);
	} );

});

