/* author: SpideR */
/* Creation date: 21/02/2003 */

function GetBrowserType()
   {
   	//if (window.navigator.userAgent.indexOf('MSIE')>0)
      if (document.all)
      	return 'IE';
      return 'NS';
   }
   version=GetBrowserType();


   function BrowserSwitchImage(item_id,on)
   {
   	var img_item=document.getElementById(item_id);
      var img_src=img_item.src;
      var new_src;
      if (on)
      	new_src=img_src.substring(0,img_src.length-4)+'2.gif';
      else
      	new_src=img_src.substring(0,img_src.length-5)+'.gif';
      img_item.src=new_src;
   }
   function ShowHelpBox(evt,itm)
	{
		var box=document.getElementById(itm);
		var go_x=((version=='IE')?evt.x+document.body.scrollLeft:evt.pageX)+13;
		var go_y=((version=='IE')?evt.y+document.body.scrollTop:evt.pageY)+13;
		box.style.left=go_x;
		box.style.top=go_y;
		box.style.display='block';
	}
	function HideHelpBox(evt,itm)
	{
		document.getElementById(itm).style.display='';
	}
   function GoTop()
   {
   	window.scrollTo(0,0);
   }
   function OpenFuncWindow(ref,name)
   {
      window.open(ref,name,'toolbar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes,menubar=yes,height=450,width=600').focus();
   }
   function OpenExampleWindow(loc,ref,shell)
   {
   	var path=loc;
      if (shell==true)
      	path+="example.php?fl=";
      path+=ref;
   	window.open(path,'example','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=yes,menubar=no,height=300,width=525').focus();
   }


   var time_out=1000;  //the amount of msec to delay the navigator
   var navi_in=false;
   var navi_last_menu_in=null;
   var navi_last_timeout=null;
   function OpenMenu(evt,item_num)
  	{
      var mnu=document.getElementById('nav_mnu'+item_num);
     	window.clearTimeout(navi_last_timeout);
      if (navi_in==false && navi_last_menu_in!=null)  //if we came from outside, while the menu is open
		{
    		var cur_menu=GetMenu(mnu.parentNode);  //gets the parent menu of the item opened
			var last_menu=navi_last_menu_in;
			while (last_menu && cur_menu!=last_menu)  //as long as the menus are different
			{
				last_menu=last_menu.parentNode;  //getting the item of the sub-menu
				CloseMenusUnderItem(last_menu,1);  //closing the item (and its menus)
				last_menu=GetMenu(last_menu);  //going to the parent menu
			}
		}
    	if (MenuChildOf(navi_last_menu_in,mnu)==false)  //when opening a new item, we check to see which menu is the child
		navi_last_menu_in=mnu;  //we set the last menu to the child
    	navi_in=true;  //indicates that we are in the navigator
		if (mnu.style.visibility=='inherit' || mnu.style.visibility=='visible')
			return;
   	mnu.style.visibility='inherit';
            if (item_num == '00010' )
			    BackColor = '#3056AB';
			if (item_num == '00020'  )
				BackColor = '#35962B';
			if (item_num == '00030'  )
				BackColor = '#7EE600';
			if (item_num == '00040'  )
		 		BackColor = '#FFF200';
			if (item_num == '00050'  )
		 		BackColor = '#BB2D3F';
			if (item_num == '00060'  )
		 		BackColor = '#FF5E00';
			if (item_num == '00070'  )
		 		BackColor = '#E41F1F';
			if (item_num == '00080'  )
		 		BackColor = '#FFAB00';	
			if (item_num == '00110'  )
		 		BackColor = '#3056AB';
			if (item_num == '00090'  )
		 		BackColor = '#C40DC6';
			if (item_num == '00099'  )
		 		BackColor = '#3056AB';
			//document.getElementById('nav_tbl'+item_num).bgColor=BackColor; // Hoover color
			document.getElementById('nav_tbl'+item_num).background="images/but-down.gif"
			document.getElementById('DarkColor').bgColor=BackColor; // Hoover color
	  	evt.cancelBubble=true;
  	}
   function CloseMenu(evt)
  	{
   	if (GetMainMenu(evt.toElement)==GetMainMenu((version=='IE')?evt.srcElement:evt.target))  //the same MAIN menu
      {
      	if (GetMenuItem(evt.toElement)==GetMenuItem((version=='IE')?evt.srcElement:evt.target) || GetMenuItem(GetMenu(evt.toElement))==GetMenuItem((version=='IE')?evt.srcElement:evt.target))  //if in the same item or going from item to its menu
         { }
         else  //if going from menu to its father menu or from item to another item in the same menu
         {
         	CloseMenusUnderItem(GetMenuItem((version=='IE')?evt.srcElement:evt.target),2);  //closing the menu of the last item we viewd
            if (GetMenu(evt.toElement)==GetMenu(GetMenuItem(GetMenu((version=='IE')?evt.srcElement:evt.target))))  //if going from menu to the father menu to an item other than the item of the menu we were in
            {
            	CloseMenusUnderItem(GetMenuItem(GetMenu((version=='IE')?evt.srcElement:evt.target)),2);  //closing the menu we were in
            }
         }
      }
      else  //if different MAIN MENUS
      {
      	navi_in=false;
         navi_last_timeout=window.setTimeout("CloseAllMenus(GetMainMenu(navi_last_menu_in),-1);",time_out);
      }
   	evt.cancelBubble=true;
   }
   function CloseMenusUnderItem(nav_item,levels)
   {
   	if (!nav_item)
      	return;
   	if (nav_item.className!='nav-item' || levels==0)  //if the parameter is not a navigator menu item or we need to hide no menus
      	return;  //we do nothing and return
      var mnu=nav_item.getElementsByTagName('DIV')[0];  //the menu of the item
      if (mnu.style.visibility=='hidden')  //if the menu is already closed
      	return;
  	   //nav_item.getElementsByTagName('TABLE')[0].bgColor='#d4d4f1';  //changes bg to color that the mouse is not over it
        nav_item.getElementsByTagName('TABLE')[0].bgColor='#FFFFFF';  //changes bg to color that the mouse is not over it 
		nav_item.getElementsByTagName('TABLE')[0].background="images/but-up.gif";  //changes bg to color that the mouse is not over it 
	  mnu.style.visibility='hidden';  //hide the menu of the item
      if (levels==1)  //if it was the last menu we needed to hide
      	return;  //we return and finished
      levels--;  //otherwise, now we have one less menu to hide
      for (var i=0;(itm=mnu.getElementsByTagName('DIV')[i])!=null;i++)  //loop over all the items in the last menu
      	CloseMenusUnderItem(itm,levels);  //close all thier menus
   }
   function CloseAllMenus(main_menu,levels)
   {
   	if (navi_in==true || main_menu==null)
      	return;
		for (var i=0;(itm=main_menu.getElementsByTagName('DIV')[i]);i++)
      {
      	if (itm.id.search('nav_itm_in')!=-1)  //if the item we want to close has a fixed menu
         	continue;  //we skip on it
      	CloseMenusUnderItem(itm,levels);
      }
      navi_last_menu_in=null;
   }
   function GetMenuItem(ch)
   {
   	while (ch && ch.className!='nav-item')
      	ch=ch.parentNode;
      return ch;
   }
   function GetMenu(ch)
   {
   	while (ch && ch.className!='nav-menu')
      	ch=ch.parentNode;
      return ch;
   }
   function GetMainMenu(ch)
   {
   	ch=GetMenu(ch);
      while (ch && ch.id.search('nav_main')==-1)
      	ch=GetMenu(ch.parentNode);
      return ch;
   }
   function MenuChildOf(menu,par)
   {
		if (!menu || !par)
			return false;
		while (menu)
		{
			if (menu==par)
				return true;
			menu=GetMenu(menu.parentNode);
		}
		return false;
   }