// JavaScript Document

var currImg = 0;

var current = new Array();
var abstract = new Array();
var figurative = new Array();
var landscapes = new Array();

// filename        Painting Title       	Date         type of work                size           status
current = [
"shipwrecked",      "Ship Wrecked",         "2012",     "oil on canvas",        "44 x 50",      "available",
"mypatches",        "My Patches",           "2012",     "oil on canvas",        "36 x 48",      "available",
"myworld",          "My World",             "2012",     "oil on canvas",        "44 x 50",      "available",
"atdocks",          "At Docks",             "2011",     "oil on canvas",        "44 x 50",      "available",
"stacks",           "Stacks",               "2011",     "oil on canvas",        "44 x 50",      "available",
"transparent",      "Transparent",          "2011",     "oil on canvas",        "20 x 24",      "available",
"industrial bay",   "Industrial Bay",       "2011",     "oil on canvas",        "46 x 50",      "available",
"foundation",       "Foundation",           "2011",     "oil on canvas",        "46 x 50",      "available",
"headdress",        "Head Dress",           "2011",     "oil on canvas",        "52 x 44",      "available",
"genesis",          "Genesis",              "2011",     "oil on canvas",        "52 x 44",      "available",
"industrial",       "Industrial",           "2011",     "oil on canvas",        "48 x 40",      "available", 
"bayarea",          "Bay Area",             "2011",     "oil on canvas",        "36 x 48",      "available",
"mycorset",         "My Corset",            "2011",     "oil on cansas",        "48 x 42",      "available",
"attached",         "Attached",             "2011",     "oil on canvas",        "48 x 42",      "available",
"moms memory",      "In Mothers Memory",    "2011",     "oil on canvas",        "48 x 56",      "available",
"shastatea",        "Shasta Tea Cup",       "2011",     "oil on canvas",        "44 x 55",      "available",
"ghostdancer1",     "Ghost Dancer",         "2011",     "oil on canvas",        "52 x 44",      "available",
"rainbowl",         "Rain Bowl",            "2011",     "oil on canvas",        "56 x 44",      "available",
"catcher",          "Catcher",              "2011",     "oil on canvas",        "48 x 52",      "available",
"lookingback",      "Looking Back",         "2011",     "oil on canvas",        "56 x 48",      "available",
"creature",         "Creature",             "2011",     "oil on canvas",        "36 x 52",      "available",
"weavingpaint",     "Weaving Paint",        "2011",     "oil on canvas",        "36 x 48",      "available",
"neoncity",         "Neon City",            "2011",     "oil on canvas",        "46 x 50",      "available",
"myrainbow",        "My Rainbow",           "2011",     "oil on canvas",        "48 x 56",      "available",
"urbanplayground",  "Urban Playground",     "2011",     "oil on canvas",        "48 x 56",      "available", 
"object",           "Object",               "2011",     "oil on canvas",        "46 x 56",      "available",
"softandtender",    "Soft and Tender",      "2011",     "oil on canvas",        "48 x 56",      "available",
"theclearing",      "The Clearing",         "2011",     "oil on canvas",        "52 x 44",      "available",
"sffog",             "S.F. Fog",            "2011",     "oil on canvas",        "32 x 42",      "available",    
"bluedot",          "Blue Dot",             "2011",     "oil on canvas",        "52 x 54",      "available",
"peoplessole",      "Peoples Sole",         "2011",     "oil on canvas",        "50 x 64",      "sold",
"thedocks",         "The Docks",            "2011",     "oil on canvas",        "48 x 48",      "available",
"suspend",          "Suspend",              "2011",     "oil on canvas",        "48 x 48",      "available",
"cheers",           "Cheers",               "2011",     "oil on canvas",        "24 x 30",      "available", 
"twodegrees",       "Two Degrees",          "2011",     "oil on canvas",        "52 x 60",      "available",
"oceania",          "Oceania",              "2011",     "oil on canvas",        "52 x 44",      "available",
"dreamcircus",      "Dream Circus",         "2011",     "oil on canvas",        "52 x 60",      "available",
"frosttag",         "Frost Tag",            "2011",     "oil on canvas",        "20 x 16",      "available",
"secretinsketch",   "Secret in Sketch",     "2011",     "oil on canvas",        "54 x 64",      "available",
"spill",            "Spill",                "2011",     "oil on canvas",        "52 x 64",      "available",
"mystery",          "Mystery",              "2011",     "oil on canvas",        "52 x 64",      "available",
"falls",            "Falls",                "2011",     "oil on canvas",        "54 x 65",      "available",
"screen",           "Screen",               "2011",     "oil on canvas",        "48 x 54",      "available",
"walltheory",       "Wall Theory",          "2010",     "oil on canvas",        "60 x 72",      "available",  
"oldschool",        "Old School",           "2010",     "oil on canvas",        "36 x 48",      "available",   
"student",          "Student",              "2010",     "oil on cvanvas",       "36 x 48",      "available", 
"wipedout",         "Wiped Out",            "2010",     "oi on canvas",         "48 x 60",      "sold",
"mistyday",         "Misty Day",            "2010",     "oil on ccanvas",       "36 x 60",      "available",
"blueseason",       "Blue Season",          "2010",     "oil on canvas",        "48 x 48",      "available",
"reflection",       "Reflection",           "2010",     "oil on canvas",        "48 x 60",      "available",
"power",            "Power",                "2011",     "oil on canvas",        "48 x 56",      "available", 
"scratchbounce",    "Scratch And Bounce",   "2010",     "oil on canvas",        "36 x 48",      "available",
"nameit1",          "Name It",              "2010",     "oil on canvas",        "36 x 48",      "available",
"jerryspassage",    "Jerry's Passage",      "2010",     "oil on canvas",        "60 x 48",      "available",
"turningcorner",    "Turning Corner",       "2010",     "oil on canvas",        "60 x 48",      "available",
"chinatown",        "China Town",           "2010",     "oil on canvas",        "30 x 24",      "sold",
"witchesnight",     "Witches Night",        "2010",     "oil on canvas",        "30 x 24",      "sold",
"toybox",           "Toy Box",              "2010",     "oil on canvas",        "68 x 52",      "available",
"scratchthrough",   "Scratch Through",      "2010",     "oil on canvas",        "72 x 60",      "available",
"childsplay",       "Childs Play",          "2010",     "oil on canvas",        "72 x 60",      "available",  
"transportation",   "Transportation",       "2010",     "oil on canvas",        "48 x 48",      "sold",
"openwings",        "Open Wings",           "2010",     "oil on canvas",        "48 x 48",      "sold",
"outofthebox",      "Out Of the Box",       "2010",     "oil on canvas",        "48 x 60",      "sold",
"indianmist",       "Indian Mist",          "2010",     "oil on canvas",        "30 x 40",      "sold",  
"fiesta",           "Fiesta",               "2010",     "oil on canvas",        "58 X 78",      "sold", 
"stockings",        "Stockings",            "2010",     "oil on canvas",        "48 x 60",      "availabe",
"docked",           "Docked",               "2010",     "oil on canvas",        "48 x 72",      "sold",
"Dreaming",         "Dreaming",             "2010",     "oil on canvas",        "30 x40",       "available",
"chantersbridge",   "Chanters Bridge",      "2010",     "oil on canvas",        "36 x 48",      "available",   
"warrior",          "Warrior",              "2010",     "oil on canvas",        "36 x 48",      "available",
"fallingarrow",     "Falling Arrow",        "2010",     "oil on canvas",        "58 x 48",      "available",
"scratchingthrough","Scratching Through",   "2010",     "oil on canvas",        "53 x 59",      "sold",
"rainbowexcavation","Rainbow Excavation",   "2010",     "oil on canvas",        "30 x 40",      "sold",  
"viewinside",       "View Inside",          "2010",     "oil on canvas",        "30 x 40",      "available",
"brokentreaty",     "Broken Treaty",        "2010",     "oil on canvas",        "30 x 40",      "sold",
"cooler",           "Cooler Enviroment",    "2010",     "oil on canvas",        "36 x 24",      "sold",
"ensueno",          "Ensueno",              "2010",     "oil on canvas",        "30 x 40",      "available",  
"teacup",           "Tea Cup",              "2010",     "oil on canvas",        "30 x 40",      "available",
"rainbow",          "Rainbow",              "2010",     "oil on canvas",        "30 x 40",      "sold",
"snow",             "Snow Cone Man",        "2010",     "oil on canvas",        "30 x 40",      "sold",
"bridge",           "Grid and Bridges",     "2010",     "oil and canvas",       "30 x 40",      "available",
"entrance",         "Entrance",             "2010",     "oil on canvas",        "30 x 40",      "available",
"mycasa",           "My Casa",              "2010",     "oil on canvas",        "34 x 46",      "available",  
"scribbles",        "Scribbles",            "2010",     "oil on canvas",        "30 x 40",      "sold",
"nameit",           "Name It",              "2010",     "oil on canvas",        "30 x 40",      "sold",
"atomicteepee",     "Atomic Tee Pee",       "2010",     "oil on canvas",        "30 x 40",      "available",
"dreamcatcher",     "Dream Catcher",        "2010",     "oil on canvas",        "30 x 40",      "available",
"foglift",          "Fog Lifting",          "2010",     "oil on canvas",        "24 x 36",      "sold",
"windows",          "Windows",              "2010",     "oil on canvas",        "16 x 19.5",    "sold",
"moccasinlake",     "Moccasin Lake",        "2010",     "oil on canvas",        "24 x 36",      "sold",
"poppingout",       "Popping Out",          "2010",     "oil on canvas",        "36 x 48",      "sold",
"arrowfeather",     "Arrow Feather Sails",  "2010",     "oil  on canvas",       "30 x 36",       "sold",
"bluespot",         "Blue Spot",            "2010",     "oil on canvas",        "29 x 36",      "available",
"vessels",          "Vessels",              "2010",     "oil on canvas",        "48 x 36",      "sold",
"powwow",           "Pow Wow",              "2010",     "oil on canvas",        "48 x 48",      "available",
"angles",           "Angles",               "2010",     "oil on canvas",        "36 x 48",      "sold",
"bird on a wire",   "Bird On A Wire",       "2010",     "oil on canvas",        "48 x 48",      "sold",
"gette",            "Gette",                "2007",     "oil on canvas",        "36 x 48",      "available",
"mylovingoso",      "My Loving Oso",        "2009",     "oil on Canvas",        "50 x 40",      "available",
"lookingglass",     "Looking Glass",        "2009",     "oil on canvas",        "58 x 62",      "sold",
"dreaming fields",  "Dreaming Fields",      "2009",     "oil on canvas",        "36 x 48",      "sold",
"dreamweaver",      "Dream Weaver",         "2009",     "oil on canvas",        "36 x 48",      "sold",
"explosion", 		"Explosion",			"2008",		"Oil on 2 canvases",	"36 x 72",		"sold",
"paintsplotch", 	"Paint Splotch",		"2008",		"Oil on canvas",		"36 x 48",		"sold",
"cameo", 			"Cameo",				"2008",		"Oil on canvas",		"60 x 48",		"sold",
"shaman", 			"Shaman",				"2008",		"Oil on canvas",		"36 x 48",		"sold",
"wonder", 			"Wonder",				"2008",		"Oil on canvas",		"60 x 48",		"sold",
"tribal", 			"Tribal",				"2008",		"Oil on canvas",		"36 x 48",		"avasilable",
"pushing", 			"Pushing Black",		"2009",		"Oil on 2 canvases",	"72 x 36",		"available",
"panels", 			"Panels",				"2008",		"Oil on 2 canvases",	"72 x 48", 		"sold",
"inside", 			"Inside",				"2008",		"Oil on canvas",		"36 x 48",		"available",
];

abstract = [
"rosebud",          "Rose Bud",             "2007",     "oil on canvas",        "36 x 48",      "sold",
"newyear",          "New Year",             "2007",     "oil on canvas",        "36 x 36",      "sold",
"childlike",        "Childlike",            "2004",     "oil on canvas",        "55 x 65",      "sold",
"iceland",          "Iceland",              "2007",     "oil on canvas",        "48 x 48",      "available",
"funny",            "Funny Pages",          "2008",     "oil on canvas",        "36 x 48",      "available",
"animated",         "Animated",             "2008",     "oil on canvas",        "36 x 48",      "available",
"catsanddogs",      "Cats and Dogs",        "2010",     "oil on canvas",        "30 x 24",      "sold",
"burst", 			"Burst",				"2007", 	"Oil on canvas",		"36 x 48",		"sold",
"child", 			"Child",				"2007", 	"Oil on canvas",		"36 x 48",		"available",
"emc2", 			"EMC2",					"2007", 	"Oil on canvas",		"36 x 48",		"available",
"fold", 			"Fold",					"2007", 	"Oil on canvas",		"36 x 48",		"sold",
"dreams", 		    "Dreams",		        "2006", 	"Oil on canvas",		"40 x 60",		"sold",
"oval", 			"Oval",				    "2007", 	"Oil on canvas",		"14 x 18",		"available",
"abbey", 		    "Abbey",				"1998",		"Oil on canvas",		"48 x 72",		"sold",
"acuatico", 		"Acuatico",				"2008",		"Oil on canvas",		"36 x 48",		"sold",	
"cityscape", 		"Cityscape",			"2008",		"Oil on canvas",		"36 x 48",		"sold",
"secret", 			"Secret",				"2006",		"Oil on cavas",			"36 x 48",		"available",
"masquerade", 	    "Masquerade", 			"2007", 	"Oil on canvas", 		"48 x 48",		"sold",
"action", 			"Action", 				"2007", 	"Oil on canvas", 		"48 x 48", 		"available",
"atmosphere", 		"Atmosphere", 			"2007", 	"Oil on canvas", 		"60 x 48",		"sold",
"cricket", 			"Cricket",				"2007", 	"Oil on canvas", 		"48 x 48", 		"available",
"frosted", 			"Frosted", 				"2007", 	"Oil on canvas", 		"60 x 48",		"sold",
"livingcolor", 		"Living Color", 		"2007", 	"Oil on canvas", 		"36 x 48", 	    "solde",
"turtle", 			"Turtle", 				"2007", 	"Oil on canvas", 		"48 x 48", 		"available",
"wildriver", 		"Wild River", 			"2008", 	"Oil on canvas", 		"48 x 48", 		"sold",
"sensation", 		"Sensation", 			"2004", 	"Oil on canvas", 		"56 x 42", 	    "sold",
"corazones", 		"Corazones", 			"2008", 	"Oil on canvas", 		"36 x 48", 		"sold",
"icerose", 			"Ice Rose", 			"2008", 	"Oil on canvas", 		"36 x 48", 		"sold" 
];

figurative = [
"bluesman",         "Blues Man",            "2011",     "oil on canvas",        "16 x 20",      "available",
"innerme",          "Inner Me",             "2004",     "oil on canvas",        "16 x 20",      "available",
"attitude",         "Attitude",             "2011",     "oil on canvas",        "16 x 20",      "available",   
"jesus",            "jesus",                "2001",     "oil on canvas",        "56 x 64",     "available",
"surreal",          "Surreal",              "2001",     "oil on canvas",        "48 x 48",      "sold",
"vanished",         "Vanished",             "2010",     "oil on canvas",        "36 x 48",      "sold",    
"birdcompanion",    "Bird Companion",       "2003",     "oil on canvas",        "54 x 54",      "available",
"intersex",         "Intersex",             "2011",     "oil on canvas",        "30 x 40",      "available",
"cocky",            "Cocky",                "2004",     "oil on canvas",        "36 x 48",      "sold",
"lookhand",         "Look Hand",            "2003",     "oil on canvas",        "52 x 53",      "sold",
"blame",            "Blame",                "2000",     "oil on canvas",        "47 x 62",      "sold",
"evolution", 		"Evolution",			"2003",		"Oil on 2 canvases",	"60 x 40",		"available",
"flow",				"Flower Power",			"2003",		"Oil on canvas",		"53 x 52",		"sold",
"foggy", 			"Foggy",				"2003",		"Oil on canvas", 		"43 x 42",		"sold",
"krishna", 			"Krishna", 				"2003", 	"Oil on canvas", 		"36 x 59",		"available",
"01",	             "01", 		            "2004", 	"Oil on canvas", 		"36 x 48", 		"available",
"moderninfluence",	"Modern Influence",		"2004", 	"Oil on canvas", 		"50 x 67",		"sold",
"pleasepeace",		"Please Peace", 		"2004", 	"Oil on canvas", 		"52 x 72", 		"sold",
"lookhere",		    "Look Here",			"2000", 	"Oil on canvas", 		"53  x 50",     "sold",
"trueself",	        "True Self", 		    "2000", 	"Oil on canvas", 		"36 x 48", 		"sold",
"xyz",				"XYZ", 					"2004", 	"Oil on canvas", 		"48 x 36", 		"available"
];

landscapes = [
"marsh",            "Marsh",                "2004",     "oil on canvas",        "48 x 48",      "sold",
"mteagle",          "Mt Eagle",             "2004",     "oil on canvas",        "36 x 48",      "sold",
"featherfish",      "Feather Fish",         "2005",     "oil on canvas",        "36 x 48",      "sold",
"west",             "West",                 "2004",     "oil on canvas",        "48 x 48",      "sold",
"fivetrees",        "Five Trees",           "2004",     "oil on canvas",        "36 x 48",      "sold",
"california",		"California", 			"2004", 	"Oil on canvas", 		"48 x 48", 		"sold",
"warm",			    "Warm",			        "2004",		"Oil on canvas",		"48 x 48",		"sold",
"mt.water",			"Mt. Water", 			"2004", 	"Oil on canvas", 		"36 x 48",		"sold",
"skyview",			"Sky View", 			"2004", 	"Oil on canvas", 		"48 x 60", 		"sold",
"heartland",		"Heartland", 			"2004", 	"Oil on canvas", 		"48 x 48", 		"sold",
"bayview",			"Bayview", 			    "2005", 	"Oil on canvas", 		"48 x 72", 		"sold",
"saltbed",			"The Saltbeds", 		"2005", 	"Oil on canvas", 		"48 x 48", 		"sold",
"waterline",		"The Waterline", 		"2005", 	"Oil on canvas", 		"48 x 48",      "sold",
"flatstudy",		"Flat Study",		    "2005",		"Oil on canvas",		"48 x 48",		"available"	  
];


var dataPoints = 6;
var imgCt = (current.length + abstract.length + figurative.length + landscapes.length) / dataPoints;
var captionText = new Array();

var initialURL = document.URL;
var endofLocation = initialURL.indexOf('?') + 1;

var baseURL = initialURL.substring(0,endofLocation);

var stringlength = initialURL.length;
var myQueryString = initialURL.substring(endofLocation,stringlength);

var queryNumberBeginsAt = myQueryString.indexOf(':');
var queryNumber = Number(myQueryString.substring(queryNumberBeginsAt+1,myQueryString.length));
var sectionString = myQueryString.substring(0,queryNumberBeginsAt);
var startNumber = 0;
var showImage = 0;



if (sectionString == "current")
{
	startNumber = 0;
}

if (sectionString == "abstract")
{
	startNumber = (current.length/dataPoints);
}

if (sectionString == "figurative")
{
	startNumber = (current.length + abstract.length) / dataPoints;
}

if (sectionString == "landscapes")
{
	startNumber = (current.length + abstract.length + figurative.length) / dataPoints;
}


// Extract all the filenames out of the 4 arrays and build them into one new array.
var imgFileNames = new Array();

for (i = 0; i < current.length / dataPoints; i++)
{
	imgFileNames[i] = current[i * dataPoints];
}

var totalcurrent = i;

for (i = 0; i < abstract.length / dataPoints; i++)
{
	imgFileNames[i+totalcurrent] = abstract[i * dataPoints];
}

totalabstract = i;

for (i = 0; i < figurative.length / dataPoints; i++)
{
	imgFileNames[i+totalcurrent + totalabstract] = figurative[i * dataPoints];
}

totalfigurative = i;

for (i = 0; i < landscapes.length / dataPoints; i++)
{
	imgFileNames[i+totalcurrent + totalabstract + totalfigurative] = landscapes[i * dataPoints];
}

totallandscapes = i;

// Add all four arrays together to build a full 'captionText' array.

for (i = 0; i < current.length; i++)
{
	captionText[i] = current[i];
}
for (i = 0; i < abstract.length; i++)
{
	captionText[(totalcurrent*dataPoints)+i] = abstract[i];
		
}
for (i = 0; i < figurative.length; i++)
{
	captionText[((totalcurrent+totalabstract) * dataPoints )+i] = figurative[i];
	
}
for (i = 0; i < landscapes.length; i++)
{
	captionText[((totalcurrent+totalabstract+totalfigurative) * dataPoints)+i] = landscapes[i];
}

var slideNumber = startNumber;

if (queryNumber != 0)
{
	slideNumber = queryNumber;
}


if (endofLocation != 0)
{

	//We must be in the catalog page - or some non regular page
	if(sectionString=="catalog")
	{
	window.onload = buildCatalogPage;
	}
	else
	{
	if (sectionString=="slideshow")
	{
		window.onload = buildSlideShow;
	}
	else
	{
	window.onload = regularPage;
	}
	}
}

	
function regularPage() {
	
	currImg = slideNumber;
	
	var myHeader = "images/header_" + sectionString + ".gif";
	document.images["header"].src = myHeader;
		
	document.images["slide"].src = "images/" + imgFileNames[currImg] + ".jpg"; 

	document.getElementById("leftarrow").onclick  = processPrevious;
	
	document.getElementById("rightarrow").onclick  = processNext;
	document.getElementById("leftarrow").onmouseover = highlightMeLeft;
	document.getElementById("leftarrow").onmouseout = unhighlightMeLeft;
	document.getElementById("leftarrow").onmousedown = brightenMeLeft;
	
	document.getElementById("rightarrow").onmouseover = highlightMeRight;
	document.getElementById("rightarrow").onmouseout = unhighlightMeRight;
	document.getElementById("rightarrow").onmousedown = brightenMeRight;
	
	document.getElementById("myTitle").innerHTML = captionText[(currImg *dataPoints) + 1];
	document.getElementById("myDate").innerHTML = captionText[(currImg *dataPoints )+ 2];
	document.getElementById("myType").innerHTML = captionText[(currImg *dataPoints )+ 3];
	document.getElementById("mySize").innerHTML = captionText[(currImg *dataPoints )+ 4];
	
	if (captionText[(currImg *dataPoints) +5] == "sold")
	{
		document.images["sold"].src="images/sold.gif";
	}
	else
	{
		document.images["sold"].src = "images/available.gif";
	}
}

function highlightMeLeft() {
	document.images["leftarrow"].src="images/side_piece_on.gif";
}

function brightenMeLeft() {
	document.images["leftarrow"].src="images/side_piece1_down.gif";
}


function highlightMeRight() {
	document.images["rightarrow"].src="images/side_piece2_on.gif";
}

function unhighlightMeLeft() {
	document.images["leftarrow"].src="images/side_piece1.gif";
}

function unhighlightMeRight() {
	document.images["rightarrow"].src="images/side_piece2.gif";
}

function brightenMeRight() {
	document.images["rightarrow"].src="images/side_piece2_down.gif";
}


function processPrevious() {
	newPainting(-1);
}

function processNext() {
	newPainting(1);
}


function preloadMe() {
	if (document.images) {
		/* Preload the current Images  */
		for (i = 0; i < imgCt; i++)
		{
			captionText[i*dataPoints] = new Image;
			captionText[i*dataPoints].src = "images/" + captionText[i*dataPoints] + ".jpg";
		}
	}
		
		
}


function newPainting(direction)
{
	currImg = currImg + direction;

	if(currImg < 0) {
		currImg = imgCt-1;
	}
	if (currImg == imgCt) {
		currImg = 0;
	}

    if (currImg < totalcurrent)
	{
		sectionString = "current";
	}
	else 
	{
		if(currImg < (totalcurrent + totalabstract))
		{
			sectionString = "abstract";
		}
		else
		{
			if(currImg < (totalcurrent + totalabstract + totalfigurative))
			{
				sectionString = "figurative";
			}
			else
			{
				sectionString = "landscapes";
			}
		}
	}
	
	var newUrl = baseURL + sectionString + ":" + currImg;
	
	window.location = newUrl;

	window.refresh;
}

function buildCatalogPage()
{

	var fullCatalogString = "<p class='title'>Current</p>";
	var myRef = "";
	
	for (i = 0; i < totalcurrent; i++)
	{
	myRef = "painting_page.html?" + "current" + ":" + i;
	
	fullCatalogString += "<a href='"+ myRef +"'><img src='images/thumb_" + imgFileNames[i] + ".jpg' hspace='8' vspace='8'></a>";
	}
	
	fullCatalogString += "<br><p class='title'>Abstract</p>";
	for (i = 0; i < totalabstract; i++)
	{
		var myNumber = i+totalcurrent;
		myRef = "painting_page.html?" + "abstract" + ":" + myNumber;
		fullCatalogString += "<a href='"+ myRef +"'><img src='images/thumb_" + imgFileNames[myNumber] + ".jpg' hspace='8' vspace='8'></a>";
	}
	
	fullCatalogString += "<br><p class='title'>Figurative</p>";
	for (i = 0; i < totalfigurative; i++)
	{
		var myNumber = i+totalcurrent+totalabstract;
		myRef = "painting_page.html?" + "figurative" + ":" + myNumber;
		fullCatalogString += "<a href='"+ myRef +"'><img src='images/thumb_" + imgFileNames[myNumber] + ".jpg' hspace='8' vspace='8'></a>";
	}
	
	fullCatalogString += "<br><p class='title'>Landscapes</p>";
	for (i = 0; i < totallandscapes; i++)
	{
		var myNumber = i+totalcurrent+totalabstract+totalfigurative;
		myRef = "painting_page.html?" + "landscapes" + ":" + myNumber;
		fullCatalogString += "<a href='"+ myRef +"'><img src='images/thumb_" + imgFileNames[myNumber] + ".jpg' hspace='8' vspace='8'></a>";
	}
		
	document.getElementById("replaceMe").innerHTML = fullCatalogString;
}


function buildSlideShow() {
	showImage = -1;
	newSlide(1);
	
}


function newSlide(direction)	
{
	var totalslides = imgFileNames.length;
	showImage = showImage + direction;

	if(showImage < 0) {
		showImage = totalslides-1;
	}
	if (showImage == totalslides) {
		showImage = 0;
	}
	
   document.images["slide"].src = "images/" + imgFileNames[showImage] + ".jpg"; 
	document.getElementById("myTitle").innerHTML = captionText[showImage * dataPoints + 1];
	window.refresh;
		setTimeout("newSlide(1)",3000);	
}




