function Animate() { imgFile = new Array()
imgSrc=new Array()
millisec=speed;
i=-1
for(fhr=first_hour;fhr<=last_hour;fhr+=fhr_incr) {
	i++
	var cfhr=fhr.toString(10)
	if ( map_id == "f" && cfhr.length < 2 ) {cfhr="0"+cfhr}
	imgFile[i]="http://"+topdir+map_dir+map_id+cfhr+"."+map_image
}
imgSrc=new Array()
for(i=0;i<imgFile.length;i++) {
	imgSrc[i]=new Image()
	// forces the image loading
	imgSrc[i].src=imgFile[i]
}
maps()
}
  
function checkTimer(){
	if (document.Timer.timerBox.checked){
		var newIndex = 0
		var gifName  = document.image1.src
		// identify the the 3 chars xxx.gif
		var index0=gifName.charAt(gifName.length-8)
		var index1=gifName.charAt(gifName.length-7)
		var index2=gifName.charAt(gifName.length-6)
		var index3=gifName.charAt(gifName.length-5)
                var map_id_last=map_id.substr(map_id.length-1)
		
		if (map_id == "f") {
			if (index0 != map_id_last) {
				var fhr = Number(index0 + index1 + index2 + index3)
			} else {
				var fhr = Number(index1 + index2 + index3)
			}
		} else {
			if (index1 != map_id_last) {
				var fhr = Number(index1 + index2 + index3)
			} else {
				var fhr = Number(index2 + index3)
			}
			//alert(fhr+" "+map_id_last+" "+index0+" "+index1+" "+index2)
		}
		if(map_id == "f") {
			var gifIndex=(fhr-first_hour)/fhr_incr
		} else {
			var gifIndex=fhr
		}
		//alert(gifName+" fhr = "+fhr)
		if (gifIndex < imgSrc.length -1) {
			newIndex = gifIndex +1
		}

		document.image1.src=imgSrc[newIndex].src
		var timeoutID = setTimeout("checkTimer()",millisec)  
	}
        else {return}
}

function maps() {
document.writeln('<html>')
document.writeln('<head>')
document.writeln('</head>')
document.writeln('  ')
document.writeln('<BODY>')
document.writeln('<center>')
document.writeln('<form name="Timer">')
document.writeln('<input type="checkbox" name="timerBox" onClick="checkTimer()"> Click to animate')
document.writeln('</form>')
i=-1
	for(fhr=first_hour;fhr<=last_hour;fhr+=fhr_incr) {
	var cfhr=fhr.toString(10)
	if ( map_id == "f" && cfhr.length < 2 ) {cfhr="0"+cfhr}
	i++
	document.writeln('<a href="#picture" onmouseover=document.image1.src=imgSrc['+i+'].src>'+map_id+cfhr+'</a>')
}
var cfhr=first_hour.toString(10)
if ( map_id == "f" && cfhr.length < 2 ) {cfhr="0"+cfhr}

//alert('<img name="image1" src=http://'+topdir+map_dir+map_id+cfhr+'.'+map_image+' height='+height+' width='+width+' >')
document.writeln('<br>')
document.writeln('<img name="image1" src=http://'+topdir+map_dir+map_id+cfhr+'.'+map_image+' height='+height+' width='+width+'>')
document.writeln('</center>')
document.writeln('</BODY>')
document.writeln('</html>')
}
//
// </SCRIPT>
//
