/************** global variables ****************/
var miniwindow
var currentsection = "";
var currentsubnav = "";
var currentwindowurl = "";

/************** window functions ****************/

// function is used to load up generic popup window
function openwindow(htmlpage,winx,winy) {
  if (!miniwindow || miniwindow.closed || (currentwindowurl != htmlpage)) {
	var wininit = "width=" + winx + ",height=" + winy + ",scrollbars=yes,resizable=yes";
    miniwindow = window.open(htmlpage,'miniwindow',wininit);
  } 
  currentwindowurl = htmlpage;
  miniwindow.focus();
}

// function is used to close down all pop-up windows when exiting page
function closewindow() {
  if (miniwindow) {
    if (!(miniwindow.closed)) miniwindow.close();
  }
}

/************** validation functions ****************/

// function swap images
function swapImage(obj,img) {
  obj.src = img;
}

function toggleSection(id,dir_img) {
  if (id == currentsection) {
	document.getElementById(id).src = dir_img + id + ".gif";
	document.getElementById(id + "_section").style.display = 'none';
	currentsection = "";
  } else {
	if (currentsection != "") {
	  document.getElementById(currentsection).src = dir_img + currentsection + ".gif";
	  document.getElementById(currentsection + "_section").style.display = 'none';
	}

	document.getElementById(id).src = dir_img + id + "_hot.gif";
	document.getElementById(id + "_section").style.display = 'block';
	currentsection = id;
  }
}

function toggleSubNav(id) {
  if (id == currentsubnav) {
	document.getElementById(id).style.display = 'none';
	document.getElementById(currentsubnav + "_link").className = 'nav_link3';
	currentsubnav = "";
  } else {
	if (currentsubnav != "") {
	  document.getElementById(currentsubnav).style.display = 'none';
	  document.getElementById(currentsubnav + "_link").className = 'nav_link3';
	}

	document.getElementById(id).style.display = 'block';
	document.getElementById(id + "_link").className = 'nav_title3';
	currentsubnav = id;
  }
}

function closeSubNav() {
  if (currentsubnav != "") {
	document.getElementById(currentsubnav).style.display = 'none';
  }
}