// Browser sniff
function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0)
	if (this.ie5) this.v = 5
	if (this.ie6) this.v = 6
	this.min = (this.ns||this.ie)
	}

// automatically create the "is" object
is = new BrowserCheck()

// Preload script from Jeffrey Zeldman.
var preloadFlag = false;

function newImage(arg)
{
if (document.images)
	{
	rslt = new Image();
	rslt.src = arg;
	return rslt;
	}
}

	
function colorSwap(item,color)
{
document.getElementById(item).style.background=color;
}

//The thumbnail gallery.
function writeGallery()
{
	if (imgA!='') document.write('<a href="closeup_'+category+'_'+imgA+'.html" onmouseover="" onmouseout=""><img src="photos/'+category+'_'+imgA+'_small.jpg" alt="click to enlarge" border="0" /></a>');
	if (imgB!='') document.write('<a href="closeup_'+category+'_'+imgB+'.html" onmouseover="" onmouseout=""><img src="photos/'+category+'_'+imgB+'_small.jpg" alt="click to enlarge" border="0" /></a>');
	if (imgC!='') document.write('<a href="closeup_'+category+'_'+imgC+'.html" onmouseover="" onmouseout=""><img src="photos/'+category+'_'+imgC+'_small.jpg" alt="click to enlarge" border="0" /></a>');
	if (imgD!='') document.write('<a href="closeup_'+category+'_'+imgD+'.html" onmouseover="" onmouseout=""><img src="photos/'+category+'_'+imgD+'_small.jpg" alt="click to enlarge" border="0" /></a>');
}

//The following functions detect older browsers and redirects to an upgrade page using a cookie.
//It also places text in the status bar.
function status(text)
{
var userChoice = readCookie('choice')
if (userChoice != "declined")
	{
	// DISABLED - ANTIQUATED
	//if (is.ns4||is.ie4) window.location.href="http://www.themitchellagency.net/upgrade/";
	}
if (text == '') window.defaultStatus='The Mitchell Agency';
}


function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}
