function slide(hide_id, show_id, doBlindLeft) {
	if (doBlindLeft === undefined)
    doBlindLeft = 1;

  if (hide_id > 9)
    var divHideId = 'slide' + hide_id;
  else
    var divHideId = 'slide0' + hide_id;

  if (show_id > 9)
    var divShowId = 'slide' + show_id;
  else
    var divShowId = 'slide0' + show_id;

  //alert(divHideId + ', ' + divShowId);
  
  if ($(divHideId) && $(divShowId)) {
    if (doBlindLeft)
      new Effect.BlindLeft(divHideId, { queue: 'end' });

    if ($(divShowId).down().getAttribute('rel') != 'ok') {
			// alert('1');
      // if image isnt loaded yet try again later
      setTimeout(function() { slide(hide_id, show_id, 0); }, 100) ;
    } else {
			//alert('ok: '+divShowId);
      new Effect.BlindRight(divShowId, { queue: 'end' });
    }
  }
}

function preloadImages() {
  //var first = true;  
  $$("div#content img").each(function(value,index) {
    if (value.getAttribute('rel') == 'preload') {
      preloadImage(value.src,value.id);
    }
  });
}

// handles the preload.
var imgPreload = new Array();
function preloadImage(fn,id) {
  imgPreload[id] = new Image();
  imgPreload[id].onload = function() {
     $(id).setAttribute('rel','ok');
  }
//  $(id).setAttribute("style","display:none;");
  $(id).setAttribute('rel','loading');
  imgPreload[id].src = fn;
}
