// v3.02 of preloadImages() ...
//   - any number of parameters
//   - sequences of images enclosed in <>, e.g. <0-7>, with optionally up to 4 leading zeros e.g. <01-17>
//   - 3.01 ... fix for Netscape, where parseInt() interprets a leading zero as an octal
//   - 3.02 ... ANY number of leading zeros

function preloadImages() {
  var imgFiles, i, j, k, kb, kc;
  var s1, s2, s2s, s2sl, s2v, s2b, s3, s3s, s3sl, s3v, s3b, sl, bb, s1s, s4s;

  if (document.images) {
    imgFiles = preloadImages.arguments;
    if (document.preloadArray == null)
      document.preloadArray = new Array();
    i = document.preloadArray.length;
    with (document) {
      for (j = 0; j < imgFiles.length; j++) {
        s1 = imgFiles[j].indexOf('<');
        sl = imgFiles[j].length;
        if (s1 != -1) {
          s2s = imgFiles[j].substring(s1,sl); s2 = s2s.indexOf('-')+s1;
          if (s2 > s1+1) {
            s3s = imgFiles[j].substring(s2,sl); s3 = s3s.indexOf('>')+s2;
            if (s3 > s2+1) {
              s1s = imgFiles[j].substring(0,s1);
              s2s = imgFiles[j].substring(s1+1,s2); s2sl = s2s.length;
              s3s = imgFiles[j].substring(s2+1,s3); s3sl = s3s.length;
              s4s = imgFiles[j].substring(s3+1,sl);
              s2b = 0;
              while (s2sl > s2b+1 && s2s.substring(s2b,s2b+1) == '0') s2b++;
              s2v = parseInt(s2s.substring(s2b,s2sl));
              s3b = 0; 
              while (s3sl > s3b+1 && s3s.substring(s3b,s3b+1) == '0') s3b++;
              s3v = parseInt(s3s.substring(s3b,s3sl));
              for (k = s2v; k <= s3v; k++) {
                bb = s1s; kc = 10;
                for (kb = 0; kb < s2b; kb++) {
                  if (k < kc) bb += "0";
                  kc *= 10;
                }
                bb += k + s4s;
                preloadArray[i] = new Image;
                preloadArray[i++].src = bb;
              }
            }
          }
        }
        else {
          preloadArray[i] = new Image;
          preloadArray[i++].src = imgFiles[j];
        }
      }
    }
  }
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.01
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-1);i+=2)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+1];}
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


// focused popup
function w(url) {
  var x = window.open(url,"xx",'top=15,left=15,width=640,height=480,status=no,scrollbars=yes,resizable=yes');
  x.focus();
}


function openPopup(url, popupTitle, attr) { 
  var popupID = window.open(url, popupTitle, attr);
	popupID.focus();
}


function showdate(thedate)
{
  var a, b, d, y;

  if (!thedate) {
    a = new Date(document.lastModified);
    if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "3") {
      y = a.getYear(); if (y < 30) { y += 2000; a.setYear(y); } else y += 1900;
    }
    else {
      y = a.getFullYear(); if (y < 1930) { y += 100; a.setFullYear(y); }
    }
    d = a.getDate().toString(); if (d.length == 1) d = "0"+d;
    b = a.toString();
    thedate = b.substring(0,4) + d + "-" + b.substring(4,7) + "-" + y;
  }
  document.write(thedate);
}


var preloadrequired = 0;

function preloadrollovers() {
  if (preloadrequired == 1) {
    preloadImages('images/bassocr.gif','images/bprofiler.gif','images/bservicesr.gif','images/bnewsr.gif');
  }
  else if (preloadrequired == 2) {
    preloadImages('images/bwhoarewer.gif');
  }
  else if (preloadrequired == 3) {
    preloadImages('images/bintprofiler.gif');
  }
  if (preloadrequired != 1) {
    preloadImages('images/massocr.gif','images/mprofiler.gif','images/mservicesr.gif','images/mnewsr.gif','images/gwlogor.gif');
  }
  // if (navigator.appName == "Netscape") document['sponsor'].visibility = "hide";
  // else document.all['sponsor'].style.visibility = "hidden";
}

