var debug_out = 0;
var global_load=0;
var body_width=550;
var painting_name="Unknown Work";
<!-- //

if (document.images) {
	a=new Image(200,103);a.src="./toc.gif";
	a=new Image(20,33);a.src="./oneblur.gif";
}

function out(line)
{
	
	if ( debug_out == 0 ) {
		document.writeln (line);
	} else {
		re = /</gi;
		line = line.replace (/</g, "(");
		line = line.replace (/>/g, ")");
		document.writeln (line + "<br>");
	}
	
}

function msg(foo)
{
	window.status = foo;
}

function Toggle(place, pic)
{
	if (document.images) {
		if (place.prev == null) {
			alert ("name " + place.name);
			place.prev = place.src;
			place.src = pic.src;
		} else {
			var tmp;
			tmp = place.prev;
			place.prev = place.src;
			place.src = tmp;
		}
	}
}

function nothing() {}


function Out(place, pic)
{
	if (document.images) {
		place.src = "one.gif";
	}
}

function CheckAppVersion()
{
	//writeln ("name: " + navigator.appName);
	//writeln ("<br> vers: " + navigator.appVersion);

	//name: Microsoft Internet Explorer 
	//vers: 4.0 (compatible; MSIE 4.01; Windows 98) 

	//name: Netscape 
	//vers: 3.0 (Win95; U) 

	good=true;
	name=navigator.appName;

	if (name == "Microsoft Internet Explorer") {
			major = navigator.appVersion.charAt(0);
			if (major < 4) {
				good=false;
			}
	} else {
		if (name == "Netscape") {
			major = navigator.appVersion.charAt(0);
			if (major < 4) {
				good=false;
			}
		}
	}
	return (good);
}

function LinkObjByName (name)
{
	// this doesn't work in NN4. It does work in IE3.
	var i;
	for (i = 0 ; i < document.links.length; i++) {
		if (document.links[i].name == "") {
			alert ("link " + i + " is  null ");
		} else {
			alert ("nonnull : " + document.links[i].name);
		}

		if (document.links[i].name == name) {
			return (document.links[i]);
		}
	}
	return (documents.links[0]);
}

function ImgObjByName (name)
{
	var i;
	for (i = 0 ; i < document.images.length; i++) {
		if (document.images[i].name == name) {
			return (document.images[i]);
		}
	}
	return (document.images[0]);
}

function InitImage (img)
{
	/* 
	 * The orig is foo.gif, the hightlight is foo_h.gif.
	 * Strip off the .gif (the last 4 characters), add _h and the last 4.
	 */
	var t;
	var len = img.src.length - 4;
	img.orig = img.src;
	t = img.src.substring (0, len);
	t += "_h";
	t += img.orig.substring (len, len + 4);
	img.high = t;
}

function LoadRolloversIntoCache()
{
	var i;
	var img;

	for (i = 0 ; i < document.images.length; i++) {
		img = document.images[i];
		if ( img.name != "" ) {
			InitImage(img);

			// This new Image() stuff just forces it into cache.
			var tmpimg = new Image();
			tmpimg.src = img.high;
		}
	}
}

function Flip(name)
{
	var img;
	img = ImgObjByName (name);
	if (img.orig == null) {
		InitImage (img);
	}

	if (img.src == img.orig) {
		img.src = img.high;
	} else {
		img.src = img.orig;
	}
}

function WriteRollover (url, graphic, name)
{
	document.write ("<a href=" + url + " onMouseOver=\"Flip('" + name + "')\" onMouseOut=\"Flip('" + name + "')\"><img name=" + name + " src=" + graphic + " border=0></a>");
}

function WriteRolloverSlow (url, graphic, name)
{
	// make more generic later by passing in the src string, not
	// the name. Take the name from the source string.
	document.writeln ("<a href=" + url);
	document.writeln ("onMouseOver=\"Flip('" + name + "')\"");
	document.writeln ("onMouseOut=\"Flip('" + name + "')\"");
	document.writeln ("><img name=" + name);
	document.writeln ("src=" + graphic);
	document.writeln ("border=0");
	document.write   ("></a>");
}

function WriteArtistLine (url, image, name, slogan)
{
	// make more generic later by passing in the src string, not
	// the name. Take the name from the source string.
	document.writeln ("<tr><td>");
	WriteRollover (url, image, name);
	document.writeln ("</td><td class=\"aline\">&nbsp;" + slogan + "</td></tr>");
}

function OnLoad()
{
	app=navigator.appName.substring(0,1);
	// If browser doesn't support document.images, revert.

	LoadRolloversIntoCache();
}

var relocate_url;

function RelocateCB()
{
	msg ("in RelocateCB");
	location.href=relocate_url;
}

function Relocate(url)
{
	//date=new Date();
	//time = date.toLocaleString();
	//msg (time);
	relocate_url = url;
	window.setTimeout('RelocateCB()', 2000);
	//location.href=url;
}

/*
** These functions come from Adobe Image Ready.
*/

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		purchase_button_01_over = newImage("images/purchase_button_01-over.gif");
		purchase_button_01_down = newImage("images/purchase_button_01-down.gif");
		preloadFlag = true;
	}
}
// End Adobe Image Ready functions.

function LeafPageold()
{
	preloadImages();
	out ('<a href="' + port + '.htm"><img border=0 src="' + tag + '.jpg"');
	out ('alt="' + title + '" border=0></a>');

	if (sold) {
		out ('<div class=sold>SOLD</div>');
	}
	out ('<div class=title>' + title + '</div>');
	out ('<div class=subt>' + dimen + '&nbsp;&nbsp;' + medium + '</div>');
	out ('<div class=copy>&copy;&nbsp;' + artist + '</div>');
	
	if ( price != "0" && price != "" ) {
		out ('<div class=price>' + price + '</div>');
	}

	if (sold != 1 && gallery != "" ) {
		out ("This painting is currently exhibited at");
		out ('<div class=gall>' + gallery );
		if ( gphone != "" ) {
			out (' - ' + gphone );
		}
		out ('</div>');
	}

	if ( sold != 1 ) {
		//out ('<div class=pur><a href="purchase.htm">Purchase</div>');

		// testing developing code here:
		tag='tester2';
		//out ('<A HREF="' + tag + '.htm"');
		out ('<A HREF="#"');
		out ('ONMOUSEOVER="changeImages(\'purchase_button_01\', \'images/purchase_button_01-over.gif\'); return true;"');
		out ('ONMOUSEOUT="changeImages(\'purchase_button_01\', \'images/purchase_button_01.gif\'); return true;"');
		out ('ONMOUSEDOWN="changeImages(\'purchase_button_01\', \'images/purchase_button_01-down.gif\'); return true;"');
		out ('ONMOUSEUP="changeImages(\'purchase_button_01\', \'images/purchase_button_01-over.gif\'); return true;"');
		out ('ONCLICK="xxx(\'' + tag + '\')">');
		//out ('ONCLICK="DisplayPurchasePage(\"' + title + '\")">');

		out ('<IMG NAME="purchase_button_01" SRC="images/purchase_button_01.gif" vspace=5 WIDTH=102 HEIGHT=34 BORDER=0></A>');
	}
	
	Contact(1);
	HomeLine();
}

function LeafPage()
{
	preloadImages();
	out ('<a href="' + port + '.htm"><img border=0 src="' + tag + '.jpg"');
	out ('alt="' + title + '" border=0></a>');

	if (sold) {
		out ('<div class=sold>SOLD</div>');
	}
	out ('<div class=title>' + title + '</div>');
	out ('<div class=subt>' + dimen + '&nbsp;&nbsp;' + medium + '</div>');
	out ('<div class=copy>&copy;&nbsp;' + artist + '</div>');
	
	if ( price != "0" && price != "" ) {
		out ('<div class=price>' + price + '</div>');
	}

	if (sold != 1 && gallery != "" ) {
		out ("This painting is currently exhibited at");
		out ('<div class=gall>' + gallery );
		if ( gphone != "" ) {
			out (' - ' + gphone );
		}
		out ('</div>');
	}

	if ( sold != 1 ) {
		//out ('<div class=pur><a href="purchase.htm">Purchase</div>');

		out ('<img NAME="purchase_button_01" SRC="images/purchase_button_01.gif" vspace=5 WIDTH=102 HEIGHT=34 BORDER=0 ');
		out ('ONMOUSEOVER="changeImages(\'purchase_button_01\', \'images/purchase_button_01-over.gif\'); return true;"');
		out ('ONMOUSEOUT="changeImages(\'purchase_button_01\', \'images/purchase_button_01.gif\'); return true;"');
		out ('ONMOUSEDOWN="changeImages(\'purchase_button_01\', \'images/purchase_button_01-down.gif\'); return true;"');
		out ('ONMOUSEUP="changeImages(\'purchase_button_01\', \'images/purchase_button_01-over.gif\'); return true;"');
		// We want ONCLICK="DisplayPurchasePage('my title')"
		// Substitute \' for any '.
		title = title.replace (/\'/g, "\\\'");
		out ('ONCLICK=\"DisplayPurchasePage(\'' + title + '\')\"');
		out('>');
	}
	
	Contact(1);
	HomeLine();
}

function PortraitLeafPage()
{
	preloadImages();
	out ('<a href="' + port + '.htm"><img border=0 src="' + tag + '.jpg"');
	out ('alt="' + title + '" border=0></a>');

	out ('<div class=title>' + title + '</div>');
	//out ('<div class=subt>' + dimen + '&nbsp;&nbsp;' + medium + '</div>');
	out ('<div class=copy>&copy;&nbsp;' + artist + '</div>');
	
	//if ( price != "0" && price != "" ) {
	//	out ('<div class=price>' + price + '</div>');
	//}

	if ( sold != 1 ) {
		//out ('<div class=pur><a href="purchase.htm">Purchase</div>');

		out ('<a href=./portrait_prices.htm>');
		out ('<img NAME="prices_button_01" SRC="images/prices_button_01.gif" vspace=5 WIDTH=102 HEIGHT=34 BORDER=0 ');
		out ('ONMOUSEOVER="changeImages(\'prices_button_01\', \'images/prices_button_01-over.gif\'); return true;"');
		out ('ONMOUSEOUT="changeImages(\'prices_button_01\', \'images/prices_button_01.gif\'); return true;"');
		out ('ONMOUSEDOWN="changeImages(\'prices_button_01\', \'images/prices_button_01-down.gif\'); return true;"');
		out ('ONMOUSEUP="changeImages(\'prices_button_01\', \'images/prices_button_01-over.gif\'); return true;"');
		// We want ONCLICK="DisplayPurchasePage('my title')"
		// Substitute \' for any '.
		//title = title.replace (/\'/g, "\\\'");
		//out ('ONCLICK=\"DisplayPurchasePage(\'' + title + '\')\"');
		out('></a>');
	}
	
	Contact(1);
	HomeLine();
}

function NewRow(index)
{
	if (index > 0) {
		out ('</tr><tr>');
	} else {
		out ('<tr>');
	}
}

function Title(t)
{
	out ("<title>" + t + "</title>");
}

function Titlesx()
{
	//out ('<style> TD { text-align: center; } </style>');

	out ('<table border=0><tr><td valign=top width=' + body_width + '>');
	if (artisti != "") {
		out ('<img src=' + artisti + ' alt="' + artist + '">');
	} else {
		out ('<h1>' + artist + '</h1>');
	}

	if (titlei != "") {
		out ('<br><img src=' + titlei + ' alt="' + title + '">');
	} else {
		out ('<br><h2>' + title + '</h2>');
	}
	out ('</td></tr></table>');
}

function Titles()
{
	//out ('<style> TD { text-align: center; } </style>');

	out ('<center>');
	out ('<img src=' + artisti + ' alt="' + artist + '">');

	if (titlei != "") {
		out ('<br><img src=' + titlei + ' alt="' + title + '">');
	}
	out ('</center>');
}

function Contact(horiz)
{
	//out ('<a href="email_form.htm"><span style="font-size:14pt;">lori@lwsimons.com</span></a><br>');
	//out ('<a href="email_form.htm">lori@lwsimons.com</a><br>');
	//out ('<a href="email_form.htm"><span class=aemail>lori@lwsimons.com</span></a><br>');
	//out ('<span class=a800>Toll free: (800) 204-4332</span><br>');
	//out ('<span class=aMHT>Manchester, NH: (603) 647-0025</span><br>');
	//out ('<span class=f1>Manchester, NH: (603) 647-0025</span><br>');
	//out ('Manchester, NH: (603) 647-0025<br>');

	if (horiz) {
		out ('<center><div class=small>');
		out ('<a href="email_form.htm">lori@lwsimons.com</a>&nbsp;&nbsp;&nbsp;');
		out ('(800) 204-4332&nbsp;&nbsp;&nbsp;');
		out ('(603) 647-0025<br>');
		out ('L.W. Simons Fine Art &nbsp; / &nbsp; Box 14A &nbsp; / &nbsp; 55 So. Commercial St. &nbsp; / &nbsp; Manchester, NH 03101');
		out ('</div></center>');
	} else {
		out ('<p><a href="email_form.htm"><span class=aemail>lori@lwsimons.com</span></a><br>');
		out ('<span class=a800>Toll free: (800) 204-4332</span><br>');
		out ('<span class=aMHT>Manchester, NH: (603) 647-0025</span></p><br>');
	}
}

function HomeLine()
{
	out ('<div class=bottom><a href=home.htm>Home</a></div>');
}

function PortPage()
{
	Titles();

	// The thumbnail pictures
	//out ('<table  border=1 class="pic" width=' + (body_width-100) + '>');
	out ('<center><table  border=0 class="pic" >');
	for (i = 0 ; i < names.length; i++) {
		if ( (i % table_width) == 0) {
			NewRow(i);
		}
		tag=names[i];
		dsc=names[++i]
		out ('<td class=pic><a href="' + tag + '.htm">');
		out ('<img border=0 src="' + tag + '_t.jpg"');
		out ('alt="' + dsc + '"></a></td>');
	}

	out ('</tr><tr><td colspan=' + table_width + '>');
	Contact(1);
	out ('</td></tr></table></center>');

	HomeLine();
}

function MainTableBegin()
{
	// This implements a technique for getting the bulk of 
	// your information (not the TOC) near the top of the page.
	// Begin a table, 2 x 2 cells.
	// Write a table cell, empty.
	// Write a table cell, rowspan=2, your main content.
	// next row
	// Write a table cell, the TOC
	// End table.

	//   MainTableBegin -- begins the main body cell
	//   MainTableToc   -- begins the table of contents cell
	//   MainTableEnd   -- closes the table.

	//out ('<table border=0><tr><td><img src=p.gif height=20></td><td rowspan=2>');

	out ('<table width="100%" border=0><tr><td height=10></td><td rowspan=2 valign=top>');
	out ('<!-- THIS IS THE BODY CELL -->');
}

function MainTableToc()
{
	// MainTableToc   -- begins the table of contents cell
	//out ('</td></tr><tr><td valign=top class=toc style="text-align: left;">');
	out ('</td></tr><tr><td valign=top class=toc>');
	out ('<!-- THIS IS THE TOC CELL -->');
}

function MainTableEnd()
{
	// MainTableEnd   -- closes the table.
	out ('</td></tr></table>');
}

function TocLinet(x, url, text)
{
	prefix='';
	spaces = parseInt(text);
	if (spaces != NaN && spaces > 0) {
		for (i = 0 ; i < spaces; i++) {
			prefix = prefix + '&nbsp;';
		}
		text = text.substring (1, 999);
	}

	if (x == text) {
		c="tochere";
	} else {
		c="toc";
	}

	if (text == "Purchase") {
		window.document.cookie="painting_name=Unknown";
	}
	
	if (url != '') {
		out ('<tr><td class=' + c + '>' + prefix + '<a href="' + url + '">' + text + '</a></td></tr>');
	}

	if (url == '') {
		out ('<tr><td class=' + c + '>' + prefix + text + '</td></tr>');
	}
}

function TocLinei(url, text, image)
{
	if (url != '' && image != '') {
		out ('<tr><td class=toc><a href="' + url + '"><img border=0 src=' + image + ' alt="' + text + '"></a></td></tr>');
	}

	if (url == '' && image != '') {
		out ('<tr><td class=toc><img border=0 src=' + image + ' alt="' + text + '"></a></td></tr>');
	}
}

function TocLineClasst(cname, url, text)
{
	if (url != '') {
		out ('<tr><td class=' + cname + '><a href="' + url + '">' + text + '</a></td></tr>');
	}

	if (url == '') {
		out ('<tr><td class=' + cname + '>' + text + '</td></tr>');
	}
}

function TocLineClassi(cname, url, text, image)
{
	if (url != '' && image != '') {
		out ('<tr><td class=' + cname + '><a href="' + url + '"><img border=0 src=' + image + ' alt="' + text + '"></a></td></tr>');
	}

	if (url == '' && image != '') {
		out ('<tr><td class=' + cname + '><img border=0 src=' + image + ' alt="' + text + '"></a></td></tr>');
	}
}

function DisplayPurchasePage(painting_name)
{
	window.document.cookie='painting_name=' + painting_name;
	window.document.location='./purchase.htm';
	//alert (painting_name);
}

function GetPaintingName()
{
	mys = new String (window.document.cookie);
	//window.document.cookie="painting_name=Unknown";
	//document.writeln ("<br>mys: " + mys);

	i=mys.indexOf("painting_name=");
	if (i < 0) {
		return ("Unknown");
	}

	mys=mys.substr(i+14, 999);
	i=mys.indexOf(";");
	if (i < 0) {
		return (mys);
	}

	name = mys.substr(1, i);
	return (name);
}

function Banner(highlight)
{
	var c1 = "button";
	var c2 = "button";
	var c3 = "button";
	var c4 = "button";

	if (highlight == 1) {
		c1 = "buttonhere";
	}
	if (highlight == 2) {
		c2 = "buttonhere";
	}
	if (highlight == 3) {
		c3 = "buttonhere";
	} 
	if (highlight == 4) {
		c4 = "buttonhere";
	} 

	out ('\
<table border=0 cellspacing=0 width=590 align=center>\
<tr>\
<td rowspan=3>\
	<img border="0" src="images/star4wy.gif" height=100>\
</td>\
<td rowspan=3>\
	<img src=images/p.gif border=0 width=10 height=10>\
</td>\
<td colspan=7 valign=bottom>\
	<img border="0" src="images/hebrewwitness_titleblue375.gif" alt="Hebrew Witness" \
		width=372\
		height=47>\
</td>\
<td rowspan=3>\
	<img src=images/p.gif border=0 width=10 height=10>\
</td>\
<td rowspan=3>\
	<img border="0" src="images/chan1b.gif" height=100>\
</td>\
</tr>\
<tr align=center>\
<td class=' + c1 + ' width=125>\
	<a class=' + c1 + ' href="index.htm">Home</a>\
</td>\
<td><img src=images/p.gif width=5></td>\
<td class=' + c2 + ' width=125>\
	<a class=' + c2 + ' href="picturesofsamdocument.htm">Credentials</a>\
</td>\
<td><img src=images/p.gif width=5></td>\
<td class=' + c3 + ' width=125>\
	<a class=' + c3 + ' href="aboutthewriter.htm">About Us</a>\
</td>\
</tr>\
<tr><td class=buttonhere colspan=7><img src=images/p.gif height=4></td></tr>\
</table>\
<!-- ################### end of standard header ################### -->\
		');
}

// --> 
