function WM_preloadImages() {
/*
Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)
*/
  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}
function PopWin(link, name, width, height)
  {
      /*var popWindow = window.open(link,"photo",
      'toolbar=0,location=0,directories=0,status=0,
      menubar=0,scrollbars=0,resizable=0,width=
      '+width+',height='+height);
			 window.open(link,'name','height=255,width=250,
 toolbar=no,directories=no,status=no,menubar=no,
 scrollbars=no,resizable=no');*/
/*  window.open(link,name,height='+height', width='+width',
 toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0); */
 window.open(link,"new",'toolbar=no,status=no,width='+width+',height='+height+',resize=yes,scrollbars=1,menubar=no'); 
}
/* From About.com Photo Album */
function parseQueryString(queryString) {
  var queryObject = new Object();
  queryString = queryString.replace(/^.*\?(.+)$/,'$1');

  while ((pair = queryString.match(/([^=]+)=\'?([^\&\']*)\'?\&?/)) && pair[0].length) {
    queryString = queryString.substring( pair[0].length );
    if (/^\-?\d+$/.test(pair[2])) pair[2] = parseInt(pair[2]);
    queryObject[pair[1]] = pair[2];
  }

  return queryObject;
} 

function buildimage(i){
var tempcontainer=galleryarray[i][4]!=""? '<a href="javascript:PopWin(\'photo.html?src='+galleryarray[i][4]+'&alt='+galleryarray[i][2]+'\',href_target,810,800);">' : ""
tempcontainer+='<img src="'+galleryarray[i][0]+'" border="1" alt="'+galleryarray[i][2]+'" height="'+galleryarray[i][1]+'" width="175" title="'+galleryarray[i][2]+'">'
tempcontainer=galleryarray[i][3]!=""? tempcontainer+'</a>' : tempcontainer
tempcontainer=galleryarray[i][3]!=""? tempcontainer+'<br \/>'+galleryarray[i][3] : tempcontainer
return tempcontainer
}

function jumptopage(p){
var startpoint=(p-1)*totalslots
var y=1;
for (i=0; i<totalslots; i++){
document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
}
while(document.getElementById("navlink"+y)!=null){
document.getElementById("navlink"+y).className=""
y++
}
document.getElementById("navlink"+p).className="current"
}
