var g_nNumBtns = 9
var normal_pix = new makeImageArray(g_nNumBtns)
var glow_pix = new makeImageArray(g_nNumBtns)
var texts = new Array(g_nNumBtns)
var inames = new Array(g_nNumBtns)
var altnames = new Array(g_nNumBtns)

// Pre-cache images
if (document.images) {
   normal_pix = new makeImageArray(g_nNumBtns)
   glow_pix = new makeImageArray(g_nNumBtns)
   texts = new Array(g_nNumBtns)
   inames = new Array(g_nNumBtns)
   altnames = new Array(g_nNumBtns)

   loadButton(0, "about", "Who we are", "Home")
   loadButton(1, "adg", "The Advanced Digital Graphics System", "ADG")
   loadButton(2, "adr", "The Advanced Digital Replay System", "ADR")
   loadButton(3, "adv", "The Advanced Digital Video Server", "ADV")
   loadButton(4, "video", "Video Race Patrol System", "Video Production")
   loadButton(5, "uplink", "Satellite Uplink Services", "Uplink")
   loadButton(6, "client", "Our List of Clients", "Clients")
   loadButton(7, "contact", "How to contact ISC", "Contact")
   loadButton(8, "employees", "Employees entrance", "Employees")
}

function loadButton(idx, img, txt, alt) {
	glow_pix[idx].src   = "images/buttons/" + img + "_sel.jpg"
	normal_pix[idx].src = "images/buttons/" + img + ".jpg"
	texts[idx]          = txt
	inames[idx]         = img
	altnames[idx]       = alt
}

function makeImageArray(n) {
	this.length = n		   	//?????
	for (var i = 0; i < n; i++) {
		this[i] = new Image()
	}
	return this
}

function mouseOver(num) {
	if (document.images) {
		window.top.frames[1].document.images[num + 0].src = glow_pix[num].src
	}
	window.status = texts[num]
}

function mouseOut(num) {
	if (document.images) {
		window.top.frames[1].document.images[num + 0].src = normal_pix[num].src
	}
	window.status = ""
}

function drawButtons()
{
    document.write("<TABLE CLASS=base WIDTH=760 CELLPADDING=0 CELLSPACING=0 BORDER=0 VALIGN=TOP><TR><TD VALIGN=TOP WIDTH=122>")
	for (i = 0; i < g_nNumBtns; i++) {
        drawButton(i, inames[i])
	}
	document.write("</TD><TD VALIGN=TOP>")
}

function drawButton(idx, tgt)
{
    document.write("<A HREF=\"" + tgt + ".html\" TARGET=\"filler\" onmouseover=\"mouseOver(" + idx + "); return true\" onmouseout=\"mouseOut(" + idx + "); return true\"><IMG SRC=\"images/buttons/" + tgt + ".jpg\" BORDER=0 WIDTH=122 HEIGHT=39 ALT=\"" + texts[idx] + "\"><BR></A>")
}

function addTrack(track, web)
{
    if (null != web) {
	     document.write("<LI CLASS=tracks><A CLASS=tracks HREF=\"http://" + web + "\" TARGET=\"trackwin\">" + track + "</A>")
	}
	else {
		 document.write("<LI CLASS=tracks>" + track)
    }
}

function addInfo(num, name, desc, mail)
{
    document.write("<TR><TD CLASS=name" + num + ">" + name + "</TD>")
	if (null == desc) {
	     document.write("<TD></TD>")
	}
	else {
		 document.write("<TD CLASS=desc" + num + ">" + desc + "</TD>")
	}
	document.write("<TD CLASS=mail" + num + "><A CLASS=info" + num + " HREF=\"mailto:" + mail + "\">" + mail + "</A></TD></TR>")
}

function printFooter()
{
    // Get file name
	var doc
	if (-1 == document.URL.indexOf(".html")) {
	    doc =  inames[0]
	}
	else {
		 var nIdx = document.URL.lastIndexOf("\\")
		 if (-1 == nIdx) {
	   	 	nIdx = document.URL.lastIndexOf("/")
		 }
		 doc = document.URL.substring(nIdx + 1, document.URL.length - 5)
	}
	
	document.write("</TD></TR></TABLE>\n<HR WIDTH=\"60%\"><P ALIGN=CENTER><FONT CLASS=foot>")
	for (i = 0; i < g_nNumBtns; i++) {
		if (0 != i) {
		   document.write(" - ")
		}
		if (doc == inames[i]) {
		    document.write(altnames[i])
		}
		else {
		    document.write("<A CLASS=foot HREF=\"" + inames[i] + ".html\" onmouseover=\"mouseOver(" + i + "); return true\" onmouseout=\"mouseOut(" + i + "); return true\">" + altnames[i] + "</A> ")
	    }
	}
	document.write("</FONT></P>")
}
