// 

var panImg = "http://www.currah.co.uk/flashpan/BurtPan.jpg"
var picWinHeight = "400px"
var browser = ""
var compat = 0

function detect(){
	bname = navigator.appName
	bvers = navigator.appVersion.charAt(0) - 0

	if (bname.indexOf("Netscape")!=-1 && bvers >= 5){
		browser = "Net"
		compat = 1
		}
	if (bname.indexOf("Microsoft")!=-1 && bvers >= 4){
		browser = "IEx"
		compat = 1
		}
	browser="Oth"
}

function loadImgs(){
	detect()
	loading = new Image();
	loading.src = "Loading.jpg";
	failed = new Image();
	failed.src = "Failed.jpg";
	blank = new Image();
	blank.src = "Blank.jpg";
	smallCount = 3
	tryID = setInterval("trySmalls()",1)
}

function trySmalls(){
	if(!loading.complete) smallCount--;
	if(!failed.complete) smallCount--;
	if(!blank.complete) smallCount--;
	if(smallCount == 3) {clearInterval(tryID); loadPanImg()} else smallCount = 3;
}

function loadPanImg(){	
	pic = new Image();
	pic.src = panImg;
	timerID = setInterval("finishIt()",100)
}	

function finishIt(){
	tryCount++	
	finished = true
	if(browser == "Net" && pic.width < 1) finished = false 
	if(browser != "Net" && pic.complete == false) finished = false
	if(!finished) {if(tryCount > 150) terminate();}
	else {
	clearInterval(timerID)
	alert("xxx")
	document.getElementById('picBox').style.height = picWinHeight
	//alert(tryCount + "   " + pic.complete + "   " + pic.name)
	//alert(blank.width)
	document.images['myPic'].src = blank.src
	document.images[0].src = pic.src
	oldWidth = pic.width	
	oldHeight = pic.height
	aspect = oldWidth / oldHeight
	//alert("xxx")
	boxHeight = document.getElementById('picBox').offsetHeight
	newWidth = boxHeight * aspect
	document.images[0].width = newWidth
	document.images[0].height = boxHeight
	document.images[0].src = pic.src
	}
}

function terminate(){	
	clearInterval(timerID)
	msg = "Unable to complete loading the image from location:\n" + panImg + "."
	alert(msg)
	document.images[0].src = failed.src
}




// Script for

function spotOn(nlink){
	imgID = "spot" + nlink
	if(nlink==1)
	  	document.images[imgID].src = "imgs-sys/SptRed.gif"
	else
		document.images[imgID].src = "imgs-sys/SptGreen.gif"
}

function spotOff(nlink){
	imgID = "spot" + nlink
	document.images[imgID].src = "imgs-sys/SptBlank.gif"
}

bannerLinkFlag = 0
aboutLink = ""
function bannerLink(about){
	bannerLinkFlag = 1
	aboutLink = about
	document.images['pic1'].src = "imgs-sys/TopAbout.gif"
	document.images['pic2'].src = "imgs-sys/BotAbout.gif"
}

function picLink(picIndex){
	linkID = picIndex.slice(0,1)
	picIndex = picIndex.slice(1)
	if(bannerLinkFlag == 0) {window.location.href = picIndex; return}
	bannerLinkFlag = 0
	if(linkID == 1){
		document.images['pic1'].src = "imgs-sys/top.jpg"
		document.images['pic2'].src = "imgs-sys/bot.jpg"
		return
		}
		window.location.href = aboutLink	
}








