function openMenu(menuName)
{
	var mnu = document.getElementById(menuName);
	mnu.style.visibility = "visible";
}
function closeMenu(menuName)
{
	var mnu = document.getElementById(menuName);
	mnu.style.visibility = "hidden";
} 
function openWindow(URL,name,feats) { 	newWin = window.open(URL,name,feats);	newWin.focus(); }


function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function ImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function preload() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preload.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/*
*
* Image rotation for the index page
*
*/
var currentImage = 1;
var iv = 0;
// Start the rotation timer
function startRotateImages() { iv = setInterval("rotateImages()", 5000); }
// Fired every second, will change the image to the next
// in the list (imgs directory)
function rotateImages()
{
	currentImage++;
	showImage(currentImage);
}
// Display and image in the lower banner image
function showImage(id) 
{
	if(id > 4)
		id = 1;
	currentImage = id;
	var img = document.getElementById('lowerbanner');
	img.src = "imgs/mainimg" + id + ".jpg";
	
	setIconButtons(currentImage);
}
// Forces the display of an image
function showFixedImage(id)
{
	clearInterval(iv);	
	showImage(id);
}
// Reset the page icon buttons
function setIconButtons(id) 
{
	var img;
	// reset all of the other icons
	for(var i = 1; i < 5; i ++)
	{
		if(i == id) 
			continue;
			
		img = document.getElementById('icons' + i);
		img.src = "imgs/icons_up_r1_c" + i + ".gif";
		img = document.getElementById('displayblock' + i);
		img.style.visibility = "hidden";
		img = document.getElementById('imgtitle' + i);
		img.style.color = '#D6D6D6';
	}
	
	// Set this icon button
	img = document.getElementById('icons' + id);
	img.src = "imgs/icons_down_r1_c" + id + ".gif";
	img = document.getElementById('displayblock' + id);
	img.style.visibility = "visible";
	img = document.getElementById('imgtitle' + id);
	img.style.color = '#000000';
	
}
