var oP =
{
  aImg : new Array(),
  aError : new Array(),
  iLoaded : 0,
  bComplete : true,
  sAnim : '|/-\\',
  i : 0
}

oP.a = function ( iSrc )
{
  if( typeof(_BASE_DIR) == 'undefined' ) var _BASE_DIR = '';
  oP.bComplete = false;
  var oImg = new Image();
  oImg.onload = function() { oP.iLoaded++; }
  oImg.onerror = function() { oP.aError.push( this.src ); }
  oImg.src = _BASE_DIR + iSrc;

  return oP.aImg[oP.aImg.push( oImg )];
}

oP.c = function ( )
{
  if( ( oP.aError.length + oP.iLoaded ) < oP.aImg.length )
  {
    setTimeout('oP.c()', 256 );
    window.status = 'preloading images ' + oP.sAnim.charAt( oP.i );
    oP.i++;
    if( oP.i == oP.sAnim.length ) oP.i = 0;
  }
  else
  {
    oP.bComplete = true;
    if( oP.aError.length > 0 )
      window.status = 'preloading complete [ ' + oP.iLoaded + ' ( ' + oP.aError.toString() + ' ) ]';
  }
}
