

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
//alert(BrowserDetect.browser);
//alert(BrowserDetect.version);
//alert(BrowserDetect.OS);





function screenres(){
if (screen.height ){
height = screen.height ;
}
var resolution = 800;
if (height >550 && height < 651 ) {resolution = 800};
if (height >650 && height < 801 ) {resolution = 800};
if (height >800 && height < 3001 ) {resolution = 800};
//if (height >550 && height < 651 ) {resolution = 600};
//if (height >650 && height < 801 ) {resolution = 800};
// if (height >800 && height < 3001 ) {resolution = 1000};

// 2009 11 20: for now all resolutions will be using the 800 version, which saves me the trouble 
// of doing different picture versions
return resolution;
}





// code for newsflashes 2009 12 09

/* Remaining code from Thomas C Sherman @ http://blog.thomascsherman.com/  

functions fade() and animateFade() from http://www.switchonthecode.com/tutorials/javascript-tutorial-simple-fade-animation */ 

   

/* Remaining code from Thomas C Sherman @ http://blog.thomascsherman.com/
functions fade() and animateFade() from http://www.switchonthecode.com/tutorials/javascript-tutorial-simple-fade-animation */
 
var TimeToFade = 1000.0; //time to fade in and fade out
var timeToShow = 10000.0; //how long to display each piece of content
var timeToRest = 250; //how long to wait before displaying next piece of content
var currentContentItem = 0; //which content item you wish to start with, zero based
var contentContainer; //the containing div
var contentItems; //all the content items
var fadeOutTimer; //timer for handling fade outs
var fadeInTimer; //timer for handling fade ins
 
function CycleQuotes()
{
//get all the divs inside the contentContainer div.  Each of these is a unique quote
contentContainer = document.getElementById("contentContainer");
contentItems = contentContainer.getElementsByTagName("div");
contentItems[0].style.display = "block"; //all child divs are currently hidden so show the first one
setTimeout("FadeOut()", timeToShow);
}
 
function PrevClick()
{
PausePlayClick(false);
 
//make sure the current quote is displayed
contentItems[currentContentItem].style.display = "none";
 
//change the current quote
if (currentContentItem == 0)
{ currentContentItem = contentItems.length - 1; }
else
{ currentContentItem--; }
 
contentItems[currentContentItem].style.display = "block";
}
 
function NextClick()
{
PausePlayClick(false);
 
//make sure the current quote is displayed
contentItems[currentContentItem].style.display = "none";
 
//change the current quote
if (currentContentItem == contentItems.length - 1) { currentContentItem = 0; }
else { currentContentItem++; }
contentItems[currentContentItem].style.display = "block";
}
 
function PausePlayClick(playing)
{
//get the play/pause buttons
var playbutton = document.getElementById('playimg');
var pausebutton = document.getElementById('pauseimg');
 
//start/stop the current fade effects
if (playing)
{
//change play icon to pause
pausebutton.style.display = "";
playbutton.style.display = "none";
 
setTimeout("FadeOut()", 0);
}
else
{
//make sure we have a quote showing
if (contentContainer.FadeState < 0)  { fade(contentContainer.id); }
 
//change pause icon to play icon
pausebutton.style.display = "none";
playbutton.style.display = "";
 
//stop timers
clearTimeout(fadeOutTimer);
clearTimeout(fadeInTimer);
}
}
 
//Fade out quote
function FadeOut()
{
fade(contentContainer.id);
fadeOutTimer = setTimeout("FadeIn()", TimeToFade + timeToRest);
}
 
//Fade new quote in
function FadeIn()
{
//hide the current quote (the container div will already have opacity set to 100% so this quote is currently invisible)
contentItems[currentContentItem].style.display = "none";
 
//show the next quote
if (currentContentItem == contentItems.length - 1) { currentContentItem = 0; }
else { currentContentItem++; }
contentItems[currentContentItem].style.display = "block";
 
//fade in the container
fade(contentContainer.id);
 
//recurse
fadeInTimer = setTimeout("FadeOut()", timeToShow);
}
 
function fade(eid) //function from http://www.switchonthecode.com/tutorials/javascript-tutorial-simple-fade-animation
{
var element = document.getElementById(eid);
if(element == null)
return;
 
if(element.FadeState == null)
{
if(element.style.opacity == null
|| element.style.opacity == ''
|| element.style.opacity == '1')
{
element.FadeState = 2;
}
else
{
element.FadeState = -2;
}
}
 
if(element.FadeState == 1 || element.FadeState == -1)
{
element.FadeState = element.FadeState == 1 ? -1 : 1;
element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
}
else
{
element.FadeState = element.FadeState == 2 ? -1 : 1;
element.FadeTimeLeft = TimeToFade;
setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
} 
 
}
 
function animateFade(lastTick, eid) //function from http://www.switchonthecode.com/tutorials/javascript-tutorial-simple-fade-animation
{
var curTick = new Date().getTime();
var elapsedTicks = curTick - lastTick;
 
var element = document.getElementById(eid);
 
if(element.FadeTimeLeft <= elapsedTicks)
{
element.style.opacity = element.FadeState == 1 ? '1' : '0';
element.style.filter = 'alpha(opacity = '
+ (element.FadeState == 1 ? '100' : '0') + ')';
element.FadeState = element.FadeState == 1 ? 2 : -2;
return;
}
 
element.FadeTimeLeft -= elapsedTicks;
var newOpVal = element.FadeTimeLeft/TimeToFade;
if(element.FadeState == 1)
newOpVal = 1 - newOpVal;
 
element.style.opacity = newOpVal;
element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
 
setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
}
