function init ()
{
 if(iNetMenu.isSupported())
 {
  iNetMenu.initialize();
 }
}

function do_onMouseOver(el)
{
 el.originalClass = el.className;
 el.className += "Hover";
}

function do_onMouseOut(el)
{
 el.className = el.originalClass;
}

function iNetMenuPageReload(init)
{
  if (init==true) with (navigator)
  {
   if ((appName=="Netscape")&&(parseInt(appVersion)==4))
   {
    document.MM_pgW=innerWidth;
    document.MM_pgH=innerHeight;
    onresize=iNetMenuPageReload;
   }
 }
 else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
  location.reload();
 }

iNetMenuPageReload(true);

function iNetMenuLoadImages()
{
  var d=document;
  var i,j=d.MM_p.length,a=iNetMenuLoadImages.arguments;
  if(d.images)
  {
    if(!d.MM_p)
      d.MM_p=new Array();
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0)
      {
       d.MM_p[j]=new Image;
       d.MM_p[j++].src=a[i];
      }
    }
  }

iNetMenu.isSupported = function()
{
 if (typeof iNetMenu.isSupported.r == "boolean")
 return iNetMenu.isSupported.r;
 var ua = navigator.userAgent.toLowerCase();
 var an = navigator.appName;
 var r = false;
 if (ua.indexOf("gecko") > -1)
  r = true;
 else if (an == "Microsoft Internet Explorer")
 {
  if (document.getElementById)
   r = true;
 }
 iNetMenu.isSupported.r = r;
 return r;
}

iNetMenu.initialize = function()
{
 for (var i = 0, menu = null; menu = this.registry[i]; i++)
  menu.initialize();
}

iNetMenu.renderAll = function()
{
 var aMenuHtml = [];
 for (var i = 0, menu = null; menu = this.registry[i]; i++)
  aMenuHtml[i] = menu.toString();
 document.write(aMenuHtml.join(""));
}

function iNetMenu(oActuator, iDirection, iLeft, iTop, iReferencePoint, parentMenuSet)
{
 this.addItem = addItem;
 this.addMenu = addMenu;
 this.toString = toString;
 this.initialize = initialize;
 this.isOpen = false;
 this.show = show;
 this.hide = hide;
 this.items = [];
 this.onactivate = new Function();
 this.ondeactivate = new Function();
 this.onmouseover = new Function();
 this.onqueue = new Function();
 this.index = iNetMenu.registry.length;
 iNetMenu.registry[this.index] = this;
 var id = "mtDropDown" + this.index;
 var contentHeight = null;
 var contentWidth = null;
 var childMenuSet = null;
 var animating = false;
 var childMenus = [];
 var slideAccel = -1;
 var iNetMenus = null;
 var ready = false;
 var _this = this;
 var a = null;
 var pos = iDirection == iNetMenu.direction.down ? "top" : "left";
 var dim = null;

 function addItem(sText, sUrl)
 {
  var item = new mtDropDownItem(sText, sUrl, this);
  item._index = this.items.length;
  this.items[item._index] = item;
 }

 function addMenu(oMenuItem)
 {
  if (!oMenuItem.parentMenu == this)
   throw new Error("Cannot add a menu here");
  if (childMenuSet == null)
  {

  if(typeof oMenuItem.iReferencePoint!="undefined")
   referencePoint=oMenuItem.iReferencePoint;
  else
   referencePoint=iReferencePoint;
  if(referencePoint==iNetMenu.reference.bottomRight)  //top arabic
   childMenuSet = new mtDropDownSet(iNetMenu.direction.left, 10, 2, iNetMenu.reference.topLeft);
  else if(referencePoint==iNetMenu.reference.bottomLeft) // top english
   childMenuSet = new mtDropDownSet(iNetMenu.direction.right, -5, 2, iNetMenu.reference.topRight);
  else if(referencePoint==iNetMenu.reference.topRight)
   childMenuSet = new mtDropDownSet(iNetMenu.direction.right, -5, 2, iNetMenu.reference.topRight);
  else if(referencePoint==iNetMenu.reference.topLeft)
   childMenuSet = new mtDropDownSet(iNetMenu.direction.right, 10, 2, iNetMenu.reference.topLeft);
  }
  var m = childMenuSet.addMenu(oMenuItem);
  childMenus[oMenuItem._index] = m;
  m.onmouseover = child_mouseover;
  m.ondeactivate = child_deactivate;
  m.onqueue = child_queue;
  return m;
 }

 function initialize()
 {
  initCache();
  initEvents();
  initSize();
  ready = true;
 }
//------------------------

 function show()
 {
  if (ready)
  {
   _this.isOpen = true;
   animating = true;
   setContainerPos();
   iNetMenus["clip"].style.visibility = "visible";
   iNetMenus["clip"].style.zIndex = iNetMenu._maxZ++;
   slideStart();
   _this.onactivate();
   }
 }

 function hide()
 {
  if (ready)
  {
   _this.isOpen = false;
   animating = true;
   for (var i = 0, item = null; item = iNetMenus.item[i]; i++)
           dehighlight(item);
   if (childMenuSet)
           childMenuSet.hide();
   slideStart();
   _this.ondeactivate();
  }
 }

 function setContainerPos()
 {
  var sub = oActuator.constructor == mtDropDownItem;
  var act = sub ? oActuator.parentMenu.iNetMenus["item"][oActuator._index] : oActuator;
  var el = act;
  var x = 0;
  var y = 0;
  var minX = 0;
  var maxX = (window.innerWidth ? window.innerWidth : document.body.clientWidth) - parseInt(iNetMenus["clip"].style.width);
  var minY = 0;
  var maxY = (window.innerHeight ? window.innerHeight : document.body.clientHeight) - parseInt(iNetMenus["clip"].style.height);


  while (sub ? el.parentNode.className.indexOf("mtDropDownMenu") == -1 : el.offsetParent)
  {
   y += el.offsetTop;
   x += el.offsetLeft;
   if (el.scrollLeft)
    x -= el.scrollLeft;
   if (el.scrollTop)
    y += el.scrollTop;
   el = el.offsetParent;
  }
  if (oActuator.constructor == mtDropDownItem)
  {
    x += parseInt(el.parentNode.style.left);
    y += parseInt(el.parentNode.style.top);
    if (el.parentNode.scrollTop)
     y += el.parentNode.scrollTop;
  }
  switch (iReferencePoint)
  {
   case iNetMenu.reference.topLeft:
     break;
   case iNetMenu.reference.topRight:
     x += act.offsetWidth;
     break;
   case iNetMenu.reference.bottomLeft:
//     x += act.offsetWidth;
     y += act.offsetHeight;
     break;
   case iNetMenu.reference.bottomRight:
     x += act.offsetWidth;
     y += act.offsetHeight;
     break;
  }
  x += iLeft;
  y += iTop;
//  x = Math.max(Math.min(x, maxX), minX);
//  y = Math.max(Math.min(y, maxY), minY);
  if(iReferencePoint==iNetMenu.reference.bottomRight)
     x-=parseInt(iNetMenus["clip"].style.width);
  if(iReferencePoint==iNetMenu.reference.topLeft)
     x-=parseInt(iNetMenus["clip"].style.width);
  iNetMenus["clip"].style.left = x + "px";
  iNetMenus["clip"].style.top = y + "px";
  
 }

 function slideStart()
 {
  if(iReferencePoint==iNetMenu.reference.topLeft)  // arabic
  {
   var x0 = parseInt(iNetMenus["clip"].style.width);
   var x1 = _this.isOpen ? 0 : dim;
  }
  else
  {
   var x0 = parseInt(iNetMenus["content"].style[pos]);
   var x1 = _this.isOpen ? 0 : -dim;
  }
  if (a != null)
   a.stop();
//  window.alert("dim="+dim+",x0="+x0+",x1="+x1);
  a = new iNetSubMenu(x0, x1, iNetMenu.slideTime, slideAccel,iReferencePoint);
  a.onframe = slideFrame;
  a.onend = slideEnd;
  a.start();
 }

 function slideFrame(x)
 {
  iNetMenus["content"].style[pos] = x + "px";
//  window.alert('x='+x);
 }

 function slideEnd()
 {
  if (!_this.isOpen)
   iNetMenus["clip"].style.visibility = "hidden";
  animating = false;
 }

 function initSize()
 {
   var ow = iNetMenus["items"].offsetWidth;
   var oh = iNetMenus["items"].offsetHeight;
   var ua = navigator.userAgent.toLowerCase();
   iNetMenus["clip"].style.width = ow + iNetMenu.shadowSize + 2 + "px";
   iNetMenus["clip"].style.height = oh + iNetMenu.shadowSize + 2 + "px";
   iNetMenus["content"].style.width = ow + iNetMenu.shadowSize + "px";
   iNetMenus["content"].style.height = oh + iNetMenu.shadowSize + "px";
   contentHeight = oh + iNetMenu.shadowSize;
   contentWidth = ow + iNetMenu.shadowSize;
   dim = iDirection == iNetMenu.direction.down ? contentHeight : contentWidth;
   iNetMenus["content"].style[pos] = -dim - iNetMenu.shadowSize + "px";
   iNetMenus["clip"].style.visibility = "hidden";
   if (ua.indexOf("mac") == -1 || ua.indexOf("gecko") > -1)
   {
    iNetMenus["background"].style.width = ow + "px";
    iNetMenus["background"].style.height = oh + "px";
    iNetMenus["background"].style.backgroundColor = iNetMenu.backgroundColor;
    iNetMenus["shadowRight"].style.left = ow + "px";
    iNetMenus["shadowRight"].style.height = oh - (iNetMenu.shadowOffset - iNetMenu.shadowSize) + "px";
    iNetMenus["shadowRight"].style.backgroundColor = iNetMenu.shadowColor;
    iNetMenus["shadowBottom"].style.top = oh + "px";
    if(ow>=iNetMenu.shadowOffset)
     iNetMenus["shadowBottom"].style.width = (ow - iNetMenu.shadowOffset) + "px";
    iNetMenus["shadowBottom"].style.width = ow + "px";
    iNetMenus["shadowBottom"].style.backgroundColor = iNetMenu.shadowColor;
   }
   else
   {
    iNetMenus["background"].firstChild.src = iNetMenu.backgroundPng;
    iNetMenus["background"].firstChild.width = ow;
    iNetMenus["background"].firstChild.height = oh;
    iNetMenus["shadowRight"].firstChild.src = iNetMenu.shadowPng;
    iNetMenus["shadowRight"].style.left = ow + "px";
    iNetMenus["shadowRight"].firstChild.width = iNetMenu.shadowSize;
    iNetMenus["shadowRight"].firstChild.height = oh - (iNetMenu.shadowOffset - iNetMenu.shadowSize);
    iNetMenus["shadowBottom"].firstChild.src = iNetMenu.shadowPng;
    iNetMenus["shadowBottom"].style.top = oh + "px";
    iNetMenus["shadowBottom"].firstChild.height = iNetMenu.shadowSize;
    iNetMenus["shadowBottom"].firstChild.width = ow - iNetMenu.shadowOffset;
   }
  }


//------------------------
 function initCache()
 {
  var menu = document.getElementById(id);
  var all = menu.all ? menu.all : menu.getElementsByTagName("*");
  iNetMenus = {};
  iNetMenus["clip"] = menu;
  iNetMenus["item"] = [];
  for (var i = 0, elm = null; elm = all[i]; i++)
  {
   switch (elm.className)
   {
    case "items":
    case "content":
    case "background":
    case "shadowRight":
    case "shadowBottom":
     iNetMenus[elm.className] = elm;
     break;
    case "item":
     elm._index = iNetMenus["item"].length;
     iNetMenus["item"][elm._index] = elm;
     break;
   }
  }
  _this.iNetMenus = iNetMenus;
 }

 function initEvents()
 {
  for (var i = 0, item = null; item = iNetMenus.item[i]; i++)
  {
   item.onmouseover = item_mouseover;
   item.onmouseout = item_mouseout;
   item.onclick = item_click;
  }
  if (typeof oActuator.tagName != "undefined")
  {
   oActuator.onmouseover = actuator_mouseover;
   oActuator.onmouseout = actuator_mouseout;
  }
  iNetMenus["content"].onmouseover = content_mouseover;
  iNetMenus["content"].onmouseout = content_mouseout;
 }

 function highlight(oRow)
 {
  oRow.className = "itemHover";
  if (childMenus[oRow._index])
   oRow.lastChild.firstChild.src = iNetMenu.iNetSubMenuSignOn;
 }

 function dehighlight(oRow)
 {
  oRow.className = "item";
  if (childMenus[oRow._index])
   oRow.lastChild.firstChild.src = iNetMenu.iNetSubMenuSignOff;
 }

 function item_mouseover()
 {
  if (!animating)
  {
   highlight(this);
   if (childMenus[this._index])
    childMenuSet.showMenu(childMenus[this._index]);
   else if (childMenuSet)
    childMenuSet.hide();
  }
 }

 function item_mouseout()
 {
  if (!animating)
  {
   if (childMenus[this._index])
    childMenuSet.hideMenu(childMenus[this._index]);
   else
    dehighlight(this);
   }
  }

 function item_click()
 {
  if (!animating)
   if((_this.items[this._index]) && (_this.items[this._index].url!=null))
   {
     if(_this.items[this._index].url.toLowerCase().indexOf('javascript')>-1)
      eval(_this.items[this._index].url);
     else
      location.href = _this.items[this._index].url;
   }
  }

 function actuator_mouseover()
 {
  parentMenuSet.showMenu(_this);
 }

 function actuator_mouseout()
 {
  parentMenuSet.hideMenu(_this);
 }

 function content_mouseover()
 {
  if (!animating)
  {
   parentMenuSet.showMenu(_this);
   _this.onmouseover();
  }
 }

 function content_mouseout()
 {
  if (!animating)
   parentMenuSet.hideMenu(_this);
  }

 function child_mouseover()
 {
  if (!animating)
  {
   parentMenuSet.showMenu(_this);
   _this.onmouseover();
   }
  }

 function child_deactivate()
 {
  for (var i = 0; i < childMenus.length; i++)
  {
   if (childMenus[i] == this)
   {
     dehighlight(iNetMenus["item"][i]);
     break;
    }
   }
  }

 function child_queue()
 {
  parentMenuSet.hideMenu(_this);
 }

 function toString()
 {
  var aHtml = [];
  var sClassName = "mtDropDownMenu" + (oActuator.constructor != mtDropDownItem ? " top" : "");
  for (var i = 0, item = null; item = this.items[i]; i++)
   aHtml[i] = item.toString(childMenus[i]);
  return  '<div id="' + id + '" class="' + sClassName + '">' +
          '<div class="content"><table class="items" cellpadding="0" cellspacing="0" border="0">' +
          '<tr><td colspan="2"><img src="' + iNetMenu.spacerGif + '" width="1" height="' + iNetMenu.menuPadding + '"></td></tr>' +
          aHtml.join('')+
          '<tr><td colspan="2"><img src="' + iNetMenu.spacerGif + '" width="1" height="' + iNetMenu.menuPadding + '"></td></tr></table>' +
          '<div class="shadowBottom"><img src="' + iNetMenu.spacerGif + '" width="1" height="1"></div>' +
          '<div class="shadowRight"><img src="' + iNetMenu.spacerGif + '" width="1" height="1"></div>' +
          '<div class="background"><img src="' + iNetMenu.spacerGif + '" width="1" height="1"></div>' +
          '</div></div>';
  }
 }

mtDropDownSet.registry = [];

function mtDropDownSet(iDirection, iLeft, iTop, iReferencePoint)
{
 this.addMenu = addMenu;
 this.showMenu = showMenu;
 this.hideMenu = hideMenu;
 this.hide = hide;
 var menus = [];
 var _this = this;
 var current = null;
 this.index = mtDropDownSet.registry.length;
 mtDropDownSet.registry[this.index] = this;

 function addMenu(oActuator)
 {
  var m = new iNetMenu(oActuator, iDirection, iLeft, iTop, iReferencePoint, this);
  menus[menus.length] = m;
  return m;
 }

 function showMenu(oMenu)
 {
  if (oMenu != current)
  {
   if (current != null)
           hide(current);
   current = oMenu;
   oMenu.show();
  }
  else
   cancelHide(oMenu);
  }

 function hideMenu(oMenu)
 {
  if (current == oMenu && oMenu.isOpen)
   if (!oMenu.hideTimer)
    scheduleHide(oMenu);
 }

 function scheduleHide(oMenu)
 {
  oMenu.onqueue();
  oMenu.hideTimer = window.setTimeout("mtDropDownSet.registry[" + _this.index + "].hide(iNetMenu.registry[" + oMenu.index + "])", iNetMenu.hideDelay);
 }

 function cancelHide(oMenu)
 {
  if (oMenu.hideTimer)
  {
   window.clearTimeout(oMenu.hideTimer);
   oMenu.hideTimer = null;
  }
 }

 function hide(oMenu)
 {
  if (!oMenu && current)
    oMenu = current;
  if (oMenu && current == oMenu && oMenu.isOpen)
  {
   cancelHide(oMenu);
   current = null;
   oMenu.hideTimer = null;
   oMenu.hide();
  }
 }
}

function mtDropDownItem(sText, sUrl, oParent)
{
 this.toString = toString;
 this.text = sText;
 this.url = sUrl;
 this.parentMenu = oParent;

 function toString(bDingbat)
 {
  var sDingbat = bDingbat ? iNetMenu.iNetSubMenuSignOff : iNetMenu.spacerGif;
  var iEdgePadding = iNetMenu.itemPadding + iNetMenu.menuPadding;
  var sPaddingLeft = "padding:" + iNetMenu.itemPadding + "px; padding-left:" + iEdgePadding + "px;"
  var sPaddingRight = "padding:" + iNetMenu.itemPadding + "px; padding-right:" + iEdgePadding + "px;"
  if(sText=='Separator')
   return  '<tr class="item"><td  nowrap style="background:'+iNetMenu.backgroundColor+';'+ sPaddingLeft + '" colspan=2><HR></td></td></tr>';
  else if(sUrl==null)
   return  '<tr class="item"><td class="itemDissabled" colspan=2 nowrap style="background:'+iNetMenu.backgroundColor+';'+ sPaddingLeft + '">'+sText + '</td></tr>';
  return  '<tr class="item"><td  nowrap style="'+ sPaddingLeft + '">' +
            sText+
            '</td><td  width="15" style="'+ sPaddingRight + '">' +
            '<img src="' + sDingbat + '" width="15" height="15"></td></tr>';

 }
}

function iNetSubMenu(from, to, time, zip,pReferencePoint)
{
 if (typeof zip == "undefined")
  zip = 0;
 if (typeof unit == "undefined")
  unit = "px";
 this.x0 = from;
 this.x1 = to;
 this.dt = time;
 this.zip = -zip;
 this.unit = unit;
 this.timer = null;
 this.referencePoint=pReferencePoint;
 this.onend = new Function();
 this.onframe = new Function();
}

iNetSubMenu.prototype.start = function()
{
 this.t0 = new Date().getTime();
 this.t1 = this.t0 + this.dt;
 var dx = Math.abs(this.x1 - this.x0);
 if(this.x0<=this.x1)
 {
  this.c1 = this.x0 + ((1 + this.zip) * dx / 3);
  this.c2 = this.x0 + ((2 + this.zip) * dx / 3);
 }
 else
 {
  this.c1 = this.x1 + ((1 + this.zip) * dx / 3);
  this.c2 = this.x1 + ((2 + this.zip) * dx / 3);
 }
 iNetSubMenu._add(this);
}


iNetSubMenu.prototype.stop = function()
{
 iNetSubMenu._remove(this);
}

iNetSubMenu.prototype._paint = function(time)
{
 if (time < this.t1)
 {
  var elapsed = time - this.t0;
  this.onframe(iNetSubMenu._getBezier(elapsed/this.dt,this.x0,this.x1,this.c1,this.c2,this.referencePoint));
 }
 else
  this._end();
}

iNetSubMenu.prototype._end = function()
{
 iNetSubMenu._remove(this);
 this.onframe(this.x1);
 this.onend();
}

iNetSubMenu._add = function(o)
{
 var index = this.instances.length;
 this.instances[index] = o;
 if (this.instances.length == 1)
  this.timerID = window.setInterval("iNetSubMenu._paintAll()", this.targetRes);
}

iNetSubMenu._remove = function(o)
{
 for (var i = 0; i < this.instances.length; i++)
 {
  if (o == this.instances[i])
  {
   this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
   break;
  }
 }
 if (this.instances.length == 0)
 {
  window.clearInterval(this.timerID);
  this.timerID = null;
 }
}

iNetSubMenu._paintAll = function()
{
 var now = new Date().getTime();
 for (var i = 0; i < this.instances.length; i++)
  this.instances[i]._paint(now);
}

iNetSubMenu._B1 = function(t)
{
 return t*t*t
}

iNetSubMenu._B2 = function(t)
{
 return 3*t*t*(1-t)
}

iNetSubMenu._B3 = function(t)
{
 return 3*t*(1-t)*(1-t)
}

iNetSubMenu._B4 = function(t)
{
 return (1-t)*(1-t)*(1-t)
}


iNetSubMenu._getBezier = function(percent,startPos,endPos,control1,control2,pReferencePoint)
{
  pE=endPos * this._B1(percent) + control2 * this._B2(percent) + control1 * this._B3(percent) + startPos * this._B4(percent);
  if(pReferencePoint==iNetMenu.reference.topLeft) // arabic stuff
  {
   if(pE<0)
    pE=pE*-1;
  }
  return pE;
}

iNetSubMenu.instances = [];
iNetSubMenu.targetRes = 10;
iNetSubMenu.timerID = null;

use_tables = 1
function getMargin(axis)
{
 if (axis == 'x')
 {
  var pageMargin = 10;
  var margin = (document.body.offsetWidth - 714) / 2 - pageMargin;
  return margin > pageMargin ? margin : pageMargin;
 }
 else
  return 15;
 }

function getImageX(id)
{
 var x = 0;
 var obj = document.images[id];
 while (obj.offsetParent != null)
 {
  x += obj.offsetLeft;
  obj = obj.offsetParent;
 }
 x += obj.offsetLeft
 return x
}

function getImageY(id)
{
 var y = 0;
 var obj = document.images[id];
 while (obj.offsetParent != null)
 {
  y += obj.offsetTop;
  obj = obj.offsetParent;
 }
 y += obj.offsetTop;
 return y;
}

function setLayer(id, content)
{
 document.all[id].innerHTML = content
}

function showLayer(id, x, y)
{
 document.all[id].style.left = x
 document.all[id].style.top = y
 document.all[id].style.visibility = 'visible'
}

function hideLayer(id)
{
 document.all[id].style.visibility = 'hidden'
}

function submitOnEnter(e)
{
 if (e.keyCode == 13)
  document.loginbox.submit()
}

function searchOnEnter(e)
{
 if (e.keyCode == 13)
   choose_search();
}

function mousedownHandler()
{
 mouseX = event.clientX + document.body.scrollLeft
 mouseY = event.clientY + document.body.scrollTop
}

document.onmousedown = mousedownHandler

var appMenuItems = Array();
var delayedImgID = Array(), delayedImgSrc = Array();
var openMenu = null, timerID = null;
var mouseX = 0, mouseY = 0;

function insertHTML(text)
{
 document.open();
 document.write(text);
 document.close();
}

function popup(url,name,width,height)
{
  var features = [
                  ['toolbar',     0],
                  ['directories', 0],
                  ['menubar',     0],
                  ['status',      0],
                  ['resizable',   1],
                  ['location',    0],
                  ['scrollbars',  0],
                  ['copyhistory', 0]
                 ]
  for (var nr = 4; nr < popup.arguments.length; nr++)
  {
   var param = popup.arguments[nr].split('=')
   for (var i = 0; i < features.length; i++)
    if (features[i][0] == param[0])
    {
     features[i][1] = param[1]
     break
    }
   if (i == features.length)
    features[i] = param
   }
  var featureString = 'width=' + width + ',height=' + height
  for (var i = 0; i < features.length; i++)
   featureString += ',' + features[i][0] + '=' + features[i][1]
  window.open(url,name,featureString)
 }


function submitForm(id)
{
  for (var i=1; i<submitForm.arguments.length; i++)
  {
   var url = document.forms[id].action
   url += url.indexOf('?') == -1 ? '?' : '&'
   url += submitForm.arguments[i] + '=1'
   document.forms[id].action = url
  }
  document.forms[id].submit();
 }
window.status="Done";
