// JavaScript Document
var notie = false;
var slideCache = new Array();
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
browser = "Konqueror";
OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
browser = "Netscape Navigator"
version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
if (checkIt('linux')) OS = "Linux";
else if (checkIt('x11')) OS = "Unix";
else if (checkIt('mac')) OS = "Mac"
else if (checkIt('win')) OS = "Windows"
else OS = "an unknown operating system";
}

function checkIt(string)
{
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}


function change() {
	if (document.getElementById)
	{
		Img = document.getElementById("slide")
		if (Img.complete)
		{
			if (browser == "Internet Explorer" && version >= "6" )
			{
				Img.style.filter="blendTrans(duration=2)";
				Img.filters.blendTrans.Apply();
				thisImage++
				if (thisImage == imagecount)
				{
					thisImage = 0
				}
			}
			else
			{
				notie = true;
			}
			Img.src = Images[thisImage]
			if (notie)
			{
				thisImage++
				if (thisImage == imagecount)
				{
					thisImage = 0
				}
			}	
			if (browser == "Internet Explorer" && version >= "6" )
			{
				Img.filters.blendTrans.Play();
			}
		}
		clearMe = setTimeout("change()", 4 * 1000)

		nextImage = thisImage + 1
		if (nextImage == imagecount)
		{
			nextImage = 0
		}		
		if (slideCache[thisImage] == null) {
  			slideCache[nextImage] = new Image;
		  	slideCache[nextImage].loaded = false;
		  	slideCache[nextImage].onload = function(){this.loaded=true};
		  	slideCache[nextImage].src = Images[nextImage];
		}
	}
}

function change_main(name)
{
	if (document.getElementById)
	{
		Img = document.getElementById("mainpic")
		Img.src = name
	}
}

function format(num)
{
        num = num.toString().replace(/,/g,'');
        if(isNaN(num)||(num==''))
                num = "";
        else
        {
                num = Math.floor((num*100+0.5)/100).toString();
                for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
                num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
        }
        return (num);
}

function change_latest() {
	if (document.getElementById)
	{
		Late = document.getElementById("feature" + current)
		current++
		if (current == totallatest)
		{
			current = 0
		}
		Next = document.getElementById("feature" + current)
		Late.style.display = "none";
		if (browser == "Internet Explorer" && version >= "6" )
		{
			Next.style.filter="blendTrans(duration=3)";
			Next.filters.blendTrans.Apply();
		}
		Next.style.display = "block";
		if (browser == "Internet Explorer" && version >= "6" )
		{
			Next.filters.blendTrans.Play();
		}
		LatestTimer = setTimeout("change_latest()", 10 * 1000)

	}
}

function open_file(file, name)
{
	PropWindow = window.open(file, name, "width=620,height=600,scrollbars=yes");
	PropWindow.focus();
}

function open_map(file)
{
	MapWindow = window.open(file, 'Map', "width=670,height=400,scrollbars=yes");
	MapWindow.focus();
}