var firstoption,secondoption,thirdoption,fourthoption=document;
var fifthoption=document;
var sixthoption=window;


function drop(active_menu_code)
	/* this first part of the function says 'if firstoption has a value, then document.all.document.style.visibility="hidden". - this means the menu will be hidden. This should be the standard case cos 'first option' is given a value at the beginning of this code, the value of 'document' so something later on in the function would have to occur to change this. The next line checks to see whether an argument has been passed to the function 'drop', that is, whether there is anything in the brackets in the code on the actual page where the function is being called. If there is nothing there, then the function just stops at that point. */	
		{
		
		if(firstoption!=null)fifthoption.all[firstoption].style.visibility="hidden";
		if(active_menu_code==null)return;

/* this second part of the function changes the first variable, 'firstoption' to whatever was inside the brackets, which should be a reference to a page by name e.g. rtdrop_menu - this is then substituted for the placeholder 'firstoption' later in the code, effectively creating addresses for the browser to look at */

		firstoption=active_menu_code;
		fifthoption.all[active_menu_code].style.visibility="visible";
		
		}
		
/* this function is summoned at the end of this javascript */
		
function dontdrop()		
		
/* the first part looks to see if there is no value in the first variable 'firstoption' or a value in the second variable 'secondoption' This second option can change, according to the later part of this function which is monitoring mouse movement i think. If there is no value then nothing happens.*/
		{
		if(firstoption==null||secondoption)return;
		
/* what does this part do ...This actually says compare both sides of the logical or '||' If either side is true then return, i.e. do nothing. Note that the secondoption variable is passed the value of 'true' later on in the script...

So what happens next? The value of the variable active_menu_code is changed from whatever was passed to it by the web page, to be a short piece of text indicating how the browser should display things...featuring the value of fifthoption, which is originally set at 'document'. Why is another variable used here ? */

		var active_menu_code=fifthoption.all[firstoption].style;
		
/* here some sort of calculation is performed - the first part reads:

if the thirdoption (which was originally set as 'document' is smaller than the result of the two compared sides of the logical OR '||', then go on to do the calculation that follows - what does this mean ? Perhaps it works like this - if thirdoption has a value it will be regarded as '1' whereas if it doesn't it will be null or '0'. 

Later it picks up values from the iframe with the id that corresponds with active_menu_code, providing numbers for active_menu_code.left and active_menu_code.top etc. These values determine whether the drop down menu will stay in view as it recalculates the mouse position - if its still over the expected spot based on these values then it stays visible.
*/
	 if(thirdoption<parseInt(active_menu_code.left)||thirdoption>parseInt(active_menu_code.left)+parseInt(active_menu_code.width)||fourthoption<parseInt(active_menu_code.top)-15||fourthoption>parseInt(active_menu_code.top)+parseInt(active_menu_code.height))

/* if the calculation above fulfills the requirements then the following code is run, meaning that the table becomes hidden again. 'secondoption' is given the value of 'true' which is picked up by the code at the top of the function? Or is it ? In the next line 'secondoption' is given the value of 'false' */

		{
		
		secondoption=true;
		sixthoption.setTimeout("eval('fifthoption.all[firstoption].style.visibility=\"hidden\"; firstoption=null; secondoption=false;')",2500);
		
		}
		
		}
		
function hidemenu()

/* this function is set off from the beginning by the code below it. The values for thirdoption and fourthoption and sixthoption are established elsewhere. Remember that 'sixthoption' has been given the value 'window' at the beginning of the page, so third option which was 'document' becomes 'window.event.clientX. This is the way to pick up the X and Y co-ordinate, relative to the web browser page, at which the event occurred  - i.e. a number, which is then added to document.body.scrollLeft - we don't know what that means */ 

		{
		
		thirdoption=sixthoption.event.clientX+fifthoption.body.scrollLeft;
		fourthoption=sixthoption.event.clientY+fifthoption.body.scrollTop;
		
		}
		
/* this is quite important I think as the functions above don't do anything until they're called so this javascript is in place and nothing happens except that the global variables are declared and these two lines are read. The first one says that 'document.onmousemove' is renamed as the function 'hidemenu' - it doesn't allow for parameters in parentheses for some reason, so on mousemove automatically brings hidemenu into play 
then it goes on to to tell the browser to pause 2.5 seconds then run dontdrop, then wait 2.5 seconds then run dontdrop and so on. This will run the checking function to establish if anything has changed.
*/
		
document.onmousemove=hidemenu;
sixthoption.setInterval("dontdrop()",2500);

		
