<!-- begin global scripts

function aPrint(name,cost,costsign,costnum){
	this.name=name;
	this.cost=cost;
}

Prints = new Array()
   Prints[0] = new aPrint("The Competitors",30);
   Prints[1] = new aPrint("Happy Hiawatha Holiday",30);
   Prints[2] = new aPrint("Ten Wheeler Tradition",30);
   Prints[3] = new aPrint("Still on the Payroll in 1935",30);
   Prints[4] = new aPrint("Pennsy Perfection",30);
   Prints[5] = new aPrint("Six Point Six Miles From Destiny",30);
   Prints[6] = new aPrint("No. 1, Of Course",30);
   Prints[7] = new aPrint("Almost Home",30);
   Prints[8] = new aPrint("Race of the Century",30);
   Prints[9] = new aPrint("Queen City Quietude",30);
   Prints[10] = new aPrint("The American",30);
   Prints[11] = new aPrint("Those Night Trains",30);
   Prints[12] = new aPrint("Union Pacific Flagship",30);
   Prints[13] = new aPrint("Roaring Through Rondout",30);
   Prints[14] = new aPrint("Class D on the Run",30);
   Prints[15] = new aPrint("A Name Like a Cocktail",30);
   Prints[16] = new aPrint("Pennsy's Finest",30);
   Prints[17] = new aPrint("Gray Plus Orange and Red",30);
   Prints[18] = new aPrint("Centuries Pass at Night",30);
   Prints[19] = new aPrint("Berkshire at Midnight",30);
   Prints[20] = new aPrint("The Day Before 112.5 MPH",30);
   Prints[21] = new aPrint("The Snuff Dipper",30);
   Prints[22] = new aPrint("Hand Off at Harrisburg",42);
				// signed one below
   Prints[23] = new aPrint("Oiling 'Round",42);
   Prints[24] = new aPrint("Headquarters is Watching",42);
				// signed one below
   Prints[25] = new aPrint("Juice vs. Steam",30);
   Prints[26] = new aPrint("Insull Incitement",30);
   Prints[27] = new aPrint("Apple Blossom Time",30);
   Prints[28] = new aPrint("Fast as a Plane",30);
//   Prints[29] = new aPrint("Action at Duplainville (signed unnumbered)",42);
//   Prints[30] = new aPrint("1948 - PRR T1 5536:120mph plus? (signed unnumbered)",42);
   Prints[31] = new aPrint("Railroad Ghosts",38);//42
//   Prints[32] = new aPrint("Railroad Ghosts (signed unnumbered)",42);//46
//   Prints[33] = new aPrint("New York Central's Great Hudson (signed unnumbered), the J-1d",42);
   Prints[34] = new aPrint("*Bulldog",-1);
   Prints[35] = new aPrint("The Cannonball-Milwaukee Road",42);
//   Prints[36] = new aPrint("The Cannonball-Milwaukee Road (signed unnumbered)",46);
   Prints[37] = new aPrint("79 mph",50);
//   Prints[38] = new aPrint("79 mph (signed unnumbered)",55);
   Prints[39] = new aPrint("Pennsylvania Standard",50);
//   Prints[40] = new aPrint("Pennsylvania Standard (signed unnumbered)",55);
   //Prints[41] = new aPrint("Pennsylvania Standard (signed numbered)",60);
   Prints[42] = new aPrint("Bad Night on the East End",42);
//   Prints[43] = new aPrint("Bad Night on the East End (signed unnumbered)",46);
//   Prints[44] = new aPrint("Bad Night on the East End (signed numbered)",50);
   Prints[45] = new aPrint("Railroad Bull",50);
 //  Prints[46] = new aPrint("Railroad Bull (signed unnumbered)",55);
   //Prints[47] = new aPrint("Railroad Bull (signed numbered)",60);
   Prints[48] = new aPrint("Chris Burger at the Throttle",50);
//   Prints[49] = new aPrint("Chris Burger at the Throttle (signed unnumbered)",55);
   //Prints[50] = new aPrint("Chris Burger at the Throttle (signed numbered)",60);
   // out of print Prints[51] = new aPrint("The C.W.Reiss Coal Company 1880-1990 (signed unnumbered)",29.95);
   Prints[52] = new aPrint("Omaha Union Station",42);
//   Prints[53] = new aPrint("Omaha Union Station (signed unnumbered)",46);
   Prints[54] = new aPrint("Back Home Again",38);
//   Prints[55] = new aPrint("Back Home Again (signed unnumbered)",42);
   Prints[56] = new aPrint("The Old Reliable",38);
 //  Prints[57] = new aPrint("The Old Reliable (signed unnumbered)",42);
   Prints[58] = new aPrint("Day Express Doubleheader",30);
   Prints[59] = new aPrint("APEX of the Atlantics PRR E6",34.50);
//   Prints[60] = new aPrint("APEX of the Atlantics PRR E6 (signed unnumbered)",37);
//   Prints[61] = new aPrint("Hand Off at Harrisburg (signed unnumbered)",46);
//   Prints[62] = new aPrint("Headquarters is Watching (signed unnumbered)",46);

//   Prints[63] = new aPrint("The Competitors (signed unnumbered)",34);
//   Prints[64] = new aPrint("Happy Hiawatha Holiday (signed unnumbered)",34);
//  Prints[65] = new aPrint("Ten Wheeler Tradition (signed unnumbered)",34);
//   Prints[66] = new aPrint("Still on the Payroll in 1935 (signed unnumbered)",34);
//   Prints[67] = new aPrint("Pennsy Perfection (signed unnumbered)",34);
//   Prints[68] = new aPrint("Six Point Six Miles From Destiny (signed unnumbered)",34);
//   Prints[69] = new aPrint("No. 1, Of Course (signed unnumbered)",34);
//   Prints[70] = new aPrint("Almost Home (signed unnumbered)",34);
//   Prints[71] = new aPrint("Race of the Century (signed unnumbered)",34);
//   Prints[72] = new aPrint("Queen City Quietude (signed unnumbered)",34);
//   Prints[73] = new aPrint("The American (signed unnumbered)",34);
//   Prints[74] = new aPrint("Those Night Trains (signed unnumbered)",34);
//   Prints[75] = new aPrint("Union Pacific Flagship (signed unnumbered)",34);
//   Prints[76] = new aPrint("Roaring Through Rondout (signed unnumbered)",34);
//   Prints[77] = new aPrint("Class D on the Run (signed unnumbered)",34);
//   Prints[78] = new aPrint("A Name Like a Cocktail (signed unnumbered)",34);
//   Prints[79] = new aPrint("Pennsy's Finest (signed unnumbered)",34);
//   Prints[80] = new aPrint("Gray Plus Orange and Red (signed unnumbered)",34);
//   Prints[81] = new aPrint("Centuries Pass at Night (signed unnumbered)",34);
//   Prints[82] = new aPrint("Berkshire at Midnight (signed unnumbered)",34);
//   Prints[83] = new aPrint("The Day Before 112.5 MPH (signed unnumbered)",34);
//   Prints[84] = new aPrint("The Snuff Dipper (signed unnumbered)",34);
//   Prints[85] = new aPrint("Juice vs. Steam (signed unnumbered)",34);
//   Prints[86] = new aPrint("Insull Incitement (signed unnumbered)",34);
//   Prints[87] = new aPrint("Apple Blossom Time (signed unnumbered)",34);
//   Prints[88] = new aPrint("Fast as a Plane (signed unnumbered)",34);
//   Prints[89] = new aPrint("Day Express Doubleheader (signed unnumbered)",34);
//   Prints[90] = new aPrint("Oiling Round (signed unnumbered)",46);
//   Prints[91] = new aPrint("400 at Eau Claire (signed unnumbered)",55);
   Prints[92] = new aPrint("400 at Eau Claire (unsigned unnumbered)",50);
//   Prints[93] = new aPrint("How Not to Fire an M1 (signed unnumbered)",55);
   Prints[94] = new aPrint("How Not to Fire an M1 (unsigned unnumbered)",50);
   Prints[95] = new aPrint("1948 - PRR T1 5536:120mph plus? (unsigned unnumbered)",38);
   Prints[96] = new aPrint("New York Central's Great Hudson (unsigned unnumbered), the J-1d",38);
   Prints[97] = new aPrint("Action at Duplainville (unsigned unnumbered)",38);
//   Prints[98] = new aPrint("The Intruder (signed unnumbered)",55);
   Prints[99] = new aPrint("The Intruder  (unsigned unnumbered)",50);
//   Prints[100] = new aPrint("The Thrill of a Fast Train (signed unnumbered)",46);
   Prints[101] = new aPrint("The Thrill of a Fast Train (unsigned unnumbered)",42);
   Prints[102] = new aPrint("Elm Grove Depot (unsigned unnumbered)",50);
//   Prints[103] = new aPrint("Elm Grove Depot (signed unnumbered)",55);
   Prints[104] = new aPrint("Mendota, Illinois (unsigned unnumbered)",50);
//   Prints[105] = new aPrint("Mendota, Illinois (signed unnumbered)",55);

   Prints[150] = new aPrint("Amtrak Calendar - 1992",25);
   Prints[151] = new aPrint("Amtrak Calendar - 1990",25);
   Prints[152] = new aPrint("Amtrak Calendar - 1989",25);
   Prints[153] = new aPrint("Amtrak Calendar - 1988",25);
   Prints[154] = new aPrint("Amtrak Calendar - 1987",25);
   Prints[155] = new aPrint("Amtrak Calendar - 1986",25);
   Prints[156] = new aPrint("Amtrak Calendar - 1985",25);
   Prints[157] = new aPrint("Amtrak Calendar - 1984",25);
   Prints[158] = new aPrint("Amtrak Calendar - 1983",25);
   Prints[159] = new aPrint("Amtrak Calendar - 1982",25);
   Prints[160] = new aPrint("Amtrak Calendar - 1981",25);
   Prints[161] = new aPrint("Amtrak Calendar - 1979",25);
   Prints[162] = new aPrint("Amtrak Calendar - 1978",25);
   Prints[163] = new aPrint("Amtrak Calendar - 1980",25);

   Prints[200] = new aPrint("Oconomowoc Snow Train",50);

   
   // function returns a string formated with 2 decimal places for money.
function format(expr){
	var decplaces = 2; 
	var str="" + Math.round (eval(expr)* Math.pow(10,decplaces))
	while (str.length <= decplaces) {
		str = "0" + str
	}
	var decpoint = str.length-decplaces
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length)
}



//
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
//
//  This version takes a more aggressive approach to deleting
//  cookies.  Previous versions set the expiration date to one
//  millisecond prior to the current time; however, this method
//  did not work in Netscape 2.02 (though it does in earlier and
//  later versions), resulting in "zombie" cookies that would not
//  die.  DeleteCookie now sets the expiration date to the earliest
//  usable date (one second into 1970), and sets the cookie's value
//  to null for good measure.
//
//  Also, this version adds optional path and domain parameters to
//  the DeleteCookie function.  If you specify a path and/or domain
//  when creating (setting) a cookie**, you must specify the same
//  path/domain when deleting it, or deletion will not occur.
//
//  The FixCookieDate function must now be called explicitly to
//  correct for the 2.x Mac date bug.  This function should be
//  called *once* after a Date object is created and before it
//  is passed (as an expiration date) to SetCookie.  Because the
//  Mac date bug affects all dates, not just those passed to
//  SetCookie, you might want to make it a habit to call
//  FixCookieDate any time you create a new Date object:
//
//    var theDate = new Date();
//    FixCookieDate (theDate);
//
//  Calling FixCookieDate has no effect on platforms other than
//  the Mac, so there is no need to determine the user's platform
//  prior to calling it.
//
//  This version also incorporates several minor coding improvements.
//
//  **Note that it is possible to set multiple cookies with the same
//  name but different (nested) paths.  For example:
//
//    SetCookie ("color","red",null,"/outer");
//    SetCookie ("color","blue",null,"/outer/inner");
//
//  However, GetCookie cannot distinguish between these and will return
//  the first cookie that matches a given name.  It is therefore
//  recommended that you *not* use the same name for cookies with
//  different paths.  (Bear in mind that there is *always* a path
//  associated with a cookie; if you don't explicitly specify one,
//  the path of the setting document is used.)
//  
//  Revision History:
//
//    "Toss Your Cookies" Version (22-Mar-96)
//      - Added FixCookieDate() function to correct for Mac date bug
//
//    "Second Helping" Version (21-Jan-96)
//      - Added path, domain and secure parameters to SetCookie
//      - Replaced home-rolled encode/decode functions with Netscape's
//        new (then) escape and unescape functions
//
//    "Free Cookies" Version (December 95)
//
//
//  For information on the significance of cookie parameters, and
//  and on cookies in general, please refer to the official cookie
//  spec, at:
//
//      http://www.netscape.com/newsref/std/cookie_spec.html    
//
//******************************************************************
//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if
//      the cookie does not exist.
//
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}



//
//  Function to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//      any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//      omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//      If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//      valid.  If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie transmission
//      requires a secure channel (HTTPS).  
//
//  The first two parameters are required.  The others, if supplied, must
//  be passed in the order listed above.  To omit an unused optional field,
//  use null as a place holder.  For example, to call SetCookie using name,
//  value and path, you would code:
//
//      SetCookie ("myCookieName", "myCookieValue", null, "/");
//
//  Note that trailing omitted parameters do not require a placeholder.
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.  This MUST
//             be the same as the path used to create the cookie, or null/omitted if
//             no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.  This MUST
//             be the same as the domain used to create the cookie, or null/omitted if
//             no domain was specified when creating the cookie.
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function CookiesEnabled () {
	var name = "ReidTest"
 	SetCookie(name,1,null,"/",null,null);
	if (GetCookie(name)) {
		DeleteCookie(name,"/",null);
		return 1;
	}
	else
	{
	 return 0;
	}
}

function AddToCart(printid){

	if (CookiesEnabled())
	{
       if (!Prints[printid])
	   {
	      alert("Error. Couldn't find this print. It's a problem with our website. Please let us know by using the ContactUs link and let us know which print you had clicked on.");
	   }
	   else
	   {

	      var cart = GetCookie("ReidCart");
	      if (cart != null) { //there's already something in it.
	      	   cart = cart + "," + printid; 	// add the new value.
	      } else {
      		   cart = printid; // the cart was empty, no cookie present
	      }

	      SetCookie("ReidCart",cart,null,"/",null,null);
	      window.location.reload();
		  
 	      alert("Added to cart:"+Prints[printid].name);
	   //window.location.href="cart.htm?"+printid;
	   }
	}
	else
	{
		 alert ("It appears Cookies are not enabled in your browser, the shopping cart requires cookies, so it won't work. You may send a mail to ebmace@comcast.net with what you wish to order and we can take it from there.");
	}
}
function PrintCartSummary(verbose){

	if (CookiesEnabled() == 0)
	{
		if (verbose==1)
    	{
        	document.write ("It appears cookies are not enabled in your browser, the shopping cart requires cookies, so your cart is empty. You may send a mail to ebmace@comcast.net with what you wish to order and we can take it from there.<BR>");
		}
		else
		{
			document.write ("Cookies Disabled,Cart off.");
		}
	}
	else
	{
		var thecart= GetCookie("ReidCart");
		var totitems= 0;
		var totcost= 0;
		if (thecart != null) {
			var whichids = thecart.split(",");
			for(var i=0; i < whichids.length ; i++) {
				var thisid = parseInt(whichids[i]);
				if (!Prints[thisid])
		 	   {
	    		  alert("Error. Couldn't find this print ("+thisid+"). It's a problem with our website. Please let us know by using the ContactUs link and let us know which print you had clicked on.");
			   }
			   else
			   {
					if (Prints[thisid].cost > 0) {
						totcost += Prints[thisid].cost;
						totitems++;
					}
			    }
			}
		}
    	if (verbose==1)
    	{
        	document.write ("Items in cart: "+totitems+ "<BR>");
        	document.write ("Current Subtotal: $"+ format(totcost)+ "<BR>");
    	}
    	else
    	{
        	document.write ("items: "+totitems);
    	}
	}
}

/* Shipping Parameters

    * ship_method_name_# - The parameter value identifies a name for a shipping option available for the order.
    * ship_method_price_# - The parameter value identifies the cost of a shipping option.
    * ship_method_currency_# - The parameter value identifies the currency for the shipping price. The default value is USD (U.S. dollars).
    * ship_method_us_area_# - The parameter value identifies an area of the United States where a shipping method is available.
*/
function GoogleShipping()
{
	document.write ("<input TYPE=\"hidden\" NAME=\"ship_method_name_1\" Value=\"USPS First Class\">");
	document.write ("<input TYPE=\"hidden\" NAME=\"ship_method_price_1\" Value=\"0.0\">");
	document.write ("<input TYPE=\"hidden\" NAME=\"ship_method_us_area_1\" Value=\"ALL\">");
}
/*Tax Parameters

    * tax_us_state - The parameter value identifies the U.S. state in which you charge tax.
    * tax_rate - The parameter value specifies the tax rate that you charge.'
	Charging all WI orders for Waukesha county tax 5% + .1% stadium
*/
function GoogleTax()
{
	document.write ("<input TYPE=\"hidden\" NAME=\"tax_us_state\" Value=\"WI\">");
	document.write ("<input TYPE=\"hidden\" NAME=\"tax_rate\" Value=\".051\">");
}

/*
    * item_name_# * - The parameter value identifies the name of the item.
    * item_description_# * - The parameter value provides a description of the item.
    * item_quantity_# - The parameter value identifies how many units of a particular item are included in the customer's shopping cart.
    * item_price_#* - The parameter value identifies the price of the item.
    * item_currency_# - The parameter value identifies the currency for the item price. The default value is USD (U.S. dollars).
    * item_hidden_data_# - The parameter value contains additional information that should accompany an individual item in an order.

   <input type="hidden" name="item_name_1" value="Peanut Butter"/>
    <input type="hidden" name="item_description_1" value="Chunky peanut butter."/>
    <input type="hidden" name="item_quantity_1" value="1"/>
    <input type="hidden" name="item_price_1" value="3.99"/>
*/

function OneGoogleItem(itemNum,ID)
{
	document.write ("<input TYPE=\"hidden\" NAME=\"item_name_"+itemNum+"\" Value=\""+Prints[ID].name+"\">");
	if (Prints[ID].cost > 0)
	{
		document.write ("<input TYPE=\"hidden\" NAME=\"item_description_"+itemNum+"\" Value=\"Gil Reid Art\">");
	} else {
		document.write ("<input TYPE=\"hidden\" NAME=\"item_description_"+itemNum+"\" Value=\"Gil Reid Art - Out Of Print/Unavailable\">");
	}		
	document.write ("<input TYPE=\"hidden\" NAME=\"item_quantity_"+itemNum+"\" Value=\"1\">");
	document.write ("<input TYPE=\"hidden\" NAME=\"item_price_"+itemNum+"\" Value=\""+Prints[ID].cost+"\">");
	document.write ("<input TYPE=\"hidden\" NAME=\"item_hidden_data_"+itemNum+"\" Value=\"Cart Item ID:"+ID+"\">");
}

function CreateGoogleCart(){
	var thecart= GetCookie("ReidCart");
	if (thecart != null) {
		var whichids = thecart.split(",");
		var numItems = 0;
		for(var i=0; i < whichids.length ; i++) {
			var thisid = parseInt(whichids[i]);
			numItems++;
			OneGoogleItem(numItems,thisid);
		}
	}
	GoogleTax();
	GoogleShipping();
}


function OLDPrintCartSummary(){

	document.write ("<div align=\"center\"><center>");
	document.write ("<table border=\"0\">");
	document.write ("<tr>");
	document.write ("<td width=\"100%\" colspan=\"2\"><small><p align=\"center\"><img src=\"pics/cart2.gif\"");
	document.write ("alt=\" Cart\" align=\"center\" WIDTH=\"35\" HEIGHT=\"20\"><strong><font color=\"#FF0000\">");
	document.write ("&nbsp;&nbsp;&nbsp; Shopping Cart</font></strong><img src=\"pics/cart2.gif\" alt=\" Cart\"");
	document.write ("align=\"center\" WIDTH=\"35\" HEIGHT=\"20\"></small></td>");
	document.write ("</tr>");
	document.write ("<tr>");
	document.write ("<td width=\"50%\" align=\"center\"><small>");

	var thecart= GetCookie("ReidCart");
	var totitems= 0;
	var totcost= 0;
	if (thecart != null) {
		var whichids = thecart.split(",");
		for(var i=0; i < whichids.length ; i++) {
			var thisid = parseInt(whichids[i]);
			if (Prints[thisid].cost > 0) {
				totcost += Prints[thisid].cost;
				totitems++;
			}
		}
	}
	document.write ("Items in cart: "+totitems+ "<BR>");
	document.write ("Current Subtotal: $"+ format(totcost)+ "<BR>");

	document.write ("&nbsp; </small></td>");
	document.write ("<td width=\"50%\" align=\"center\"><p align=\"left\"><small><a href=\"cart.htm\">Checkout/Inspect");
	document.write ("Cart</a></small></td>");
	document.write ("</tr>");
	document.write ("</table>");
	document.write ("</center></div>");

}


var expdate = new Date ();
FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now 

// end global script -->
