

/* 
   Freebyte.com javascript menu version 2.1
   Copyright Freebyte.com 1995 - 2011
   For Freebyte.com internal usage only
*/
	
  var btn0leftoffset = 0;
  var btn0topoffset = 0;
  var glast_submenu = null;
  var gtimers = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  var glstmenus = new Array(15);
  var gbaseurls = new Array(
  'http://www.freebyte.com', 
  'http://www.freebyte.com/programming', 
  'http://www.freebyte.net', 
  'http://www.treepad.com',
  'http://www.customaddressbook.com',
  '');

  //freebyte:
  glstmenus[0] = new Array(
  0, '', 'Home',
  0, '/fbsearch/', 'Search',
  2, '', 'Site map',
  0, '/newsletter/', 'Newsletter',
  0, '/sendforms/fb/submit.php', 'Submit - add your link',
  0, '/support/anti-spam.html', 'Report spams',
  0, '/support/', 'Contact and support',
  0, '/linkto/', 'Link to us',
  0, '/links/software.html', 'Links: software',
  0, '/links/freebie.html', 'Links: freebie and freeware',
  0, '/links/', 'Links: various',
  5, 'http://www.freebyte.gr', 'Freebyte Greece');

  //graphics:
  glstmenus[1] = new Array(
  0, '/graphicprograms/', 'Free graphics software',
  0, '/clipart_images_photos_icons/', 'Free images, clipart, icons, etc.',
  0, '/clipart_images_photos_icons/#fontdirectories', 'Free fonts',
  5, 'http://www.iconfreedownload.com', 'Free icons',
  0, '/gallery/', 'Freebyte Gallery: free images',
  0, '/gallery/background_images.html', 'Freebyte Gallery: free backgrounds',
  0, '/scancalculator/', 'Scan Calculator');


  //music and art:
  glstmenus[2] = new Array(
  0, '/art/', 'Art online',
  0, '/music_software/', 'Free music software',
  0, '/music/', 'Music zone',
  0, '/music_player/', 'Music Player for Linux');

  //office and desktop:
  glstmenus[3] = new Array(
  0, '/calculators_converters/', 'Free calculators & converters',
  0, '/time_clocks/', 'Free clocks, alarms & time',
  0, '/clipart_images_photos_icons/#fontdirectories', 'Free fonts',
  0, '/office/', 'Free office software',
  0, '/screensavers/', 'Free screensavers & desktop',
  3, '', 'TreePad - Information Manager',
  3, '/treepad_pdf/', 'TreePad-to-PDF',
  4, '', 'Custom Addressbook',
  5, 'http://www.exe-ebookcreator.com', 'exe-eBookCreator');

  //software and utilities:
  glstmenus[4] = new Array(
  0, '/filediskutils/', 'Free file and disk utilities',
  0, '/systemutilities/', 'Free system and administrator utilities',
  0, '/freeware/', 'Free software by Freebyte.com',
  0, '/links/software.html', 'Software and freebie sites',
  5, 'http://www.disktective.com', 'Disktective',
  5, 'http://www.fastfilerenamer.com', 'Fast File Renamer',
  0, '/fbbackup/', 'Freebyte Backup',
  0, '/fbtaskscheduler/', 'Freebyte Task Scheduler',
  0, '/fbzip/', 'Freebyte ZIP',
  5, 'http://www.hjsplit.org', 'HJSplit',
  5, 'http://www.harddisksearch.com', 'Harddisk search');

  //security:
  glstmenus[5] = new Array(
  0, '/anti-spam/', 'Anti-spam resources',
  0, '/anti-spyware/', 'Free anti-spyware',
  0, '/antivirus/', 'Free anti-virus software',
  0, '/security/', 'Free encryption and security utilities',
  0, '/bootminder/', 'Bootminder');

  //internet and communication:
  glstmenus[6] = new Array(
  0, '/email/', 'Free email accounts',
  0, '/homepages/', 'Free home pages and Webspace',
  0, '/internet_programs/', 'Free Internet software',
  0, '/free_phone_and_fax_services/', 'Free phone and fax services',
  0, '/search_engines/', 'Search the Web');

  //information:
  glstmenus[7] = new Array(
  0, '/dictionary/', 'Free dictionaries, language, translation',
  0, '/free_ebooks/', 'Free ebooks',
  0, '/education/', 'Online education',
  0, '/news/', 'News & newspapers',
  0, '/reference/', 'Reference, encyclopedias',
  0, '/weather/', 'Weather');

  //entertainment:
  glstmenus[8] = new Array(
  0, '/games/', 'Games',
  0, '/jokes_humor_cartoons_fun/', 'Jokes & humor',
  0, '/radio_online/', 'Online radio',
  0, '/internet_television/', 'Online television');

  //technology, science
  glstmenus[9] = new Array(
  0, '/cad/', 'CAD - Mechanical engineering',
  0, '/experiments_projects/', 'Experiments & Projects ',
  0, '/electronics/', 'Electronics',
  0, '/reference/', 'Reference');

  //webmaster:
  glstmenus[10] = new Array(
  0, '/website_tools/', 'Free Website tools',
  0, '/free_website_promotion/', 'Free Website promotion',
  0, '/homepages/', 'Free Webspace',
  1, '/webscripting/', 'Free Web development tools');

  //programming:
  glstmenus[11] = new Array(
  1, '/assembler/', 'Assembler',
  1, '/basic/', 'Basic',
  1, '/cobol/', 'Cobol',
  1, '/cpp/', 'C and C++',
  1, '/cross_platform/', 'Cross-platform',
  1, '/database/', 'Database',
  1, '/delphi/', 'Delphi',
  1, '/help_file_authoring/', 'Help authoring',
  1, '/java/', 'Java',
  1, '/languages/', 'Languages, additional',
  1, '/miscellaneous/', 'Miscellaneous tools',
  1, '/unicode/', 'Multi-lingual and unicode',
  0, '/operatingsystems/#osdevelopment', 'Operating systems',
  1, '', 'Programming: site map',
  1, '/pascal/', 'Pascal',
  1, '/webscripting/', 'Web development');

  //business and finance:
  glstmenus[12] = new Array(
  0, '/free_accounting_software/', 'Free accounting software',
  0, '/business/', 'Business services and software',
  0, '/makemoney/', 'Earn money online, how to',
  0, '/business/mortgage_calculator.html', 'Free mortgage calculators');

  //life:
  glstmenus[13] = new Array(
  0, '/cooking_recipes_food/', 'Cooking and recipes',
  0, '/nature/', 'Nature',
  0, '/spirituality_religion/', 'Spirituality and religion');

  //system and computer:
  glstmenus[14] = new Array(
  0, '/drivers/', 'Drivers and dlls',
  0, '/free_computers/', 'Free computers for the disadvantaged',
  0, '/operatingsystems/', 'Free operating systems',
  0, '/systemutilities/', 'Free system and administrator utilities',
  0, '/technical_support/', 'Free technical support and tips');

  function cleartimer(idx) {
    if (gtimers[idx] != 0) {
      window.clearTimeout(gtimers[idx]);
      gtimers[idx] = 0;
    }
  }

  function buttonmouseover(btn) {
    btn.className = 'fbmenuitemlit';
    var idx = parseInt(btn.id.substring(3,5));
    cleartimer(idx);
    showsubmenu(idx);
  }

  function submenuitemmouseover(btn) {
   btn.className = 'fbmenuitemlit';
  } 

  function submenuitemmouseout(btn) {
    btn.className = 'fbmenuitem';
  }

  function submenumouseover(sub) {
    var idx = parseInt(sub.id.substring(3,5));
    cleartimer(idx);
  } 

  function submenumouseout(sub) {
    var idx = parseInt(sub.id.substring(3,5));
    gtimers[idx] = window.setTimeout('hidesubmenu(' + idx + ')', 500);
  }


  function buttonmouseout(btn) {
    btn.className = 'fbmenuitem';
    var idx = parseInt(btn.id.substring(3,5));
    gtimers[idx] = window.setTimeout('hidesubmenu(' + idx + ')', 500);
  }

  function gotopage(cell) {
    var cell_lnk_elements = cell.getElementsByTagName('A');
    var lnk = cell_lnk_elements[0];
    window.location.href= lnk.href;
  }

  function onafterload() {
    var btn = document.getElementById('btn0');
    btn0leftoffset = btn.offsetLeft;
    btn0topoffset = btn.offsetTop;
    createmenus();
  }

  function getoffset(object, offset) {
    if (!object) {
      return;
    }
    offset.x += object.offsetLeft;
    offset.y += object.offsetTop;

    getoffset(object.offsetParent, offset);
  }

  function showsubmenu(idx) {
    var btn_offset = {x:0, y:0};
    var subm_offset = {x:0, y:0};
    var subm_name = '';
    var btn_name = '';
    var viewport_height = DHTMLAPI.getInsideWindowHeight();

    subm_name = 'sub' + idx;
    btn_name = 'btn' + idx;

    if (subm != glast_submenu) {
      if (glast_submenu != null) {
        glast_submenu.style.visibility = 'hidden';
      }
    }

    var btn = document.getElementById(btn_name);
    var subm = document.getElementById(subm_name);

    getoffset(btn, btn_offset);

    var abstop = btn_offset.y - btn0topoffset - 3;
    var absleft = btn_offset.x - subm.offsetWidth - 4;

    if (abstop + subm.offsetHeight > viewport_height + document.body.scrollTop) {
        abstop = abstop - subm.offsetHeight + btn.offsetHeight + btn0topoffset + 2;
    }

    subm.style.top = abstop + 3;
    subm.style.left = absleft;
    subm.style.visibility = 'visible';
    glast_submenu = subm;
  }

  function hidesubmenu(idx) {
    var subm_name = 'sub' + idx;
    var subm = document.getElementById(subm_name);
    subm.style.visibility = 'hidden';
  }

  function createmenus() {
    var idx = 0;

    for (i=0;i<glstmenus.length;i++) {

      var lstmenu = glstmenus[i];
      var ltable = document.createElement('TABLE');
      var ltablebody = document.createElement('TBODY');


      for (j=0;j<lstmenu.length/3;j++) {
        var lrow = document.createElement('TR');
        var lcell = document.createElement('TD');
        var llink = document.createElement('A');
        var lidxbaseurl = parseInt(lstmenu[j*3]);
        var lurl = gbaseurls[lidxbaseurl] + lstmenu[j*3+1];
        llink.setAttribute('href', lurl);
        var ltext = document.createTextNode(lstmenu[j*3+2]);
        llink.appendChild(ltext);
        lcell.appendChild(llink);
        lcell.className = 'fbmenuitem';
        lcell.id = 'cell' + i + '_' + j;
        lcell.onmouseover = function() {submenuitemmouseover(this);};
        lcell.onmouseout = function() {submenuitemmouseout(this);};
        lcell.onclick = function() {gotopage(this);};
        lrow.appendChild(lcell);
        ltablebody.appendChild(lrow);
      }
      lcell.style.borderBottomWidth = 0;
      lcell.style.paddingBottom = 2;
      ltable.appendChild(ltablebody);
      document.body.appendChild(ltable);
      var ltableid = 'sub' + idx;
      ltable.id = 'sub' + idx;
      ltable.cellPadding = 4; 
      ltable.cellSpacing = 4;
      ltable.className = 'fbmenu';
      ltable.style.visibility = 'hidden';
      ltable.style.position = 'absolute';
      ltable.onmouseover= function() {submenumouseover(this);};
      ltable.onmouseout= function() {submenumouseout(this);};
      idx++; 

    }

  }

addOnLoadEvent(function() {onafterload()});






