function redirect_message()
{
	//alert("Welcome back to Knollwood Farm!\n\nThis message is to alert you that the page you are trying to access has changed locations. It is likely that you have tried to access this page from a bookmark stored on your computer. Although this redirection will not be removed from the site any time soon, we suggest that you update your bookmark to reflect this change. You will be redirected to the correct page as soon as this message is closed.\n\nThank you for visiting Knollwood Farm online.\n- Colleen Hoekstra");
}

function last_modified()
{
	document.write("<span title='This is a JavaScript'>This document was last modified " + document.lastModified + "</span>");
}

function browser_check()
{
	if(check_cookie() && !is_modern)
	{
		if(!get_cookie('kwf_browser'))
		{
			var expiration = new Date();
			expiration.setTime(expiration.getTime() + 180 * 24 * 60 * 60 * 1000);
			set_cookie('kwf_browser',1,expiration);
			if(confirm("A Message from Knollwood Farm\n\nA script has determined that your browser may not fully support the features of this website.\nChoose OK to learn more about this issue and Knollwood Farm online, or click Cancel to ignore this message and continue."))
			{
				location.href='browser/';
			}
		}
	}
}

/*
	name - name of the cookie
	value - value of the cookie
	[expires] - expiration date of the cookie (defaults to end of current session)
	[path] - path for which the cookie is valid (defaults to path of calling document)
	[domain] - domain for which the cookie is valid (defaults to domain of calling document)
	[secure] - Boolean value indicating if the cookie transmission requires a secure transmission
*/
function set_cookie(name,value,expires,path,domain,secure)
{
	var new_cookie = name + "=" + escape(value) +
	 ((expires) ? ";expires=" + expires.toGMTString() : "") +
	 ((path) ? ";path=" + path : "") +
	 ((domain) ? ";domain=" + domain : "") +
	 ((secure) ? ";secure" : "");
	if(document.cookie = new_cookie)
	{
		return true;
	}
	return false;
}

function get_cookie(name)
{
	var cookie_search = name + "=";
	if(document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(cookie_search);
		if(offset != -1)
		{
			offset += cookie_search.length;
			end = document.cookie.indexOf(";",offset);
			if(end == -1)
			{
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(offset,end));
		}
	}
	return false;
}

function delete_cookie(name,path,domain)
{
	if(get_cookie(name))
	{
		document.cookie = name + "=" + 
			";expires=Thu, 01-Jan-70 00:00:01 GMT" + 
			((path) ? ";path=" + path : "") + 
			((domain) ? ";domain=" + domain : "");
		return true;
	}
	return false;
}

function check_cookie()
{
	// Internet Explorer
	if(document.all)
	{
		return navigator.cookieEnabled;
	}
	// Else
	set_cookie('test',1776);
	var temp_cookie = get_cookie('test');
	delete_cookie('test');
	return (temp_cookie == 1776) ? true : false;
}
// end cookie functions

// slideshow
// coded July 23, 2004
// last updated July 26, 2004
function SlideShow(image_id,text_id,preload)
{
	this.display = document.getElementById(image_id);
	this.caption = document.getElementById(text_id);
	this.iterator = 0;
	this.counter = 1;
	this.slides = new Array();
	
	if(preload)
	{
		document.preloaded_images = new Array();
		this.preload = true;
	}
}

function Slide(image_url,image_caption)
{
	this.url = image_url;
	this.caption = image_caption;
}

SlideShow.prototype.add = function (image_url,image_caption)
{
	this.slides[this.slides.length] = new Slide(image_url,image_caption);
	this.update();
	
	// pre-load
	if(this.preload)
	{
		document.preloaded_images[document.preloaded_images.length - 1] = new Image();
		document.preloaded_images[document.preloaded_images.length - 1].src = image_url;
	}
}

SlideShow.prototype.next = function ()
{
	var num_slides = this.slides.length - 1;
	if(num_slides == this.iterator)
	{
		this.iterator = 0;
	}
	else
	{
		this.iterator++;
	}
	this.update();
}

SlideShow.prototype.previous = function ()
{
	if(this.iterator == 0)
	{
		this.iterator = this.slides.length - 1;
	}
	else
	{
		this.iterator--;
	}
	this.update();
}

SlideShow.prototype.update = function ()
{
	this.display.src = this.slides[this.iterator].url;
	this.counter = "[" + (this.iterator + 1) + "/" + this.slides.length + "]";
	this.caption.firstChild.nodeValue = this.counter + " " + this.slides[this.iterator].caption;
}
// end slideshow functions

/***
*	User Agent Processing - Browser, Operating System, JavaScript detection.
*	Started: May 15 2004 
*	Last Modified: July 25 2004
*	All Rights Reserved - Adam Stuart
***/
// get user agent
var agent = navigator.userAgent.toLowerCase();
var major_version = parseInt(navigator.appVersion);
var minor_version = parseFloat(navigator.appVersion);

// determine browser type
var is_firefox = (agent.indexOf('firefox') != -1);
var is_camino = (agent.indexOf('camino') != -1);
var is_gecko = (agent.indexOf('gecko') != -1);
var is_opera = (agent.indexOf('opera') != -1);
var is_safari = (agent.indexOf('safari') != -1);
var is_konqueror = (agent.indexOf('konqueror') != -1);
var is_aol = (agent.indexOf('aol') != -1);
var is_webtv = (agent.indexOf('webtv') != -1);
var is_hotjava = (agent.indexOf('hotjava') != -1);
var is_mozilla = ((agent.indexOf('mozilla') != -1) && (agent.indexOf('compatible') == -1) && !is_firefox && !is_camino && !is_safari && !is_konqueror && !is_opera && !is_webtv && !is_hotjava);
var is_navigator = ((minor_version < 5.0) && is_mozilla);
var is_ie = ((agent.indexOf('msie') != -1) && !is_opera);

// set browser type
var browser = "unknown";
if(is_firefox) browser = "Firefox";
else if(is_camino) browser = "Camino";
else if(is_opera) browser = "Opera";
else if(is_safari) browser = "Safari";
else if(is_konqueror) browser = "Konqueror";
else if(is_aol) browser = "AOL";
else if(is_ie) browser = "Internet Explorer";
else if(is_webtv) browser = "WebTV";
else if(is_hotjava) browser = "HotJava";
else if(is_navigator) browser = "Netscape Navigator";
else if(is_mozilla) browser = "Mozilla";
else if(is_gecko) browser = "Gecko";

// firefox
var is_firefox_beta = (is_firefox) ? ((parseFloat(agent.substring((agent.indexOf('firefox/') + 8),agent.length)) < 1.0) || (agent.indexOf('firebird')) || (agent.indexOf('phoenix'))) : false;

// mozilla
mozilla_version = parseFloat(agent.substring((agent.indexOf('rv:') + 3),agent.indexOf(') Gecko')));
var is_mozilla1_0 = (is_mozilla && (mozilla_version == 1.0));
var is_mozilla1_1 = (is_mozilla && (mozilla_version == 1.1));
var is_mozilla1_2 = (is_mozilla && (mozilla_version == 1.2));
var is_mozilla1_3 = (is_mozilla && (mozilla_version == 1.3));
var is_mozilla1_4 = (is_mozilla && (mozilla_version == 1.4));
var is_mozilla1_5 = (is_mozilla && (mozilla_version == 1.5));
var is_mozilla1_6 = (is_mozilla && (mozilla_version == 1.6));
var is_mozilla1_7 = (is_mozilla && (mozilla_version == 1.7));
var is_mozilla1_8 = (is_mozilla && (mozilla_version == 1.8));

navigator_version = parseInt(agent.substring((start = agent.indexOf('mozilla/') + 8),(start + 3)));
var is_navigator1 = (is_navigator && (navigator_version == 1));
var is_navigator2 = (is_navigator && (navigator_version == 2));
var is_navigator3 = (is_navigator && (navigator_version == 3));
var is_navigator4 = (is_navigator && (navigator_version == 4));
var is_navigator5 = (is_navigator && (navigator_version == 5));
navigator_version = parseInt(agent.substring((start = agent.indexOf('netscape') + 1),(start + 2)));
var is_navigator6 = (is_navigator && (navigator_version == 6));
var is_navigator7 = (is_navigator && (navigator_version == 7));

// ie
var is_ie3 = (is_ie && (major_version == 3));
var is_ie4 = (is_ie && (major_version == 4));
var is_ie5 = (is_ie && (agent.indexOf('msie 5.0') != -1));
var is_ie5_5 = (is_ie && (agent.indexOf('msie 5.5') != -1));
var is_ie6 = (is_ie && (major_version == 6));

// opera
opera_version = parseInt(agent.substring((start = agent.indexOf('opera') + 6),(start + 1)));
var is_opera2 = (is_opera && (opera_version == 2));
var is_opera3 = (is_opera && (opera_version == 3));
var is_opera4 = (is_opera && (opera_version == 4));
var is_opera5 = (is_opera && (opera_version == 5));
var is_opera6 = (is_opera && (opera_version == 6));
var is_opera7 = (is_opera && (opera_version == 7));

// aol
var is_aol3 = (is_aol && is_ie3);
var is_aol4 = (is_aol && is_ie4);
var is_aol5 = (agent.indexOf('aol 5') != -1);
var is_aol6 = (agent.indexOf('aol 6') != -1);
var is_aol7 = (agent.indexOf('aol 7') != -1);
var is_aol8 = (agent.indexOf('aol 8') != -1);

// hotjava
var is_hotjava3 = (is_hotjava && (major_version == 3));

// determine operating systems
var is_windows = ((agent.indexOf('win') != -1) || (agent.indexOf('16bit') != -1));
var is_macintosh = (agent.indexOf('mac') != -1);

// determine javascript version
var is_javascript = true;	// this wouldn't work if it wasn't enabled! ;)
var javascript_version = 0.0;

document.write('<script language="JavaScript1.0">var javascript_version = 1.0;</script>');
document.write('<script language="JavaScript1.1">var javascript_version = 1.1;</script>');
document.write('<script language="JavaScript1.2">var javascript_version = 1.2;</script>');
document.write('<script language="JavaScript1.3">var javascript_version = 1.3;</script>');
document.write('<script language="JavaScript1.4">var javascript_version = 1.4;</script>');
document.write('<script language="JavaScript1.5">var javascript_version = 1.5;</script>');
document.write('<script language="JavaScript2.0">var javascript_version = 2.0;</script>');

var is_modern = ((javascript_version == 1.5) || is_ie6);

// determine CSS compatability

/*** end User Agent Processing end ***/