
var nom = 5; // Number of menus
var usePictures = 0; // use pictures?  1 = yes, 0 = no

var ttls = new Array(); // An array for the title objects
var subs = new Array(); // An array for the submenu objects
var lastn;
var lastmove;
<!-- cursel; //-->
<!-- Original:  Fredrik Fridsten (fredrik.fridsten@home.se) -->
<!-- Web Site:  http://hem.passagen.se/dred -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

// ADDITIONAL NOTES
// The input variables to the toggle function are the number of the submenu to open/close,
// starting with 0, and the number of pixels to move the objects below.
// For example toggle(1,60) opens/closes the second submenu and moves the objects below 60 pixels.



if (document.layers) {
	visible = 'show';
	hidden = 'hide';
}
else if (document.all) {
	visible = 'visible';
	hidden = 'hidden';
}

for (var i = 1; i <= nom; i++) {
	ttls[i] = ('title' + i);
	subs[i] = ('submenu' +i);
}

lastn = (nom + 1);
lastmove = 0;
cursel = 0;

function lasttoggle(n,move) {
	if (n <= nom) {
	menu = ('submenu' + n);
	if (document.layers) {
	submenu = document.layers[menu];
	}
	else if (document.all) {
	submenu = document.all(menu).style;
	}
	if (submenu.visibility == visible) {
	submenu.visibility = hidden;
	// picclose(n); // Remove this if you don't use pictures
	for (var i = (n+1); i <= nom; i++) {
	if (document.layers) {
	document.layers[ttls[i]].top -= move;
	document.layers[subs[i]].top -= move;
	}
	else if (document.all) {
	document.all(ttls[i]).style.pixelTop -= move;
	document.all(subs[i]).style.pixelTop -= move;
            }
         }
      }
   }
}

/* function exec(first, n move) {
	if(first && firstcall)
	{
		submenu.visibility = hidden;
		firstcall = false;
	}
} */

function toggle(n, move) {
	menu = ('submenu' + n);
	if (document.layers) {
		submenu = document.layers[menu];
	}
	else if (document.all) {
		submenu = document.all(menu).style;
	}
	
	
	if (submenu.visibility == visible) {
		submenu.visibility = hidden;
		// if (usePictures) picclose(n);
		for (var i = (n+1); i <= nom; i++) {
			if (document.layers) {
			document.layers[ttls[i]].top -= move;
			document.layers[subs[i]].top -= move;
			}
			else if (document.all) {
			document.all(ttls[i]).style.pixelTop -= move;
			document.all(subs[i]).style.pixelTop -= move;
		  }
		   }
		}
		else {
		submenu.visibility = visible;
		/// if (usePictures) picopen(n);
		if (lastn != n) {
		lasttoggle(lastn,lastmove);
		}
		for (var i = (n+1); i <= nom; i++) {
		if (document.layers) {
		document.layers[ttls[i]].top += move;
		document.layers[subs[i]].top += move;
		}
		if (document.all) {
		document.all(ttls[i]).style.pixelTop += move;
		document.all(subs[i]).style.pixelTop += move;
      }
   }
 }
 lastn = n;
 lastmove = move;
 cursel = n;
 // document.writeln("cursel = " + cursel);
}

function ow(wname)
{
	if ( wname == window.name)
	{
		return true ;
	}

	width  = 600;
	height = 400;
	x = (screen.availWidth - width) /2 ;
	y = (screen.availHeight - height) /2 ;

	var win = window.open("", wname,
		"toolbar=no, status=no, menubar=no"
		+ ",width=" + width
		+ ",height=" + height
		+ ",scrollbars=yes,resizable=no");

	win.moveTo(x,y) ;
	win.focus();
	win.document.open();
	win.document.write("<title>Loading ...</title><p>Loading ...");
	win.document.close() ;
	return true ;
}

//  End -->
