// JavaScript Document
function EFindObj(n, d)
{
 var p,i,x;
 if(!d) d=document;
 if((p=n.indexOf("?"))>0&&parent.frames.length)
  {
   d=parent.frames[n.substring(p+1)].document;
   n=n.substring(0,p);
  }
 if(!(x=d[n])&&d.all) x=d.all[n];
 for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=EFindObj(n,d.layers[i].document);
 if(!x && document.getElementById) x=document.getElementById(n);
 return x;
}

function Visio(element,vis)
{
 var v, obj;
 if ((obj=EFindObj(element))!=null)
  {
   v=vis;
   if (obj.style)
    {
     obj=obj.style;
     v=(v=='show')?'visible':(v='hide')?'hidden':v;
    }
   obj.visibility=v;
  }
}

function CloseAllMenu()
{
 for (var i=0;i<Menu.MenuBoxArray.length;i++)
  {
   if (Menu.MenuBoxArray[i].Vis=='hide')
    {
     Visio(Menu.MenuBoxArray[i].Name,'hide');
    }
  }
}

function CloseChildBox(box)
{
 var TempBox=null;
 var ChildBox=null;
 eval('TempBox='+box);
 for (var i=0;i<TempBox.MenuArray.length;i++)
  {
   if (EFindObj(TempBox.MenuArray[i].Mbox)!=null) 
    {
     eval('ChildBox='+TempBox.MenuArray[i].Mbox);
     if (EFindObj(ChildBox.Name)!=null && ChildBox.Vis=='hide')
      {
       Visio(TempBox.MenuArray[i].Mbox,'hide'); 
      }
     CloseChildBox(TempBox.MenuArray[i].Mbox);
    }
  }
}

function OnActivate(element,box)
{
 Visio('Menu','show');
 CloseChildBox(box);
 Visio(element,'show');
}

function PrintMenuItem(orientation)
{
 var acn='';
 var bc='';
 var oc='';
 var ac='';
 var bi='';
 var tat='';
 var tit='';
 var w='';
 var h='';
 var ali='';
 var l='';
 var setimg='';
 if (this.Target==''||this.Target=='_self')
  {
   l=' onclick="top.location.href =\''+this.Url+'\' ;"';
  }
 else
  {
   l=' onclick=\' window.open(\"'+this.Url+'\",\"'+this.Target+'\",\"\");\'';
  }
 if (this.AClassName!='')
  {
   acn=' class='+this.AClassName+'';
  }
 if (this.BackImage!='') 
  {
   bi=' background="'+this.BackImage+'"';
  }
 if (this.BackColor!='') 
  {
   bc=' bgcolor="'+this.BackColor+'"';
   oc='this.style.backgroundColor="'+this.BackColor+'";'
  }
 if (this.ActiveColor!='')
  {
   ac=' this.style.backgroundColor="'+this.ActiveColor+'";'
  }
 if (this.Target!='')
  {
   tat=' target="'+this.Target+'"';
  }
 if (this.Title!='')
  {
   tit=' title="'+this.Title+'"';
  }
 if (this.Width!='')
  {
   w=' width="'+this.Width+'"';
  }
 if (this.Height!='')
  {
   h=' height="'+this.Height+'"';
  }
 if (this.Align!='')
  {
   ali=' align="'+this.Align+'"';
  }
 if (this.SetImageOnOff=='1')
  {
   setimg = '<img src="menuscripts/000000_arrowright.gif">';
  }
 else if (this.SetImageOnOff=='2')
  {
   setimg = '<img src="menuscripts/000000_arrowleft.gif">';
  } 
 else
  {
   setimg='<img src="menuscripts/clear.gif">';
  }
 if (orientation=="H")
  {
   document.write('<td  '+ali+bc+bi+w+h+' nowrap onmouseover=\''+ac+ ' OnActivate("'+this.Mbox+'","'+this.OrderMbox+'");\' onmouseout=\''+oc+'\' > <a href="'+this.Url+'" '+acn+tit+tat+'>'+this.Name+'</a></td>'); 
  }
 if (orientation=="V")
  {
   document.write('<tr><td style=\"border-bottom: 1px solid #187118;\" '+ali+bc+bi+w+h+' nowrap onmouseover=\''+ac+ ' OnActivate("'+this.Mbox+'","'+this.OrderMbox+'");\' onmouseout=\''+oc+'\' ><a href="'+this.Url+'" '+acn+tit+tat+'"><span style="font-family: tahoma; font-size: 11px; font-weight: bold; text-decoration: none; color: #000000">'+this.Name+'</span></a></td><td '+bc+'>'+setimg+'</td></tr>');
  }
}

function AddMenuItem(name,url,target,title,mbox,width,height,align,activecolor,backcolor,backimage,aclassname,SetImage)
{
 this.MenuArray[this.MenuArray.length]=new MenuItem(name,url,target,title,mbox,width,height,align,activecolor,backcolor,backimage,aclassname,SetImage);
 this.MenuArray[this.MenuArray.length-1].OrderMbox=this.Name;
}

function MenuItem(name,url,target,title,mbox,width,height,align,activecolor,backcolor,backimage,aclassname,SetImage)
{
 this.Name=name;
 this.Url=url;
 this.Target=target;
 this.Title=title;
 this.Mbox=mbox;

 this.Width=width;
 this.Height=height;
 this.Align=align;
 this.ActiveColor=activecolor;
 this.BackColor=backcolor;
 this.BackImage=backimage;
 this.AClassName=aclassname;
 this.OrderMbox='';
 this.Print=PrintMenuItem;
 this.OnActivate=OnActivate;
 this.CloseChildBoxox=CloseChildBox;
 this.SetImageOnOff=SetImage;
}

function PrintMenuBox()
{
 var cp='';
 var cs='';
 var b='';
 var bgc='';
 var bc='';
 var cn='';
 var bi='';
 document.write('<DIV id='+this.Name+' style="Z-INDEX:1;LEFT:'+this.Left+';TOP:'+this.Top+';WIDTH:'+this.Width+';HEIGHT:'+this.Height+';POSITION:absolute; VISIBILITY:hidden;filter:shadow(color=\''+this.ShadowColor+'\',direction=135 ,enabled='+this.Shadow+');">');
 if (this.CellPadding!='')
  {
   cp='cellpadding="'+this.CellPadding+'"';
  }
 if (this.CellSpacing!='')
  {
   cs='cellspacing="'+this.CellSpacing+'"';
  }
 if (this.Border!='')
  {
   b='border="0"'; //"'+this.Border+'"
  }
 if (this.MainColor!='')
  {
   bgc='bgcolor="'+this.MainColor+'"';
  }
 if (this.BorderColor!='')
  {
   bc='bordercolor="'+this.BorderColor+'"';
  }
 if (this.ClassName!='')
  {
   cn=' class='+this.ClassName+'';
  }
 if (this.BackImage!='')
  {
   bi=' background="'+this.BackImage+'"';
  }
 document.write('<table cellpadding="0" cellspacing="0"><tr><td style="border: 1px solid #187118;"><table '+cp+cs+b+bi+bgc+bc+cn+' bordercolor="#FFFFFF" backcolor="#FFFFFF">');
 if (this.Orientation=="H")
  {
   document.write('<tr>');
  }
 for (var i=0;i<this.MenuArray.length;i++)
  {
   this.MenuArray[i].Print(this.Orientation,this.BackColor,this.ActiveColor);
  }
 if (this.Orientation=="H")
  {
   document.write('</tr>');
  }
 document.write('</table></td></tr></table>');
 document.write('</DIV>');
 Visio(this.Name,this.Vis);
}

function MenuBox(vis,orientation,name,left,top,width,height,maincolor,bordercolor,backimage,cellspacing,cellpadding,border,shadow,shadowcolor,classname)
{
 this.MenuArray = new Array();
 this.Zindex=null;
 this.Orientation=orientation;
 this.Name=name;
 this.Top=top;
 this.Left=left;
 this.Height=height;
 this.Width=width;
 this.MainColor=maincolor;
 this.BorderColor=bordercolor;
 this.BackImage=backimage;
 this.CellSpacing=cellspacing;
 this.CellPadding=cellpadding;
 this.Border=border;
 this.Shadow=shadow;
 this.ShadowColor=shadowcolor;
 this.ClassName=classname;
 this.Vis=vis;
 this.Print=PrintMenuBox;
 this.Add=AddMenuItem;
}

function CreateMenuBox(vis,orientation,name,left,top,width,height,maincolor,bordercolor,backimage,cellspacing,cellpadding,border,shadow,shadowcolor,classname)
{
 eval( name + '= new MenuBox(vis,orientation,name,left,top,width,height,maincolor,bordercolor,backimage,cellspacing,cellpadding,border,shadow,shadowcolor,classname)');
 eval(name + '.Zindex=this.MenuBoxArray.length+1');
 this.MenuBoxArray[this.MenuBoxArray.length]=eval(name);
}

function RunMenu()
{
 document.write ("<DIV id=Menu style=\"Z-INDEX:0; TOP:"+this.Top+"; LEFT:"+this.Left+"; HEIGHT:"+this.Height+"; WIDTH:"+this.Width+"; POSITION: absolute; VISIBILITY: hidden;\">");
 document.write("<A onMouseover='CloseAllMenu(); Visio(\"Menu\",\"hide\");'  href=\"javascript:;\">");
 document.write("<IMG height=\"100%\" src=\"menuscripts/transparent.gif\" width=\"100%\" border=0></A>");
 document.write ("</DIV>");

 for (var i=0;i<this.MenuBoxArray.length;i++)
 {
  this.MenuBoxArray[i].Print();
 }
}

function Menu(left,top,width,height)
{
 this.MenuBoxArray = new Array();
 this.Left=left;
 this.Top=top;
 this.Width=width;
 this.Height=height;
 this.Run=RunMenu;
 this.CreateMenuBox=CreateMenuBox;
}

var Menu = new Menu('0','0','100%','100%');
