var cindex=-1;
var ac;
var unsel="unsel.gif";  // when entry is unselected
var sel="sel.gif";      // when entry is selected
var oversel="oversel.gif"; // when mouse is over a selection

function unload(){
  window.status="Oo-roo mate ...";
  if (cindex != -1)
    eval("document.imgform.sel"+cindex+".src=\""+sel+"\"");
  return true;
}

function load()
{
  // set cindex to the default entry here ..
  cindex=-1;
  if (cindex != -1)
    eval("document.imgform.sel"+cindex+".src=\""+sel+"\"");        
    
}

// a new entry is selected
function selectChange(index)
{
  if (cindex != -1)        
    eval("document.imgform.sel"+cindex+".src=\""+unsel+"\"");     
  eval("document.imgform.sel"+index+".src=\""+sel+"\"");        
  cindex=index;   
  // do other things here ...
}

// mouse just moved away from this selection
function selectOut(index)
{
  if (index == cindex) // change to current selection
    eval("document.imgform.sel"+index+".src=\""+sel+"\"");
  else // unselect
    eval("document.imgform.sel"+index+".src=\""+unsel+"\"");
  window.status="";
  return true;
}

// mouse is over this selection
function selectOver(index) { 
  eval("document.imgform.sel"+index+".src=\""+oversel+"\""); 
  window.status="Select Entry "+index;  return true;
}

function beginEntry()
{
  document.writeln("<FORM name=\"imgform\">\n<table border=3>");
  ac=1;
}

function anEntry(cc,flags, selection)
{
  document.writeln("<TR><TD><IMG NAME=sel"+cc+" WIDTH=14 HEIGHT=14 SRC="+unsel+"></TD>");
  document.writeln("<TD><a "+flags+" onMouseOut=\"return selectOut("+cc+");\" onMouseOver=\"return selectOver("+cc+");\" href=\"javascript:selectChange("+cc+")\">"+selection+"</A></TD></TR>");
}

function newEntry(selection)
{
  anEntry(ac,"",selection);
  ac++;
}

function newEntryFlag(flags,selection)
{
  anEntry(ac,flags,selection);
  ac++;
}

function endEntry()
{
  document.writeln("</TABLE></FORM>");
}


// end of the method
/////////////////////////////////
// start of the right mouse click method

if (window.Event) // Only Netscape will have the CAPITAL E.
  document.captureEvents(Event.MOUSEUP); // catch the mouse up event
 
function nocontextmenu()  // this function only applies to IE4, ignored otherwise.
{
 event.cancelBubble = true
 event.returnValue = false;
 
 return false;
}
 
function norightclick(e) // This function is used by all others
{
 if (window.Event) // again, IE or NAV?
 {
  if (e.which == 2 || e.which == 3)
   return false;
 }
 else
  if (event.button == 2 || event.button == 3)
  {
   event.cancelBubble = true
   event.returnValue = false;
   return false;
  }
 
}
 
document.oncontextmenu = nocontextmenu;  // for IE5+
document.onmousedown = norightclick;  // for all others



// end of the method
/////////////////////////////////
// start of the new window click method

function popup(imgname, w, h){
  	var href=imgname;
  	if(imgname == '') return false;
    	var href = imgname;	
    	window.open(href,'legend','scrollbars=no,status=no,toolbar=no,menubar=no, height= ' + h + ',width=' + w);
  	return true;
}
