function plato(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) 
		{
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) 
	{
	  var imgFiles = preloadImages.arguments;
      for (var i=0; i<imgFiles.length; i+=2) 
      {
        eval(imgFiles[i]+' = plato(imgFiles[i+1])');
        eval(imgFiles[i]+'.src = "'+imgFiles[i+1]+'"');
      }
		preloadFlag = true;
	}
}

preloadImages(
	'contact','/img/rightnav/ns_contact_us_on.gif',
	'downloads','/img/rightnav/ns_downloads_on.gif',
	'purchase','/img/rightnav/ns_purchase_on.gif',
	'request','/img/rightnav/ns_request_info_on.gif');

	

/* begin toggle div tags  */

function toggleVisibility() {
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) {
    var id = arguments[inc];
    if (arguments[inc+1] == 'hidden') param = "hidden";
    else if(arguments[inc+1]=='visible') param = "visible";
    if (document.layers) document.layers['container'].layers[id].visibility = param;
    else if (document.all) eval("document.all." + id + ".style.visibility = \"" + param + "\"");
    else if (document.getElementById) eval("document.getElementById(id).style.visibility = \"" + param + "\"");
  }
}

/* end toggle div tags */

//-----------------------------------------------------------------------------
// toggleRegion (dcharette@atre.net)
//  This function cycles through a series of HTML tags (img, div, etc) and sets
//  all the visibility of all but one to hidden. The other is made visible.
//  It takes two or more arguments:
//   1  - The tag number to make visible.
//   2+ - The tag ID, minus it's sequence number: 'image' in the case of
//       'image0', 'image1', 'image2', etc...
//  By convention, 0 is the default ID. Initial states of the tags must
//   be defined elsewhere.
function toggleRegion(which, region) {
	// Cycle through arguments, and apply the appropriate rollover status
	for (var a = 1; a < arguments.length; a++) {
		var i = 1;
		var x = document.getElementById(arguments[a]+i);

		// Cycle through all rollover tag (starting at 1, ending at the first sequentially non-existant element)
		while (x) {
			// Set all images hidden, except 'which'
			if (which != i) { x.style.visibility="hidden"; }
			x = document.getElementById(arguments[a]+(++i));
		}

		// Make the selected tag visible
		x = document.getElementById(arguments[a]+which);
		if (x) {
			x.style.visibility="visible";
		} else {
			x = document.getElementById(arguments[a]+0);
			if (x) x.style.visibility="visible";
		}
	}
}
