function preloadImages(group,prefix) {
	filePath = "../"
	if (currentSection == "home") filePath = ""
	eval("useArray = " + group + "Array")
	for (v=0;v<useArray.length;v++) {
		eval(useArray[v] + 'off = new Image()')
		eval(useArray[v] + 'off.src = "' + filePath + "images/" + prefix + useArray[v] + '.gif"')
		eval(useArray[v] + 'on = new Image()')
		eval(useArray[v] + 'on.src = "' + filePath + "images/" + prefix + useArray[v] + '_over.gif"')
	}
}

function turnon(i,whichLayer) {
	if (i != "") {
		if (document.layers && whichLayer && whichLayer != "") {
			if (whichLayer.indexOf("Lyr") < 0) {
				eval('document["' + whichLayer + '"].document[i].src = ' + i + 'on.src')
			} else {
				eval('document.layers["' + whichLayer + '"].document.images[i].src = ' + i + 'on.src')
			}
		} else {
			document[i].src = eval(i + "on.src")
		}
	}
}

function turnoff(i,whichLayer) {
	if (i != currentSection && i != currentSubSection) {
		if (document.layers && whichLayer && whichLayer != "bkg") {
			if (whichLayer.indexOf("Lyr") < 0) {
				eval('document["' + whichLayer + '"].document[i].src = ' + i + 'off.src')
			} else {
				eval('document.layers["' + whichLayer + '"].document.images[i].src = ' + i + 'off.src')
			}
		} else {
			document[i].src = eval(i + "off.src")
		}
	}
}

function initPage() {

	if (window.menuArray) {
		for (x=0;x<menuArray.length;x++) {
			positionLayers(menuArray[x],menuHposition[x],menuVposition[x])
		}
	}
	
	if (relatedData) {
		relateddataLyr = new domObject("relateddataLayer","relatedLayer")
	}

	if (floaters.length > 0) {
		for (x=0;x<floaters.length;x++) {
			eval(floaters[x][0] + 'Lyr = new domObject("' + floaters[x][0] + 'Layer")')
			positionLayers(floaters[x][0],floaters[x][1],floaters[x][2])
			eval(floaters[x][0] + 'Lyr.sty.visibility = "visible"')
		}
	}
	
	if (bullets > 0) {
		for (v=1;v<=bullets;v++) {
			eval('local' + v + 'off = new Image()')
			eval('local' + v + 'off.src = "../images/bullet1.gif"')
			eval('local' + v + 'on = new Image()')
			eval('local' + v + 'on.src = "../images/bullet1_over.gif"')
		}
	}

	turnon(currentSection)
	turnon(currentSubSection)

}
/*  Addition to original common.js file */
	var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=100,top=100";
	if (type == "consolewithscrollbar") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=100,top=100";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}
	
/*  End of addition to original common.js file */

function popup (file,index) {
	windowDims = new Array([650,400],[750,400])
	eval('newWindow = window.open("' + file + '","new_window","height=' + windowDims[index][1] + ',width=' + windowDims[index][0] + ',scrollbars=yes,menubar=yes,directories=no,location=no,status=yes,resizable=yes")');
	newWindow.focus();
}

function openMovie(movie) {
	newMovie = movie
	movieWindow = window.open('../dummy.html','moviewindow','width=320,height=240,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no')
	timer = setTimeout('showMovie(newMovie)',100)
}

function showMovie(movie) {
	htmlcodePre = "<html><head><title>View Window &nbsp;</title><body bgcolor=000000 marginheight=0 marginwidth=0 topmargin=0 leftmargin=0>\n<embed src='"
	htmlcodePost = "' width=320 height=240 autostart=true loop=false controller=false>"
	htmlcodePost += "</body></html>"
	fullcode = htmlcodePre + movie + htmlcodePost
	movieWindow.document.open();
	movieWindow.document.write(fullcode);
	movieWindow.document.close();
	movieWindow.focus();
}

