﻿//-------------------------------------------------------------------------------------------------
// Image View Handler
//
// Processes the information contained in the imageInfo.js script to display the proper image
// and caption.
//
// Both scripts should be included in the HTML file just after the "body" tag in the following
// manner and order:
// 
//     	<script src="imageInfo.js" language="JavaScript"></script>
//     	<script src="imageViewHandler.js" language="JavaScript"></script>
//

//-------------------------------------------------------------------------------------------------
// --- Free Code not in a Function ---
//


//get the id number of the image from the URL
//should be passed in the URL such as:
// ImageView.html?idNum=P2483
//

var idNum = gup('id');

var caption=eval("caption" + idNum);
var thumbNail=eval("thumbNail" + idNum);
var largeSize=eval("largeSize" + idNum);
var largerSize=eval("largerSize" + idNum);
var aPrint=eval("aPrint" + idNum);
var aCost=eval("aCost" + idNum);
var bPrint=eval("bPrint" + idNum);
var bCost=eval("bCost" + idNum);
var cPrint=eval("cPrint" + idNum);
var cCost=eval("cCost" + idNum);
var dPrint=eval("dPrint" + idNum);
var dCost=eval("dCost" + idNum);
var ePrint=eval("ePrint" + idNum);
var eCost=eval("eCost" + idNum);
var fPrint=eval("fPrint" + idNum);
var fCost=eval("fCost" + idNum);

// not used anymore to load image

//load the large size image for display by the afterLoad function
// viewImage = new Image;
// viewImage.src = largeSize;

//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// afterLoad
//
// Call this function via the body tag in the HTML code:
// 	<body onload="afterLoad()">

function afterLoad(){

// not used anymore to load image

//	document['theImage'].src = viewImage.src;
	}

//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// Function to retrieve parameter from URL
//
// The way that the function is used is fairly simple. Let's say you have the following URL:
//
// http://www.foo.com/index.html?bob=123&frank=321&tom=213#top
//
// You want to get the value from the frank parameter so you call the javascript function as follows:
//
// var frank_param = gup( 'frank' );

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return unescape(results[1]);
}
//-------------------------------------------------------------------------------------------------
