
// SCRIPT REQUIRED BY SIDE DROP MENUS //

function ViewCrossReference (selSelectObject)
{
   if (selSelectObject.options[selSelectObject.selectedIndex].value != "")
   {
     location.href=selSelectObject.options[selSelectObject.selectedIndex].value
   }
}


// SCRIPT REQUIRED BY POPUP LAYERS //

function getObj(elementID){

		return document.getElementById(elementID);
	 }

		 

function show(element){
     
		 getObj(element).style.visibility= "visible";     
	 }



function hide(element){

     		getObj(element).style.visibility= "hidden";     
     	}






// ========================= Webmonkey Preload Images ========================================== //

function WM_preloadImages() {

/*
WM_preloadImages()
Loads images into the browser's cache for later use.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // 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];
    }
  }
}


// ========================= RANDOM IMAGES SELECTION FROM RANDOMPHOTO.PHP ========================================== //

function RANDOM_MAINPAGEPHOTOselect(numberofpics,directory,picid){

  var objStr,obj;
  var daImage= picid;
  var choice= Math.random();
  var thechoice= (choice * (numberofpics-1));
  var randomrounded= Math.round(thechoice); 
 

 if(randomrounded == 0){randomrounded = 1};
 
 daSrc= picid + randomrounded + '.jpg';
 

 daSrc = directory + daSrc;



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;
    }
  }
}

