// .coms's Randpic Image Loader v2
// by mrfwiski

// Randpic.v2 picks a random photo from a photo archive
// directory, and posts it on a webpage as a hyperlink
// to an associated popup html file. Version 2 has been
// optimized for speed, archive selection, and error 
// handling.

// Usage: Place all images to be displayed in a folder. 
// name the images 1.jpg, 2.jpg, 3.jpg, and so forth. 
// Include with each an associated file 1.html, 2.html,
// etc in the same folder. 

// The script is included in the page in the following
// manner:
//
// <HTML>
// <HEAD>
//    <script SRC="randpic.js" language="JavaScript1.1"></script>
// </HEAD>
// <BODY>
//    <script language="JavaScript1.1">
//       <!--
//       showImage();
//       // -->
//    </script>
//    <noscript>
//       <!-- put a standard image or something here as alternative -->
//       Page requires Javascript1.1 or better
//    </noscript>
// </BODY>
// </HTML>
//

// Limitations: The script will not function on some very
// old versions of netscape. It will, however, notify them
// that they are missing content. Furthermore, the script
// cannot form intellegent searches for image files based
// on wildcards; you must literally list the images as
// 1.jpg, 2.jpg, 3.jpg ... 45.jpg, and so on.
 
// User Modification:

// Name the folder containing all images and html to be
// displayed here.
folder="../Snapshots/";

// Record how many images there are to chose from
displays=18;


var X=0;
while ( X == 0 ) {
  X = Math.round(Math.random()*(displays)); // Math.random in JS1.1
}

preBuffer = new Image ();
picname = folder + X + ".gif";
preBuffer.src = picname;
urlname = folder + X + ".htm";

function openpopup(){
	var popurl=urlname
	winpops=window.open(popurl,"","width=775,height=530")
}

function showImage(){
document.open();
document.write('<div class="blacklink"><a href="javascript:openpopup()"><img src="'+picname+'" width=129 border=0  height=94></A></div>');
document.close();
}






























































