// <script type="text/javascript">
<!--  to hide script contents from old browsers

window.onload = init;

function init()
{
	display_urhere();
	setup_email();
}

/* This function alters the style of the navigation bar to indicate urhere.
I added code from the original to shorten the href string so that it does
not include any bookmarks (....#bookmark). Otherwise, the strings would not
match and the urhere formatting would not be applied.
******************************************************************************/

function display_urhere()
{	if (!document.getElementById)
	{
		return;
	}

	var list = document.getElementById("navbar");
	var page = list.getElementsByTagName("a");
	var currentHref = document.location.href;

	var anchorPosition = currentHref.indexOf("#");
	if (anchorPosition >= 0)
	{	currentHref = currentHref.substring(0, anchorPosition);
	}

	currentHref = getSimpleHref(currentHref);

	for (var i = 0; i < page.length; i++)
	{	var href = getSimpleHref(page[i].href)

		if (href == 'index.html')
		{	var home_index = i;
		}

		// This is when url doesn't include the page. Highlight index.html
		if ((href == currentHref) || ((currentHref.length == 0) && (home_index >= 0)))
		{
			if ((currentHref.length == 0) && (home_index >= 0))
			{	i = home_index;
			}

			page[i].style.backgroundColor = "#fff";
			page[i].style.color = "#564d52";
/*			page[i].parentNode.style.backgroundColor = "#fff";	*/	// parentNode will be <li>

			break;
		}
	}
}

/******************************************************************************
This function was added because Mac Safari does not include the directory structure
before the href, so there was never a match. This function strips the beginning directory structure
away and just leaves the end part--such as about_us.htm
******************************************************************************/

function getSimpleHref(s)
{	var length;
	var anchorPosition = 0;

	while (anchorPosition >= 0)
	{	anchorPosition = s.indexOf('/');
		length = s.length;

		if (anchorPosition >= 0)
		{	s = s.substring(anchorPosition + 1, length);
		}
	}

	return(s);
}

/**************************************************************************************************
This function sets up a links associated with class names to send email. Email address cannot
be read by spambots. email_array is an associative array. Each array corresponds to 1 email address.

To use in html code, as an exampke, add <span class="emailMichele"></span> where each
email address has an email**** associated with it.

To add another email address, add to email_array.
**************************************************************************************************/

function setup_email()
{
	// Get all <span> tags
	var tags = document.getElementsByTagName("span");

	for (var i = 0; i < tags.length; i++)
	{
		// Get className of <span> tag
		var cname = tags[i].className;

		// Now look for classes that begin with 'email'
		var s = cname.indexOf('email');

		// If <span> tag and class starts with 'email'
		if (s == 0)
		{
			// Get index to email_array (strip off 'email')
			index = cname.substring(5);
			insert_email(tags[i], index);
		}
	}
}

/**************************************************************************************************
This function sets up a links associated with class names to send email. Email address cannot
be read by spambots. email_array is an associative array. Each array corresponds to 1 email address.

To use in html code, as an exampke, add <span class="emailMichele"></span> where each
email address has an email**** associated with it.

To add another email address, add to email_array and add another case statement.
**************************************************************************************************/
function insert_email(tag, index)
{
	var email_array = new Array();
	email_array['Jane'] = 'jo, ohara-arts, com';

	var temp = email_array[index];

	// Remove any spaces, leave commas
	while (temp.indexOf(' ') != -1)
		temp = temp.replace(' ', '');

	// Split email string by commas
	var temp = temp.split(',');

	address = temp[0] + '@' + temp[1] + '.' + temp[2];

	tag.innerHTML = '<a href="mailto:' + address + '">' + address + '</a>';
}

/******************************************************************************
This function submits a form to Paypal.
/*****************************************************************************/
function submit_form(theForm)
{
	// Rename form for Paypal
	theForm.name = '_xclick';

	// Fill in business email
	theForm.business.value = 'jo' + '@' + 'ohara-arts' + '.com';

	// On return, the form will submit itself.
}

/******************************************************************************
Here's the start of the picture slide show.
/*****************************************************************************/

var folder = 'jooimages/';		// Folder where all images are kept
var current_image_number = 0;			// Global variable to indicate what image is currently displayed
var NUMBER_OF_IMAGES;
var DIV_FACTOR = 6;
var current_image_array = new Array;
var main_image = new Array();
var main_image_loaded = new Array();

//var mainPicture = new Image();

/******************************************************************************
 Names of image files without the jpg extension
/*****************************************************************************/

var series_recent_work = new Array(
'Perro', 'Perro', 'Acrylic and silver leaf on woodblock', '6" x 8"', 'PA1002', 0,
'Marley', 'Marley', 'Acrylic on wood', '14" x 10"', 'CA1003', 0,
'Annie_and_Millie', 'Annie and Millie', 'Diptych acrylic on woodblock', '6" x 6" each', 'CA1002', 0,
'Leo', 'Leo', 'Acrylic on board', '8" x 8"', 'PA1001', 0,
'Parrot', 'Parrot', 'Acrylic on board', '6" x 6"', 'PA1000', 0,
'true_blue', 'True Blue', 'Acrylic/oil and metal leaf on wood', '10" x 14"', 'PA0901', 0,
'stranger', 'Stranger', 'Acrylic on canvas', '30" x 40"', 'PA0913', 0,
'tessie', 'Tessie', 'Diptych Acrylic on wood', '10" diameter', 'CA0923', 0,
'the_chase', 'The Chase', 'Acrylic on canvas', '12" x 36"', 'PA0911', 0,
'sam_n_hazelwood', 'Sam \'n Hazelwood', 'Acrylic on wood', '20" x 30"', 'CA0922', 0,
'tristan_and_mini_me', 'Tristan and Mini-Me; Corn Muffin Dreams', 'Acrylic and gold leaf on wood', '11" x 14" & 10" x 8"', 'CA0921', 0,
'flying_max', 'Flying Max', 'Acrylic on acetate, magnets, metal rods', '23" x 26"', 'PA0922', 0,
'sit', 'Sit', 'Acrylic on wood', '12" x 12"', 'PA0917', 0,
'speedy', 'Speedy', 'Acrylic on mouse pad', '9" diameter"', 'PA0920', 0,
'pig_plate', 'Pig Plate', 'Acrylic on glass plate', '10" diameter', 'PA0921', 0
);

var series_dogs_cats = new Array(
'Perro', 'Perro', 'Acrylic and silver leaf on woodblock', '6" x 8"', 'PA1002', 0,
'Leo', 'Leo', 'Acrylic on board', '8" x 8"', 'PA1001', 0,
'dot', 'Dot', 'Acrylic on mouse pad', '9" diameter"', 'PA0923', 1,
'stranger', 'Stranger', 'Acrylic on canvas', '30" x 40"', 'PA0923', 0,
'stay', 'Stay', 'Acrylic on wood', '6" x 12"', 'PA0918', 0,
'sit', 'Sit', 'Acrylic on wood', '12" x 12"', 'PA0917', 0,
'true_blue', 'True Blue', 'Acrylic/oil and metal leaf on wood', '10" x 14"', 'PA0901', 0,
'speedy', 'Speedy', 'Acrylic on mouse pad', '9" diameter"', 'PA0920', 0,
'little_big_man', 'Little Big Man', 'Acrylic on mousepad', '9" diameter', 'PA0918', 0,
'IMG_6969', 'Dreaming', 'Acrylic and graphite powder on canvas', '30" x 24"', 'PA0800', 1,
'listening', 'Listening', 'Acrylic and graphite powder on canvas', '6" x 12"', 'PA0801', 0,
'cenotes', 'Cenotes Pup', 'Acrylic on wood disk w/broken glass', '10" diameter', 'PA0803', 1,
'semi_precious', 'Semi-precious', 'Acrylic on canvas, pearl beads', '10" x 20"', 'PA0805', 1,
'IMG_0179_cropped', 'Ari\'s Night', 'ooc', '36" x 18"', 'PA0600', 1,
'IMG_0186_cropped', 'Coffee Dog', 'Oil on wood', '14" x 10"', 'PA0601', 1,
'IMG_0176_cropped', 'Three Dogs', 'ooc', '30" x 24"', 'PA0602', 0,
'nell_and_company', 'Nell and Company', 'ooc', '36" x 48"', 'PA0603', 0,
'jan05_lyingdog450', 'Lying Dog', 'ooc', '30" x 40"', 'PA0500', 1,
'jan05_dogsinroad450', 'Two Dogs Sleeping', 'ooc', '36" x 48"', 'PA0501', 1,
'jan05_redball450', 'Red Ball', 'ooc', '30" x 40"', 'PA0503', 1,
'papaya', 'Papaya', 'ooc', '36" x 36"', 'PA0504', 1,
'fenway_450px_wide', 'Fenway', 'ooc', '24" x 40', 'PA0506', 1,
'bl_doglookingup', 'Dog Looking Up', 'Acrylic on wood block', '9" x 9"', 'PA0400', 1,
'boston_terrier_450px_wide', 'Boston Terrier', 'ooc', '4" x 6"', 'PA0404', 1,
'wary', 'Wary', 'oob', '8" x 10"', 'PA0406', 1,
'big_red_ball', 'Big Red Ball', 'owb', '9" x 9"', 'PA0408', 1,
'spot_at_sunrise', 'Spot at Sunrise', 'Oil on canvas', '10" x 10"', 'PA0409', 1,
'bl_marmalade', 'Marmalade', 'owb', '5 1/2" x 7"', 'PA0203', 1,
'weimaraner', 'Weimaraner in the Field', 'oob', '18" x 14"', 'PA0001', 1,
'bloom', 'Bloom', 'Acrylic on high gloss surfaced wood block', '4" x 8"', 'PA0906', 0,
'dawg', 'Trusty', 'Acrylic on high gloss surfaced wood block', '12" x 12"', 'PA0907', 0,
'fashionista', 'Fashionista', 'Acrylic on woodblock', '6" x 6"', 'PA0908', 0,
'IMG_0186_cropped', 'Coffee Dog', 'Oil on wood', '14" x 10"', 'PA0903', 1
);

var series_farm_wild_animals = new Array(
'Parrot', 'Parrot', 'Acrylic on board', '6" x 6"', 'PA1000', 0,
'pig_plate', 'Pig Plate', 'Acrylic on glass plate', '10" diameter', 'PA0921', 0,
'bunny', 'Bunny', 'Acrylic on woodblock', '6" x 6"', 'PA0909', 0,
'greyhound_and_rabbit', 'Greyhound and Rabbit', 'Acrylic on wood panel', '22" x 22"', 'PA0910', 0,
'empowered', 'The Night of the Rat', 'Acrylic on canvas', '48" x 24"', 'PA0912', 0,
'hilarious', 'Hilarious', 'Acrylic on mouse pad', '9" diameter"', 'PA0914', 0,
'circus', 'What a Circus', 'Hung canvas 4.5\' x 8\' acrylic', '', 'PA0802', 0,
'greatest_show', 'Greatest Show on Earth...', 'Acrylic on 12" diameter wood plate and wooden ball diptych', '', 'PA0804', 0,
'pig_parts', 'Pig Parts', 'Acrylic on wood', '9" x 11"', 'PA0701', 0,
'jan05_pigsinroad450', 'Pigs in the Road', 'ooc', '30" x 40"', 'PA0502', 1,
'mouse', 'Mouse', 'oob', '6" x 12"', 'PA0301', 0,
'pigsresting', 'Pigs Resting', 'oob', '10" x 15"', 'PA0202', 0,
'rabbitandcat', 'Rabbit and Cat', 'oop', '15" x 24"', 'PA0000', 0,
'patent_pending', '1F-R12345, 1F-R12346, 1F-R12347...', 'Acrylic on canvas', '12" x 24"', 'PA0915', 0
);

var series_screens_triptychs_banners = new Array(
'flying_max', 'Flying Max', 'Acrylic on acetate, magnets, metal rods', '23" x 26"', 'PA0922', 0,
'nell_balls', 'Nell Balls', 'Acrylic on wood balls--triptych', '5" x 5"', 'PA0700', 1,
'highway', 'Highway', 'Acrylic on canvas triptych', '6" x 18"', 'PA0702', 0,
'animalscreen', 'Sacrifice', 'Metal leaf and oil on wood', '70" x 14" (each panel)', 'PA0505', 1,
'dogsascending', 'Dogs Ascending', 'Oil on board, Triptych screen', '24" x 36"', 'PA0005', 1,
'dogwatch', 'Dog Watch', 'Oil on board, Triptych screen', '24" x 36"', 'PA0004', 0,
'cody', 'Cody', 'Acrylic on 4 wood panels', '8" x 32"', 'CA0816', 0,
'duffy_papaya_chanel', 'Duffy, Papaya, Chanel', '2006, Triptych, Oil on venetian plaster', '8" x 8" each', 'CA0607', 0,
'circus', 'What a Circus', 'Hung canvas 4.5\' x 8\' acrylic', '', 'PA0802', 0,
'threesirensSM', 'Cat and Three Dogs', 'Metal leaf and oil on wood screen', '70" x 14" (each panel)', 'PA0309', 0,
'best_friend', 'Best Friend', 'Acrylic on high gloss surfaced wood', 'Each piece 6" x 6". Presented as foursome, sold separately or as group', 'PA0902, PA0903, PA0904, PA0905', 0
);

var series_animal_portraits = new Array(
'Marley', 'Marley', 'Acrylic on wood', '14" x 10"', 'CA1003', 0,
'Annie_and_Millie', 'Annie and Millie', 'Diptych acrylic on woodblock', '6" x 6" each', 'CA1002', 0,
'tessie', 'Tessie', 'Diptych Acrylic on wood', '10" diameter', 'CA0923', 0,
'sam_n_hazelwood', 'Sam \'n Hazelwood', 'Acrylic on wood', '20" x 30"', 'CA0922', 0,
'tristan_and_mini_me', 'Tristan and Mini-Me; Corn Muffin Dreams', 'Acrylic and gold leaf on wood', '11" x 14" & 10" x 8"', 'CA0921', 0,
'pinch_me_of_the_azores', 'Pinch Me of the Azores', 'Acrylic on canvas', '10" x 30"', 'CA0920', 0,
'soggy_jones', 'Soggy Jones', 'Acrylic on mousepad', '9" diameter', 'CA0919', 0,
'koda', 'Koda', 'Acrylic on canvas', '12" x 24"', 'CA0918', 0,
'suki', 'Suki', 'Acrylic on board and venetian plaster', '29" x 16"', 'CA0917', 0,
'cody', 'Cody', 'Acrylic on 4 wood panels', '8" x 32"', 'CA0816', 0,
'IMG_6759', 'Queen Charlotte', 'Acrylic on canvas', '30" x 24"', 'CA0815', 0,
'kato_cropped', 'Kato', 'Gold leaf and oil on canvas', '20" x 16"', 'CA0814', 0,
'ted', 'Ted', '2002, Oil on canvas', '18" x 14"', 'CA0213', 0,
'jan05_dogwithflower', 'Flowers for Jim', '2003, Oil on board', '14" x 14"', 'CA0312', 1,
'mimi', 'Mimi', '2005, Gold leaf and oil on wood block', '4" x 3"', 'CA0511', 0,
'stmatthewandstpossum', 'Saint Matthew and Saint Possum', '2004, Metal Leaf and oil on board', '20" x 20"', 'CA0410', 0,
'duffy_papaya_chanel', 'Duffy, Papaya, Chanel', '2006, Triptych, Oil on venetian plaster', '8" x 8" each', 'CA0607', 0,
'caesar', 'Caesar', '2006, Acrylic on canvas', '12" x 12"', 'CA0606', 0,
'toony', 'Toony and her Amazing Bloomers', '2007, Acrylic in wood plate', '10" x 11"', 'CA0705', 0,
'patton', 'Patton', '2007, Acrylic and gold leaf on wood block', '11" x 11"', 'CA0704', 0,
'furry', 'Furry Herscotts', '2007, Acrylic and metal leaf on canvas', '16" x 20"', 'CA0703', 0,
'scout_and_hazel', 'Scout and Hazel', '2008, Mixed  media on wood', '9" x 12"', 'CA0802', 1,
'flydog', 'Fly Dog', 'oob', '16" x 11 1/2"', 'CA0101', 0
);

var series_people_portraits = new Array(
'IMG_2817_2', 'Eddie', '2007, Acrylic on wood with pearl beads', '3" x 3"', 'CP0702', 0,
'floridian_twins_combined', 'Floridian Twins', '2003, Diptych  Oil on wood block', '3" x 4"', 'CP0301', 0,
'jan05_arielsculley', 'Ariel & Sculley', 'ooc', '22" x 36"', 'CP0000', 0
);

var series_archives = new Array(
'small_boston_terrier', 'Small Boston Terrier', 'ooc', '4" x 4"', 'PA0407', 0,
'jan05_bullterrier', 'Bull Terrier #2', 'oob', '8" x 10"', 'PA0404', 0,
'bl_spot', 'Spot', 'owb', '4" x 5"', 'PA0308', 0,
'bl_terrierbysea', 'Terrier by the Sea', 'owb', '8" x 9"', 'PA0304', 0,
'jan05_dogsniffing', 'Dog Sniffing', 'oob', '8" x 10"', 'PA0405', 0,
'resting_on_the_long_road', 'Resting on the Long Road', 'Acrylic on silk paper', '26" x 11"', 'PA0302', 0,
'tobagodog', 'Tobago Dog', 'ooc', '30" x 24"', 'PA0105', 0,
'prairiedogwalrus', 'Prairie Dog and Walrus', 'oob', '18" x 18"', 'PA0103', 0,
'bullbythesea_med', 'Bull by the Sea', 'oob', '18" x 18"', 'PA0102', 0,
'stonington', 'Stonington', 'oob', '20" x 16"', 'PA0003', 0,
'meercats', 'Meer Cats in Little Compton', 'oob', '18" x 18"', 'PA0002', 0,
'bl_minitobagodog', 'Mini Tobago Dog', 'owb', '3" x 4"', 'PA0401', 1,
'jan05_redyellowdog', 'Dog Looks Askance', 'owb', '4" x 4"', 'PA0402', 0
);

/*********************************************************************************
This file contains most of the universally used javascript functions. It is called
by the various artist_info.js files that are unique for each artist.
*********************************************************************************/

function setup_images(array_name, use_cookie, n)
{
	if (array_name == 'recent_work')
	{	current_image_array = series_recent_work;
	}
	else if (array_name == 'dogs_cats')
	{	current_image_array = series_dogs_cats;
	}
	else if (array_name == 'farm_wild_animals')
	{	current_image_array = series_farm_wild_animals;
	}
	else if (array_name == 'screens_triptychs_banners')
	{	current_image_array = series_screens_triptychs_banners;
	}
	else if (array_name == 'animal_portraits')
	{	current_image_array = series_animal_portraits;
	}
	else if (array_name == 'people_portraits')
	{	current_image_array = series_people_portraits;
	}
	else if (array_name == 'archives')
	{	current_image_array = series_archives;
	}
	else
	{	//current_image_array = series_recent_work;
	}

	NUMBER_OF_IMAGES = current_image_array.length / DIV_FACTOR;

	//Initialize array for preloading next image to 0.
	for (var i = 0; i < NUMBER_OF_IMAGES; i++)
	{	main_image_loaded[i] = 0;
	}

	if (n >= 0)
	{
		if (n > current_image_array.length)
			var selected_image_number = 0;
		else
			var selected_image_number = n;

		current_image_number = selected_image_number;
	}
	else if (use_cookie)
	{
		var selected_image_number = get_cookie();

		if (selected_image_number >= 0)
		{
			current_image_number = selected_image_number;
		}
	}
}

/******************************************************************************
This function selects the next image.
/*****************************************************************************/

function get_next_image()
{
	//alert('get_next_image: current_image_number = ' + current_image_number);
	//alert('get_next_image: NUMBER_OF_IMAGES = ' + NUMBER_OF_IMAGES);

	if (current_image_number < NUMBER_OF_IMAGES - 1)
	{
		select_image(current_image_number + 1);
	}
	else
	{
		if (current_image_array == series_recent_work)
			document.location.href = 'series.php?title=dogs+:+cats&series=dogs_cats';

		else if (current_image_array == series_dogs_cats)
			document.location.href = 'series.php?title=farm+:+wild+animals&series=farm_wild_animals';

		else if (current_image_array == series_farm_wild_animals)
			document.location.href = 'series.php?title=screens+:+triptychs+:+banners&series=screens_triptychs_banners';

		else if (current_image_array == series_screens_triptychs_banners)
			document.location.href = 'series.php?title=animal+portraits&series=animal_portraits';

		else if (current_image_array == series_animal_portraits)
			document.location.href = 'series.php?title=people+portraits&series=people_portraits';

		else if (current_image_array == series_people_portraits)
			document.location.href = 'series.php?title=archives&series=archives';

		else if (current_image_array == series_archives)
			document.location.href = 'series.php?title=recent+work&series=recent_work';

		else
			alert('did not find current next image array');
	}

//	alert('get_next_image: current_image_number = ' + current_image_number);
}

/******************************************************************************
This function selects the previous image.
/*****************************************************************************/

function get_previous_image()
{
	if (current_image_number > 0)
	{	select_image(current_image_number - 1);
	}
	else
	{
		if (current_image_array == series_recent_work)
			document.location.href = 'series.php?title=archives&series=archives';

		else if (current_image_array == series_dogs_cats)
			document.location.href = 'series.php?title=recent+works&series=recent_work';

		else if (current_image_array == series_farm_wild_animals)
			document.location.href = 'series.php?title=dogs+:+cats&series=dogs_cats';

		else if (current_image_array == series_screens_triptychs_banners)
			document.location.href = 'series.php?title=farm+:+wild+animals&series=farm_wild_animals';

		else if (current_image_array == series_animal_portraits)
			document.location.href = 'series.php?title=screens+:+triptychs+:+banners&series=screens_triptychs_banners';

		else if (current_image_array == series_people_portraits)
			document.location.href = 'series.php?title=animal+portraits&series=animal_portraits';

		else if (current_image_array == series_archives)
			document.location.href = 'series.php?title=people+portraits&series=people_portraits';

		else
			alert('did not find current image array');
	}
}

/******************************************************************************
This function selects and displays the current image. Called from html file.
/*****************************************************************************/

function get_current_image()
{
	select_image(current_image_number);
}

/******************************************************************************
This function selects the image number n. It first deselects the current image
and then selects the new imge.
/*****************************************************************************/

function select_image(n)
{
	var id_old;
	var id_new;
	var id_element;
	var href;
	var text, newElem, newText, child;

	//alert('select_image: current_image_number = ' + current_image_number + '  n = ' + n);

	id_old = 'number' + current_image_number;
	id_element = document.getElementById(id_old);
	/*****************************************************************
	The following code worked in all browsers except Safari for Mac.
	So, instead changed the class name of the <a> tag.
		href = id_element.getElementsByTagName("a");
		href[0].style.color = "rgb(164, 179, 200)";
		href[0].style.backgroundColor = "transparent";
	*****************************************************************/
	//id_element.firstChild.className = 'num-link';


	id_new = 'number' + n;
	id_element = document.getElementById(id_new);
	/*****************************************************************
	The following code worked in all browsers except Safari for Mac.
	So, instead changed the class name of the <a> tag (firstChild of
	<div id="numberx">
		href = id_element.getElementsByTagName("a");
		href[0].style.color = "rgb(164, 179, 200)";
		href[0].style.backgroundColor = "rgb(164, 179, 200)";
	*****************************************************************/
	//id_element.firstChild.className = 'num-selected';

	current_image_number = n;

	//alert('select_image: current_image_number = ' + current_image_number + '  n = ' + n);

	get_image(n);

	if (n == 0)
	{
		if (current_image_array == series_recent_work)
			text = '<< archives';

		else if (current_image_array == series_dogs_cats)
			text = '<< recent work';

		else if (current_image_array == series_farm_wild_animals)
			text = '<< dogs : cats';

		else if (current_image_array == series_screens_triptychs_banners)
			text = '<< farm : wild animals';

		else if (current_image_array == series_animal_portraits)
			text = '<< screens : triptychs : banners';

		else if (current_image_array == series_people_portraits)
			text = '<< animal portraits';

		else if (current_image_array == series_archives)
			text = '<< people portraits';

		id_element = document.getElementById('previousArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode(text);
		id_element.replaceChild(newText, child);

		id_element = document.getElementById('nextArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode('next image >>');
		id_element.replaceChild(newText, child);
		//id_element.style.display = "none";
	}

	else if (n == NUMBER_OF_IMAGES - 1)
	{
		if (current_image_array == series_recent_work)
			text = 'dogs : cats >>';

		else if (current_image_array == series_dogs_cats)
			text = 'farm : wild animals >>';

		else if (current_image_array == series_farm_wild_animals)
			text = 'screens : triptychs : banners >>';

		else if (current_image_array == series_screens_triptychs_banners)
			text = 'animal portraits >>';

		else if (current_image_array == series_animal_portraits)
			text = 'people portraits >>';

		else if (current_image_array == series_people_portraits)
			text = 'archives >>';

		else if (current_image_array == series_archives)
			text = 'recent work >>';

		else if (current_image_array == series_recent_work)
			text = '';

		id_element = document.getElementById('nextArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode(text);
		id_element.replaceChild(newText, child);

		id_element = document.getElementById('previousArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode('<< previous image');
		id_element.replaceChild(newText, child);

		//id_element.style.display = "none";
	}
	else
	{
		id_element = document.getElementById('previousArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode('<< previous image');
		id_element.replaceChild(newText, child);

		id_element = document.getElementById('nextArrow');
		child = id_element.childNodes[0];
		newElem = document.createElement("p");
		newText = document.createTextNode('next image >>');
		id_element.replaceChild(newText, child);
	}
}

/******************************************************************************
This function takes as input the number of the image to select.

It then manipulates the current array of images to pull out all the information.
In this case the information is:
array[0]: image file name without the jpg extension
array[1]: Text name of the image to be displayed
array[2]: Medium of artwork
array[3]: Size of artwork in string format
array[4]: Whether the artwork has been sold or not (1 = sold, 0 = not sold)
/*****************************************************************************/

function get_image(n_image)
{
	var offset = n_image * DIV_FACTOR;

	var image_file = current_image_array[offset];
	image_file += '.jpg';
	image_file = folder + image_file;

	var image_name = current_image_array[offset + 1];

	var medium = current_image_array[offset + 2];
	if (medium == 'ooc')
	{
		medium = 'Oil on canvas';
	}
	else if (medium == 'owb')
	{
		medium = 'Oil on wood block';
	}
	else if (medium == 'oob')
	{
		medium = 'Oil on board';
	}
	else if (medium == 'oop')
	{
		medium = 'Oil on panel';
	}
	else if (medium == 'p')
	{
		medium = 'Pastel';
	}

	var size = current_image_array[offset + 3];

	var year = current_image_array[offset + 4];
	year = 2000 + year.charAt(2) * 10 + year.charAt(3) * 1;

	var print_available = current_image_array[offset + 5];
	if (print_available == 1)
		print_available = 'Available as limited edition print';
	else
		print_available = '';

	var code = current_image_array[offset + 4];

	display_main_image(image_file, image_name, medium, size, year, print_available, code, n_image);

	// Get ready to preload next image
	var i = n_image + 1;

	if ((i < NUMBER_OF_IMAGES) && (main_image_loaded[i] == 0))
	{
		offset = i * DIV_FACTOR;
		image_file = current_image_array[offset];
		image_file += '.jpg';
		image_file = folder + image_file;

		main_image[i] = new Image();
		main_image[i].src = image_file;
		main_image_loaded[i] = 1;
	}
}

/******************************************************************************
This function displays the main image in the portfolio viewer and then calls
display_image_info() to display the name, medium, size, and whether it's been
sold.
******************************************************************************/

function display_main_image(image_file, name, medium, size, year, print_available, code, n_image)
{	if (document.images)
	{
		/* If Safari loads another image and both height and with are not different, then Safari
		stretches the image to the same width as the previous image. The following code checks if
		Safari browser, and if true, loads a 1px x 1px image before loading the new image.
		******************************************************************************************/
		var safari = (navigator.userAgent.indexOf('Safari') != -1);
		if (safari)
		{	document.images.targetImage.src = 'images/MsSpacer.gif';
		}

		document.images.targetImage.src = image_file;

		/***
		var img = new Image();
		img.src = image_file;

		img.onload = function()
		{
			var image_width = img.width;
			var image_height = img.height;
			$html = '<img src="' + image_file + '" alt="' + name + '" width="' + image_width + '" height="' + image_height + '">';
			document.getElementById("main-image").innerHTML = $html;
		}
		***/


	/***************************************************************************************************
	The following 2 lines work fine in all browsers except Safari. In Safari, the new strings do not
	align properly. For example, they should be centered horizontally, but instead, the 1st string
	displayed is properly centered, but subsequent strings are left aligned with the left position of
	the 1st string. To get around this, display_image_info() was added.

		document.getElementById("imageName").firstChild.nodeValue = image_name[n];
		document.getElementById("imageDescription").firstChild.nodeValue = medium_string;
	***************************************************************************************************/

		display_image_info(name, medium, size, year, print_available, code, n_image + 1);

	}
}

/******************************************************************************
This function displays the information for each image: the name, medium,
size, and whether it's been sold.
Spaces are added to newText because IE5.0 will not take padding or margin.
******************************************************************************/

function display_image_info(image_name, image_description, image_size, image_year, image_print_available, image_code, n_image)
{	var newElem;
	var newText;
	var oldChild;
	var text;

	newElem = document.createElement("p");
	newText = document.createTextNode(image_name + '    ');
	oldChild = document.getElementById("imageName").childNodes[0];
	document.getElementById("imageName").replaceChild(newText, oldChild);

	newElem = document.createElement("p");
	newText = document.createTextNode(image_description + '    ');
	oldChild = document.getElementById("imageDescription").childNodes[0];
	document.getElementById("imageDescription").replaceChild(newText, oldChild);

	newElem = document.createElement("p");
	newText = document.createTextNode(image_size);
	oldChild = document.getElementById("imageSize").childNodes[0];
	document.getElementById("imageSize").replaceChild(newText, oldChild);

	newElem = document.createElement("p");
	newText = document.createTextNode(image_year);
	oldChild = document.getElementById("imageYear").childNodes[0];
	document.getElementById("imageYear").replaceChild(newText, oldChild);

	newElem = document.createElement("p");
	newText = document.createTextNode(image_print_available);
	oldChild = document.getElementById("imagePrintAvailable").childNodes[0];
	document.getElementById("imagePrintAvailable").replaceChild(newText, oldChild);

	newElem = document.createElement("p");
	newText = document.createTextNode(image_code);
	oldChild = document.getElementById("imageCode").childNodes[0];
	document.getElementById("imageCode").replaceChild(newText, oldChild);

/**
	text = n_image + ' out of ' + NUMBER_OF_IMAGES;
	newElem = document.createElement("p");
	newText = document.createTextNode(text);
	oldChild = document.getElementById("imageNumber").childNodes[0];
	document.getElementById("imageNumber").replaceChild(newText, oldChild);
**/

/**
	for (var i = 0; i < NUMBER_OF_IMAGES; i++)
	{
		text = i + ' ';
		newElem = document.createElement("p");
		newText = document.createTextNode(text);
		oldChild = document.getElementById("imageList").childNodes[0];
		document.getElementById("imageList").appendChild(newText, oldChild);
	}
**/

}

/******************************************************************************
Preload thumbnail images.
******************************************************************************/

function preload_thumbnails(n_images)
{	for (x = 0; x < n_images; x++)
	{	tn_image[x] = new Image();
		tn_image[x].src = image_file_tn[x];
	}
}

/******************************************************************************
Preload background images used for navigation.
******************************************************************************/

function preload_background_images()
{

/****
	pic1 = new Image();
	pic1.src = folder + "color_button_05.gif";

	pic2 = new Image();
	pic2.src = folder + "color_button_green_04.gif";

	pic3 = new Image();
	pic3.src = folder + "color_button_coral_04.gif";

	pic4 = new Image();
	pic4.src = folder + "previous_page_arrow_blue_04.gif";

	pic5 = new Image();
	pic5.src = folder + "next_page_arrow_green_04.gif";

	pic6 = new Image();
	pic6.src = folder + "next_page_arrow_green_04.gif";
****/

}

/******************************************************************************
This function displays thumbnail images of all the paintings in a series.
******************************************************************************/

function display_thumbnail_paintings()
{
	var offset;
	var image_file;

	// For some reason, this extra div fixes bug in IE5Mac. Bug is that after 1st row, the
	//  2nd and subsequent images in each row are shifted down a bit.

	for (var i = 0; i < NUMBER_OF_IMAGES; i++)
	{	offset = i * DIV_FACTOR;

		image_file = current_image_array[offset];
		image_file += '_tn.jpg';
		image_file = folder + image_file;

		document.write('<div class="thumbnail">');
		document.write('<a href="#" onClick="select_thumbnail(' + i + '); ' + 'this.blur(); return false;" >');
		document.write('<img id="tn' + i + '" ' + ' src="' + image_file + '"' + ' width="75" height="75" >');
		document.write('</a>');
		document.write("</div> \n");

/***
		document.write('<a href="#" class="thumbnail-container" onClick="select_thumbnail(' + i + '); ' + 'this.blur(); return false;" >');
		document.write('<img id="tn' + i + '" ' + 'class="thumbnail" src="' + image_file + '"' + ' >');
		document.write('</a>');
***/
	}
}

/******************************************************************************
This function selects one of the thumbnails on the page. When selected, a
cookie is created to indicate the number of the selected image. A new slide
viewer page is then opened and the cookie is retrieved to determine which
image to show.
******************************************************************************/

function select_thumbnail(n)
{
	//alert('select_thumbnail: thumbnail selected ' + n);
	current_image_number = n;

	create_cookie(n);

	if (current_image_array == series_recent_work)
	{	document.location.href = 'series.php?title=recent+work&series=recent_work&number=' + n;
	}
	else if (current_image_array == series_dogs_cats)
	{	document.location.href = 'series.php?title=dogs+:+cats&series=dogs_cats&number=' + n;
	}
	else if (current_image_array == series_farm_wild_animals)
	{	document.location.href = 'series.php?title=farm+:+wild+animals&series=farm_wild_animals&number=' + n;
	}
	else if (current_image_array == series_screens_triptychs_banners)
	{	document.location.href = 'series.php?title=screens+:+triptychs+:+banners&series=screens_triptychs_banners&number=' + n;
	}
	else if (current_image_array == series_animal_portraits)
	{	document.location.href = 'series.php?title=animal+portraits&series=animal_portraits&number=' + n;
	}
	else if (current_image_array == series_people_portraits)
	{	document.location.href = 'series.php?title=people+portraits&series=people_portraits&number=' + n;
	}
	else if (current_image_array == series_archives)
	{	document.location.href = 'series.php?title=archives&series=archives&number=' + n;
	}
	else
		alert('no array selected');
}

/******************************************************************************
This function creates a cookie. After the viewer selecs an image from one of
the thumbnailpage, a cookie is set to remember the image number.
Note that the global variable cookie_name is used throughout all of these
cookie functions.
******************************************************************************/

var COOKIE_NAME = 'jane_image_number';

function create_cookie(cookie_value)
{
	document.cookie = COOKIE_NAME + "=" + cookie_value;
}

/******************************************************************************
This function deletes the cookie.
******************************************************************************/

function delete_cookie()
{
	var date = new Date();
	var time = date.getTime();

	date.setTime(time - 1);

	document.cookie = COOKIE_NAME + "= ; " + "expires=" + date.toGMTString();
}

/******************************************************************************
This function retrieves the cookie.
******************************************************************************/

function get_cookie()
{	var dc = document.cookie;

	var name_start = dc.indexOf(COOKIE_NAME + "=");
	if (name_start == -1) 							// Did not find cookie
	{	//alert("Did not find cookie. ");
		return (-1);
	}

	var cookie_value = dc.substring(name_start + COOKIE_NAME.length + 1);

	delete_cookie();
	return(parseInt(cookie_value));
}


// end hiding contents from old browsers  -->
// </script>