scores = new Array(20);
var numTotal=0;
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

if (ver4) {
    with (document) {
        write("<STYLE TYPE='text/css'>");
        if (NS4) {
            write(".parent {position:absolute; visibility:visible}");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        }
        else {
            write(".child {display:none}")
        }
        write("</STYLE>");
    }
}

function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}

function arrange() {
    nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}

function initIt(){
    if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
       }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);
            if (whichEl.className == "child") whichEl.style.display = "none";
        }
    }
}

function expandIt(el) {
	if (!ver4) return;
    if (IE4) {
        whichEl1 = eval(el + "Child");
		for(i=1;i<=numTotal;i++){
			whichEl = eval(scores[i] + "Child");
			if(whichEl!=whichEl1) {
				whichEl.style.display = "none";
			}
		}
        whichEl1 = eval(el + "Child");
        if (whichEl1.style.display == "none") {
            whichEl1.style.display = "block";
        }
        else {
            whichEl1.style.display = "none";
        }
    }
    else {
        whichEl = eval("document." + el + "Child");
		for(i=1;i<=numTotal;i++){
			whichEl = eval("document." + scores[i] + "Child");
			if(whichEl!=whichEl1) {
				whichEl.visibility = "hide";
			}
		}
        if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
        }
        else {
            whichEl.visibility = "hide";
        }
        arrange();
    }
}
onload = initIt;


function loadImages(form) {
        var gifIndex = form.cached.selectedIndex
        document.thumbnail.src = imageDB[gifIndex].src
}


function checkTimer() {
        if (document.ControlBar.timerBox.value == "1") {
                var newIndex = imageDB.length - 1
                var gifIndex = document.selections.cached.selectedIndex
        if (gifIndex > 0) {
                newIndex = gifIndex - 1
        }
                document.thumbnail.src = imageDB[newIndex].src
                document.selections.cached.selectedIndex = newIndex
        if (newIndex == 0) {
                var timeoutID = setTimeout("checkTimer()",3000)
        }
        else {
                var timeoutID = setTimeout("checkTimer()",1000)
        }

        }
}


        function play()
        {
                document.ControlBar.timerBox.value = "1";
                checkTimer();
        }
        function stop()
        {
                document.ControlBar.timerBox.value = "0";
                checkTimer();
        }
        function next()
        {
                document.ControlBar.timerBox.value = "0";
                checkTimer();
                var newIndex = imageDB.length - 1
                var gifIndex = document.selections.cached.selectedIndex
                if (gifIndex > 0) {
                newIndex = gifIndex - 1
                }
                document.thumbnail.src = imageDB[newIndex].src
                document.selections.cached.selectedIndex = newIndex
        }
        function back()
        {
                document.ControlBar.timerBox.value = "0";
                checkTimer();
                var newIndex = 0
                var gifIndex = document.selections.cached.selectedIndex
                if (gifIndex < imageDB.length - 1) {
                        newIndex = gifIndex + 1
                }
                document.thumbnail.src = imageDB[newIndex].src
                document.selections.cached.selectedIndex = newIndex
        }
        function first()
        {
                document.ControlBar.timerBox.value = "0";
                checkTimer();
                var newIndex = imageDB.length - 1
                document.thumbnail.src = imageDB[newIndex].src
                document.selections.cached.selectedIndex = newIndex
        }
        function last()
        {
                document.ControlBar.timerBox.value = "0";
                checkTimer();
                var newIndex = 0
                document.thumbnail.src = imageDB[newIndex].src
                document.selections.cached.selectedIndex = newIndex
        }

function slidelink(){
var imagesrc=document.thumbnail.src;
top.location.href=imagesrc;
}

function slidecloudlink(){
//this function is unnecessary
var imagesrc=document.thumbnail.src.substr(0,52)+".jpg";
var h=screen.height;
var w=screen.width;
imgwin=window.open(imagesrc,'AAMS','scrollbars,resizable,width=800,height=600');
}

function Open(thisform){
	var myvalue=thisform.options[thisform.selectedIndex].value
  if (myvalue.length>0)
  	 location=myvalue

}

function ImageWindow(imghref, imgname, w, h, scroll) {
	//noaa function
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var clkh = (h - 19);
var clkw = (w - 20);
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
var ImageWind = window.open("", imgname, winprops)
ImageWind.document.open();
ImageWind.document.write("<html><head><title>"+imgname+"</title>");
ImageWind.document.write("</head><body background=\""+imghref+"\"><SPAN style=\"position\:absolute; LEFT\:337px; TOP\:30px; zIndex\:0; color:red; font-size:20pt;\">Click Window to Close</SPAN><a href=\"javascript\:window.close()\"><IMG SRC=\"/static/images/blank.gif\" HEIGHT="+clkh+" WIDTH="+clkw+" BORDER=0></a></body></html>")
ImageWind.document.close();
if (parseInt(navigator.appVersion) >= 4) { ImageWind.window.focus(); }
}

function mhEnter(this_s)
{
this_s.className="menu1";
}

function mhLeave(this_s)
{
this_s.className="menu0";
}

function windslink(imgtype){
var imagesrc=document.thumbnail.src;
var newimgsrc=imagesrc.substr(0,38)+imgtype+imagesrc.substr(38,11)+'.jpg';
top.location.href=newimgsrc;
}