// <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>';
}

/******************************************************************************
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 = 4; 
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_new = new Array(				
'true_blue', 'True Blue', 'Acrylic/oil and metal leaf on wood', '10" x 14"',
'best_friend', 'Best Friend', 'Acrylic on high gloss surfaced wood', 'Each piece 6" x 6". Presented as foursome, sold separately or as group',
'bloom', 'Bloom', 'Acrylic on high gloss surfaced wood block', '4" x 8"',
'dawg', 'Trusty', 'Acrylic on high gloss surfaced wood block', '12" x 12"',
'pinch_me', 'Pinch Me', 'Acrylic on canvas', '10" x 30"',
'the_chase', 'The Chase', 'Acrylic on canvas', '12" x 36"',
'koda', 'Koda', 'Acrylic on canvas', '12" x 24"',
'fashionista', 'Fashionista', 'Acrylic on woodblock', '6" x 6"',
'bunny', 'Bunny', 'Acrylic on woodblock', '6" x 6"',
'greyhound_and_rabbit', 'Greyhound and Rabbit', 'Acrylic on wood panel', '22" x 22"',
'soggy_jones', 'Soggy Jones', 'Acrylic on mousepad', '9" diameter',
'patent_pending', '1F-R12345, 1F-R12346, 1F-R12347...', 'Acrylic on canvas', '12" x 24"',
'empowered', 'The Night of the Rat', 'Acrylic on canvas', '48" x 24"'
);

var series_2009 = new Array(				
'true_blue', 'True Blue', 'Acrylic/oil and metal leaf on wood', '10" x 14"',
'best_friend', 'Best Friend', 'Acrylic on high gloss surfaced wood', 'Each piece 6" x 6", Presented as foursome, sold separately or as group',
'bloom', 'Bloom', 'Acrylic on high gloss surfaced wood block', '4" x 8"',
'dawg', 'Trusty', 'Acrylic on high gloss surfaced wood block', '12" x 12"',
'fashionista', 'Fashionista', 'Acrylic on woodblock', '6" x 6"',
'bunny', 'Bunny', 'Acrylic on woodblock', '6" x 6"',
'greyhound_and_rabbit', 'Greyhound and Rabbit', 'Acrylic on wood panel', '22" x 22"',
'soggy_jones', 'Soggy Jones', 'Acrylic on mousepad', '9" diameter',
'patent_pending', '1F-R12345, 1F-R12346, 1F-R12347...', 'Acrylic on canvas', '12" x 24"',
'empowered', 'The Night of the Rat', 'Acrylic on canvas', '48" x 24"',
'dot', 'Dot', 'Acrylic on mouse pad', '9" diameter"',
'hilarious', 'Hilarious', 'Acrylic on mouse pad', '9" diameter"'
);

var series_2008 = new Array(				
'IMG_6969', 'Dreaming', 'Acrylic and graphite powder on canvas', '30" x 24"',
'listening', 'Listening', 'Acrylic and graphite powder on canvas', '6" x 12"',
'circus', 'What a Circus', 'Hung canvas 4.5\' x 8\' acrylic', '',
'cenotes', 'Cenotes Pup', 'Acrylic on wood disk w/broken glass', '10" diameter',
'greatest_show', 'Greatest Show on Earth...', 'Acrylic on 12" diameter wood plate and wooden ball diptych', '',
'semi_precious', 'Semi-precious', 'Acrylic on canvas, pearl beads', '10" x 20"'
);

var series_2007 = new Array(				
'nell_balls', 'Nell Balls', 'Acrylic on wood balls--tryptich', '5" x 5"',
'pig_parts', 'Pig Parts', 'Acrylic on wood', '9" x 11"',
'highway', 'Highway', 'Acrylic on canvas triptych', '6" x 18"'
);

var series_2006 = new Array(				
'IMG_0179_cropped', 'Ari\'s Night', 'ooc', '36" x 18"',
'IMG_0186_cropped', 'Coffee Dog', 'Oil on wood', '14" x 10"',
'IMG_0176_cropped', 'Three Dogs', 'ooc', '30" x 24"',
'nell_and_company', 'Nell and Company', 'ooc', '36" x 48"'
);

var series_2005 = new Array(				
'jan05_lyingdog450', 'Lying Dog', 'ooc', '30" x 40"',
'jan05_dogsinroad450', 'Two Dogs Sleeping', 'ooc', '36" x 48"',
'jan05_pigsinroad450', 'Pigs in the Road', 'ooc', '30" x 40"',
'jan05_redball450', 'Red Ball', 'ooc', '30" x 40"',
'papaya', 'Papaya', 'ooc', '36" x 36"',
'animalscreen', 'Sacrifice', 'Metal leaf and oil on wood', '70" x 14" (each panel)',
'fenway_450px_wide', 'Fenway', 'ooc', '24" x 40'
);

var series_2004 = new Array(
'bl_doglookingup', 'Dog Looking Up', 'Acrylic on wood block', '9" x 9"',
'jan05_minitobagodog', 'Mini Tobago Dog #2', 'ooc', '3" x 4"',
'jan05_redyellowdog', 'Dog Looks Askance', 'owb', '4" x 4"',
'boston_terrier_450px_wide', 'Boston Terrier', 'ooc', '4" x 6"',
'jan05_bullterrier', 'Bull Terrier #2', 'oob', '8" x 10"',
'jan05_dogsniffing', 'Dog Sniffing', 'oob', '8" x 10"',
'wary', 'Wary', 'oob', '8" x 10"',
'small_boston_terrier', 'Small Boston Terrier', 'ooc', '4" x 4"',
'big_red_ball', 'Big Red Ball', 'owb', '9" x 9"',
'spot_at_sunrise', 'Spot at Sunrise', 'Oil on canvas', '10" x 10"'
);

var series_2003 = new Array(
'threesirensSM', 'Cat and Three Dogs', 'Metal leaf and oil on wood screen', '70" x 14" (each panel)',
'bl_spot', 'Spot', 'owb', '4" x 5"',
'bl_minitobagodog', 'Mini Tobago Dog', 'owb', '3" x 4"',
'jan05_tobdogpalms', 'Tobago Dog in Palms', 'oob', '8" x 10"',
'bl_tobagodogbamboo', 'Tobago Dog in Bamboo Grove', 'owb', '8" x 9"',
'bl_terrierbysea', 'Terrier by the Sea', 'owb', '8" x 9"',
'jan05_dogkick', 'Dog Kicking', 'oob', '8" x 10"',
'resting_on_the_long_road', 'Resting on the Long Road', 'Acrylic on silk paper', '26" x 11"',
'mouse', 'Mouse', 'oob', '6" x 12"'
);

var series_2002 = new Array(
'bl_tobagodogblue', 'Tobago Dog on Blue', 'owb', '8 1/2" x 7 1/2"',
'bl_tobagodogwaits', 'Tobago Dog Waits', 'owb', '8 1/2" x 9"',
'bl_lab', 'Lab', 'owb', '3 1/2" x 4"',
'bl_marmalade', 'Marmalade', 'owb', '5 1/2" x 7"',
'pigsresting', 'Pigs Resting', 'oob', '10" x 15"',
'bullterrier', 'Bull Terrier #1', 'oob', '18" x 18"',
'deer_at_sunrise', 'Deer at Sunrise', 'oob', '18" x 18"'
);

var series_2001 = new Array(
'tobagodog', 'Tobago Dog', 'ooc', '30" x 24"',
'flydog', 'Fly Dog', 'oob', '16" x 11 1/2"',
'prairiedogwalrus', 'Prairie Dog and Walrus', 'oob', '18" x 18"',
'bullbythesea_med', 'Bull by the Sea', 'oob', '18" x 18"',
'dogonthebarren', 'Dog on the Barren', 'oob', '12" x 16"',
'jan05_palm', 'Palm', 'oob', '10" x 8"'
);

var series_2000 = new Array(
'dogsascending', 'Dogs Ascending', 'Oil on board, Triptych screen', '24" x 36"',
'dogwatch', 'Dog Watch', 'Oil on board, Triptych screen', '24" x 36"',
'stonington', 'Stonington', 'oob', '20" x 16"',
'meercats', 'Meer Cats in Little Compton', 'oob', '18" x 18"',
'weimaraner', 'Weimaraner in the Field', 'oob', '18" x 14"',
'rabbitandcat', 'Rabbit and Cat', 'oop', '15" x 24"'
);

var series_commission = new Array(
'koda', 'Koda', 'Acrylic on canvas', '12" x 24"',
'suki', 'Suki', 'Acrylic on board and venetian plaster', '29" x 16"',
'cody', 'Cody', 'Acrylic on 4 wood panels', '8" x 32"',
'IMG_6759', 'Queen Charlotte', 'Acrylic on canvas', '30" x 24"',
'kato_cropped', 'Kato', 'Gold leaf and oil on canvas', '20" x 16"',
'jan05_arielsculley', 'Ariel & Sculley', 'ooc', '22" x 36"',
'ted', 'Ted', '2002, Oil on canvas', '18" x 14"',
'floridian_twins_combined', 'Floridian Twins', '2003, Diptych  Oil on wood block', '3" x 4"',
'jan05_dogwithflower', 'Flowers for Jim', '2003, Oil on board', '14" x 14"',
'stmatthewandstpossum', 'Saint Matthew and Saint Possum', '2004, Metal Leaf and oil on board', '20" x 20"',
'mimi', 'Mimi', '2005, Gold leaf and oil on wood block', '4" x 3"',
'duffy_papaya_chanel', 'Duffy, Papaya, Chanel', '2006, Triptych, Oil on venetian plaster', '8" x 8" each',
'duffy_1', 'Duffy', '2006, Part of triptych, Oil on venetian plaster', '8" x 8" each',
'papaya_1', 'Papaya', '2006, Part of triptych, Oil on venetian plaster', '8" x 8" each',
'chanel_1', 'Chanel', '2006, Part of triptych, Oil on venetian plaster', '8" x 8" each',
'caesar', 'Caesar', '2006, Acrylic on canvas', '12" x 12"',
'toony', 'Toony and her Amazing Bloomers', '2007, Acrylic in wood plate', '10" x 11"',
'patton', 'Patton', '2007, Acrylic and gold leaf on wood block', '11" x 11"',
'furry', 'Furry Herscotts', '2007, Acrylic and metal leaf on canvas', '16" x 20"',
'IMG_2817_2', 'Eddie', '2007, Acrylic on wood with pearl beads', '3" x 3"',
'scout_and_hazel', 'Scout and Hazel', '2008, Mixed  media on wood', '9" x 12"'
);

/*********************************************************************************
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 == 'series_new')
	{	current_image_array = series_new;
	}
	else if (array_name == 'series_2009')
	{	current_image_array = series_2009;
	}
	else if (array_name == 'series_2008')
	{	current_image_array = series_2008;
	}
	else if (array_name == 'series_2007')
	{	current_image_array = series_2007;
	}
	else if (array_name == 'series_2006')
	{	current_image_array = series_2006;
	}
	else if (array_name == 'series_2005')
	{	current_image_array = series_2005;
	}
	else if (array_name == 'series_2004')
	{	current_image_array = series_2004;
	}
	else if (array_name == 'series_2003')
	{	current_image_array = series_2003;
	}
	else if (array_name == 'series_2002')
	{	current_image_array = series_2002;
	}
	else if (array_name == 'series_2001')
	{	current_image_array = series_2001;
	}
	else if (array_name == 'series_2000')
	{	current_image_array = series_2000;
	}
	else if (array_name == 'series_commission')
	{	current_image_array = series_commission;
	}

	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 displays the number of images on the html page as well as previous
and next arrows. This is done by writing html code onto the page. A number and
ID is generated for each image. The IDs are in the form: "numberx" where "x"
are numerals from 0 to the number of images - 1.

It should be called after setup_images() from the html page.
/*****************************************************************************/

/***
Not used for O'Hara Arts website

function display_numbers()
{
	document.write('<a href="#" class="arrow" ' + 'onClick="get_previous_image(); ' + 'this.blur(); return false;" >');
	document.write('<< Back ');
	document.write('</a>');
	
	for (var i = 0; i < NUMBER_OF_IMAGES; i++)
	{
		document.write('<div id="number' + i + '"' + ' class="number">');
		document.write('<a href="#" ' + 'class="num-link" ' + 'onClick="select_image(' + i + '); ' + 'this.blur(); return false;" >');
		var j = i + 1;
		document.write(j);
		document.write('</a>');
		document.write('</div>');
	}		

	document.write('<a href="#" class="arrow" ' + 'onClick="get_next_image(); ' + 'this.blur(); return false;" >');
	document.write(' Next >>');
	document.write('</a>');
}

***/

/******************************************************************************
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_2009)
			document.location.href = 'series_2008.html';
		else if (current_image_array == series_2008)
			document.location.href = 'series_2007.html';
		else if (current_image_array == series_2007)
			document.location.href = 'series_2006.html';
		else if (current_image_array == series_2006)
			document.location.href = 'series_2005.html';
		else if (current_image_array == series_2005)
			document.location.href = 'series_2004.html';
		else if (current_image_array == series_2004)
			document.location.href = 'series_2003.html';
		else if (current_image_array == series_2003)
			document.location.href = 'series_2002.html';
		else if (current_image_array == series_2002)
			document.location.href = 'series_2001.html';
		else if (current_image_array == series_2001)
			document.location.href = 'series_2000.html';
		else if (current_image_array == series_2000)
			document.location.href = 'series_commission.php';
		else if (current_image_array == series_commission)
			document.location.href = 'series_2009.html';
		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_2009)
			document.location.href = 'series_commission.php';
		else if (current_image_array == series_2008)
			document.location.href = 'series_2009.html';
		else if (current_image_array == series_2007)
			document.location.href = 'series_2008.html';
		else if (current_image_array == series_2006)
			document.location.href = 'series_2007.html';
		else if (current_image_array == series_2005)
			document.location.href = 'series_2006.html';
		else if (current_image_array == series_2004)
			document.location.href = 'series_2005.html';
		else if (current_image_array == series_2003)
			document.location.href = 'series_2004.html';
		else if (current_image_array == series_2002)
			document.location.href = 'series_2003.html';
		else if (current_image_array == series_2001)
			document.location.href = 'series_2002.html';
		else if (current_image_array == series_2000)
			document.location.href = 'series_2001.html';
		else if (current_image_array == series_commission)
			document.location.href = 'series_2000.html';
		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_2009)
			text = '<< commissioned works';
		else if (current_image_array == series_2008)
			text = '<< 2009';
		else if (current_image_array == series_2007)
			text = '<< 2008';
		else if (current_image_array == series_2006)
			text = '<< 2007';
		else if (current_image_array == series_2005)
			text = '<< 2006';
		else if (current_image_array == series_2004)
			text = '<< 2005';
		else if (current_image_array == series_2003)
			text = '<< 2004';
		else if (current_image_array == series_2002)
			text = '<< 2003';
		else if (current_image_array == series_2001)
			text = '<< 2002';
		else if (current_image_array == series_2000)
			text = '<< 2001';
		else if (current_image_array == series_commission)
			text = '<< 2000';
		else if (current_image_array == series_new)
			text = '';

		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_2009)
			text = '2008 >>';
		else if (current_image_array == series_2008)
			text = '2007 >>';
		else if (current_image_array == series_2007)
			text = '2006 >>';
		else if (current_image_array == series_2006)
			text = '2005 >>';
		else if (current_image_array == series_2005)
			text = '2004 >>';
		else if (current_image_array == series_2004)
			text = '2003 >>';
		else if (current_image_array == series_2003)
			text = '2002 >>';
		else if (current_image_array == series_2002)
			text = '2001 >>';
		else if (current_image_array == series_2001)
			text = '2000 >>';
		else if (current_image_array == series_2000)
			text = 'commissioned works >>';
		else if (current_image_array == series_commission)
			text = '2009 >>';
		else if (current_image_array == series_new)
			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 sold = current_image_array[offset + 4];
	if (sold)
	{	var sold_text = 'Sold';
	}
	else
	{	var sold_text = '\t\n';
	}
***/

	display_main_image(image_file, image_name, medium, size, 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, 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;
	
	/***************************************************************************************************
	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, 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, 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);

/**
	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.
	document.writeln('<div style="float: left; width: 450px; margin: 0px; padding: 0px">');     

	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>');

/***
		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>');		
***/
	}

	document.writeln('</div>');
}

/******************************************************************************
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);

	//window.open('paintings.htm');
	
	if (current_image_array == series_new)
	{	document.location.href = 'series_new.html';
	}
	else if (current_image_array == series_2009)
	{	document.location.href = 'series_2009.html';
	}
	else if (current_image_array == series_2008)
	{	document.location.href = 'series_2008.html';
	}
	else if (current_image_array == series_2007)
	{	document.location.href = 'series_2007.html';
	}
	else if (current_image_array == series_2006)
	{	document.location.href = 'series_2006.html';
	}
	else if (current_image_array == series_2005)
	{	document.location.href = 'series_2005.html';
	}
	else if (current_image_array == series_2004)
	{	document.location.href = 'series_2004.html';
	}
	else if (current_image_array == series_2003)
	{	document.location.href = 'series_2003.html';
	}
	else if (current_image_array == series_2002)
	{	document.location.href = 'series_2002.html';
	}
	else if (current_image_array == series_2001)
	{	document.location.href = 'series_2001.html';
	}
	else if (current_image_array == series_2000)
	{	document.location.href = 'series_2000.html';
	}
	else if (current_image_array == series_commission)
	{	document.location.href = 'series_commission.php';
	}
	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));
}

/******************************************************************************
Slide Show function definitions.
******************************************************************************/

/***

var slide_index;
var timeout_ref;
var slide_show_go;

function start_slide_show()
{
	if (slide_show_go == 1)
	{	window.clearTimeout(timeout_ref);
	}
	
	slide_show_go = 1;
	slide_index = 0;
	next_slide();
}

function next_slide()
{	if ((slide_index < MAX_OIL_IMAGES) && (slide_show_go == 1))
	{
		get_oil_image(slide_index++);

		timeout_ref = window.setTimeout('next_slide()', 3000);
	}
}

function stop_slide_show()
{	
	if (slide_show_go == 1)
	{
		window.clearTimeout(timeout_ref);
		slide_show_go = 0;
	}
}

function continue_slide_show()
{	
	if (slide_show_go == 0)
	{
		slide_show_go = 1;
		next_slide();
	}
}

function display_start()
{
	var newElem = document.createElement("p");
	var newText = document.createTextNode('Start slide show');
	var oldChild = document.getElementById("instruction").childNodes[0];
	document.getElementById("instruction").replaceChild(newText, oldChild);	
}


function display_nothing()
{
	var newElem = document.createElement("p");
	var newText = document.createTextNode("  ");
	var oldChild = document.getElementById("instruction").childNodes[0];
	document.getElementById("instruction").replaceChild(newText, oldChild);
}

***/

// end hiding contents from old browsers  -->
// </script>
