

var MHeight = 0;
var widthL1 = 150;

var widthRemain = 760 - widthL1;

var isDOMxx = (document.getElementById ? true : false);
var isIE4xx = ((document.all && !isDOMxx) ? true : false);
var isNS4xx = (document.layers ? true : false);

var menu = new Array();
var litNow = new Array();
var popTimerxx = 0;

var OverL1 = '#326432', BackL1 = '#3c8757';
var OverL2 = '#028EB4', BackL2 = '#326432';
var BackL3 = '#dd7722';
var BackL4 = '#eea000';
var BackL5 = '#3080dd';
var BackL6 = '#2060bb';
var textL1 = '#ffffff';
var textL2 = '#222222';


var basepx = 87;
var heightL1 = 21;
var widthL2 = 185;

var popOldWidth = window.innerWidth;

var dot = '<td align=center valign=center width=14><img src='+basepath+'tc_chi/images/front/spacer.gif border=0 height=13 width=14 ';
var HOME = '<td align=center valign=center width=14><img src='+basepath+'tc_chi/images/front/home.gif border=0 height=13 width=14 ';
var space = '<td align=center valign=center width=2><img src='+basepath+'tc_chi/images/front/spacer.gif border=0 height=13 width=2 ';

function bg() {
 if(navigator.appName=="Microsoft Internet Explorer") {
  document.body.background = basepath+'tc_chi/images/general/epd_bkg_new_ie.gif';
 } else {
  document.body.background = basepath+'tc_chi/images/general/epd_bkg_new_ns.gif';
 }
}

function writeMenus() {
if (!isDOMxx && !isIE4xx && !isNS4xx) return;

for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
var str = '', itemX = 0, itemY = 0;

for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
var itemID = 'menu' + currMenu + 'item' + currItem;
var w = (isVert ? width : length);
var h = (isVert ? length : width);

if (isDOMxx || isIE4xx) {
str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
if (backCol) str += 'background: ' + backCol + '; ';
str += '" ';
}
if (isNS4xx) {
str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
if (backCol) str += 'bgcolor="' + backCol + '" ';
}
if (borderClass) str += 'class="' + borderClass + '" ';

str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';

str += '<table id="MENU" width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4xx && borderClass ? 3 : 0) + '">' + "<tr onmouseout=clearstatus(); onmouseover=cursorhand(this,'"+href+"'); onclick=gourl('"+href+"','"+frame+"');>"  + image + '<td align="left" height="' + (h - 7) + '">' + '<a class="' + textClass + '" href="' + href + '"' + (frame ? ' target="' + frame + '">' : '>') + text + '</a></td>';
if (target > 0) {

menu[target][0].parentMenu = currMenu;
menu[target][0].parentItem = currItem;

if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
}
str += '</tr></table>' + (isNS4xx ? '</layer>' : '</div>');
if (isVert) itemY += length + spacing;
else itemX += length + spacing;
}
if (isDOMxx) {
var newDiv = document.createElement('div');
document.getElementsByTagName('body').item(0).appendChild(newDiv);
newDiv.innerHTML = str;
ref = newDiv.style;
ref.position = 'absolute';
ref.visibility = 'hidden';
}

if (isIE4xx) {
document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
ref = getSty('menu' + currMenu + 'div');
}

if (isNS4xx) {
ref = new Layer(0);
ref.document.write(str);
ref.document.close();
}

for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
itemName = 'menu' + currMenu + 'item' + currItem;
if (isDOMxx || isIE4xx) menu[currMenu][currItem].ref = getSty(itemName);
if (isNS4xx) menu[currMenu][currItem].ref = ref.document[itemName];
   }
}
with(menu[0][0]) {
ref.left = x;
ref.top = y;
ref.visibility = 'visible';
   }
}

/* function Item(image, text, href, frame, length, spacing, target) */
/* Edit Menu Here -- Start */

menu[0] = new Array();
menu[0][0] = new Menu(true, '<img src="'+basepath+'tc_chi/images/front/arrow.gif" border="0">', 0, basepx, widthL1, OverL1, BackL1, 'itemBorder', 'itemText');
menu[0][1] = new Item1(HOME, "主页", basepath, '', 1, 0, 0);
menu[0][2] = new Item1(dot, "最新消息", basepath+'tc_chi/news_events/what_new/what_new.html', '', 1, 0, 0);
menu[0][3] = new Item1(dot, "消息与活动", basepath+'tc_chi/news_events/news_maincontent.html', '', 1, 0, 1);
menu[0][4] = new Item1(dot, "关於我们", basepath+'tc_chi/about_epd/aboutepd_maincontent.html', '', 1, 0, 2);
menu[0][5] = new Item1(dot, "法律与规例", basepath+'tc_chi/laws_regulations/laws_maincontent.html', '', 1, 0, 3);
menu[0][6] = new Item1(dot, "国际公约", basepath+'tc_chi/international_conventions/international_convention.html', '', 1, 0, 4);
menu[0][7] = new Item1(dot, "立法会事务", basepath+'tc_chi/news_events/legco/legco.html', '', 1, 0, 5);
menu[0][8] = new Item1(dot, "委员会", basepath+'tc_chi/boards/boards_maincontent.html', '', 1, 0, 6);
menu[0][9] = new Item1(dot, "申请牌照", basepath+'tc_chi/application_for_licences/application_maincontent.html', '', 1, 0, 7);
menu[0][10] = new Item1(dot, "同心协力改善环境", basepath+'tc_chi/how_help/howhelp_maincontent.html', '', 2, 0, 8);
menu[0][11] = new Item1(dot, "环保教育", basepath+'tc_chi/envir_education/edu_maincontent.html', '', 1, 0, 9);
menu[0][12] = new Item1(dot, "&#x884c;&#x4e1a;&#x73af;&#x4fdd;&#x652f;&#x63f4;", basepath+'tc_chi/cac/', '', 1.6, 0, 13);
menu[0][13] = new Item1(dot, "资源与刊物", basepath+'tc_chi/resources_pub/resourcespub_maincontent.html', '', 1, 0, 10);
menu[0][14] = new Item1(dot, "公开资料", basepath+'tc_chi/access_info/access_info.html', '', 1, 0, 0);
menu[0][15] = new Item1(dot, "商业及就业机会", basepath+'tc_chi/business_job/businessjob_maincontent.html', '', 1, 0, 11);
menu[0][16] = new Item1(dot, "相关网站", basepath+'tc_chi/links/env_links.html', '', 1, 0, 12);

menu[1] = new Array();
menu[1][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[1][1] = new Item2(space,"重点消息", basepath+'tc_chi/news_events/current_issue/current_issue.html', '', 1, 0, 0);
menu[1][2] = new Item2(space,"致编辑的信", basepath+'tc_chi/news_events/letters/letters.html', '', 1, 0, 0);
menu[1][3] = new Item2(space,"活动", basepath+'tc_chi/news_events/events/events.html', '', 1, 0, 0);
menu[1][4] = new Item2(space,"新闻稿", basepath+'tc_chi/news_events/press/press.html', '', 1, 0, 0);
menu[1][5] = new Item2(space,"演辞及相关资料", basepath+'tc_chi/news_events/speech/speech.html', '', 1, 0, 0);
menu[1][6] = new Item2(space,"公告", basepath+'tc_chi/news_events/notices/notices.html', '', 1, 0, 0);
menu[1][7] = new Item2(space,"宪报公告", basepath+'tc_chi/news_events/gazette/gazette.html', '', 1, 0, 0);
menu[1][8] = new Item2(space,"招标", basepath+'tc_chi/business_job/business_opp/tender.html', '', 1, 0, 0);
menu[1][9] = new Item2(space,"职位空缺", basepath+'tc_chi/business_job/job_opp/vacancies.html', '', 1, 0, 0);
menu[1][10] = new Item2(space,"&#x901a;&#x8a0a;", basepath+'tc_chi/news_events/newsletter/newsletters.html', '', 1, 0, 0);
menu[1][11] = new Item2(space,"其他公告", basepath+'tc_chi/news_events/other/other.html', '', 1, 0, 0);

menu[2] = new Array();
menu[2][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[2][1] = new Item2(space,"抱负和使命", basepath+'tc_chi/about_epd/vis_miss/about_epd.html', '', 1, 0, 0);
menu[2][2] = new Item2(space,"服务承诺", basepath+'tc_chi/about_epd/perf_pledge/perf_pledge.html', '', 1, 0, 0);
menu[2][3] = new Item2(space,"历史与结构", basepath+'tc_chi/about_epd/history/history.html', '', 1, 0, 0);
menu[2][4] = new Item2(space,"组织架构图", basepath+'tc_chi/about_epd/organ_chart/organ_chart.html', '', 1, 0, 0);
menu[2][5] = new Item2(space,"环保署的工作", basepath+'tc_chi/about_epd/epd_work/epd_work.html', '', 1, 0, 0);
menu[2][6] = new Item2(space,"办事处及设施", basepath+'tc_chi/about_epd/facility/facility.html', '', 1, 0, 0);
menu[2][7] = new Item2(space,"环保署的环保管理", basepath+'tc_chi/about_epd/env_policy_mgt/env_policy_mgt.html', '', 1, 0, 0);
menu[2][8] = new Item2(space,"安全及健康管理", basepath+'tc_chi/about_epd/safe/safe.html', '', 1, 0, 0);

menu[3] = new Array();
menu[3][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[3][1] = new Item2(space,"环保法例", basepath+'tc_chi/laws_regulations/envir_legislation/laws_maincontent_el.html', '', 1, 0, 0);
menu[3][2] = new Item2(space,"环保法例的指引", basepath+'tc_chi/laws_regulations/comp_guides/laws_maincontent_cg.html', '', 1, 0, 0);
menu[3][3] = new Item2(space,"环保标准及指引", basepath+'tc_chi/envir_standards/esg_maincontent.html', '', 1, 0, 0);
menu[3][4] = new Item2(space,"奉公守法", basepath+'tc_chi/laws_regulations/enforcement/laws_maincontent_e.html', '', 1, 0, 0);

menu[4] = new Array();
menu[4][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[4][1] = new Item2(space,"环境保育", basepath+'tc_chi/international_conventions/conservation/conservation_main.html', '', 1, 0, 0);
menu[4][2] = new Item2(space,"气候变化", basepath+'tc_chi/climate_change/index.html', '', 1, 0, 0);
menu[4][3] = new Item2(space,"有害废物", basepath+'tc_chi/international_conventions/hazardous_wastes/hazardous_wastes_main.html', '', 1, 0, 0);
menu[4][4] = new Item2(space,"海洋污染", basepath+'tc_chi/international_conventions/marine_pollution/marine_pollution_main.html', '', 1, 0, 0);
menu[4][5] = new Item2(space,"保护臭氧层", basepath+'tc_chi/international_conventions/ozone/ozone_main.html', '', 1, 0, 0);
menu[4][6] = new Item2(space,"持久性有机污染物", basepath+'tc_chi/international_conventions/pops/pops_main.html', '', 1, 0, 0);

menu[5] = new Array();
menu[5][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[5][1] = new Item2(space,"财务委员会", basepath+'tc_chi/news_events/legco/finance_com.html', '', 1, 0, 0);
menu[5][2] = new Item2(space,"立法会提问及回应", basepath+'tc_chi/news_events/legco/ques_reply.html', '', 1, 0, 0);
menu[5][3] = new Item2(space,"环境事务委员会", basepath+'tc_chi/news_events/legco/ea_panel.html', '', 1, 0, 0);
menu[5][4] = new Item2(space,"立法会法案及规例", basepath+'tc_chi/news_events/legco/bills.html', '', 1, 0, 0);
menu[5][5] = new Item2(space,"立法会动议辩论", basepath+'tc_chi/news_events/legco/motion_debate.html', '', 1, 0, 0);

menu[6] = new Array();
menu[6][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[6][1] = new Item2(space,"石棉行政管理委员会", basepath+'tc_chi/boards/asbestos/maincontent.html', '', 1, 0, 0);
menu[6][2] = new Item2(space,"环境谘询委员会", basepath+'tc_chi/boards/advisory_council/maincontent.html', '', 1, 0, 0);
//menu[6][3] = new Item2(space,"废物管理设施谘询小组", basepath+'tc_chi/boards/advisory_group/maincontent.html', '', 1, 0, 0);
menu[6][3] = new Item2(space,"空气污染管制上诉委员会备选委员小组", basepath+'tc_chi/boards/ap_appeal/maincontent.html', '', 2, 0, 0);
menu[6][4] = new Item2(space,"&#x6d77;&#x4e0a;&#x503e;&#x5012;&#x7269;&#x6599;&#x4e0a;&#x8bc9;&#x59d4;&#x5458;&#x4f1a;&#x59d4;&#x5458;&#x56e2;",basepath+ 'tc_chi/boards/dumping_appeal/maincontent.html', '', 2.3, 0, 0);
menu[6][5] = new Item2(space,"能源效益及节约小组委员会", 'http://sc.enb.gov.hk/gb/www.enb.gov.hk/sc/boards_committees/energy_subcommittee/index.html', '_blank', 2, 0, 0);
menu[6][6] = new Item2(space,"&#x73af;&#x5883;&#x5f71;&#x54cd;&#x8bc4;&#x4f30;&#x4e0a;&#x8bc9;&#x59d4;&#x5458;&#x4f1a;&#x5c0f;&#x7ec4;", basepath+'tc_chi/boards/eia_appeal/maincontent.html', '', 2.3, 0, 0);
//menu[6][7] = new Item2(space,"环境政策工作小组", basepath+'tc_chi/boards/envir_policy/maincontent.html', '', 1, 0, 0);
menu[6][7] = new Item2(space,"环境保护运动委员会", 'http://www.ecc.org.hk/cindex.php', '_blank', 1, 0, 0);
menu[6][8] = new Item2(space,"环境及自然保育基金委员会/吴氏会德丰环保基金", 'http://www.ecf.gov.hk/', '_blank', 2, 0, 0);
menu[6][9] = new Item2(space,"&#x566a;&#x97f3;&#x7ba1;&#x5236;&#x4e0a;&#x8bc9;&#x59d4;&#x5458;&#x4f1a;&#x5c0f;&#x7ec4;", basepath+'tc_chi/boards/noise_appeal/maincontent.html', '', 1, 0, 0);
menu[6][10] = new Item2(space,"&#x4ea7;&#x54c1;&#x73af;&#x4fdd;&#x8d23;&#x4efb;&#x4e0a;&#x8bc9;&#x59d4;&#x5458;&#x4f1a;&#x5907;&#x9009;&#x59d4;&#x5458;&#x5c0f;&#x7ec4;", basepath+'tc_chi/boards/eco_ap/maincontent.html', '', 2, 0, 0);
menu[6][11] = new Item2(space,"废物处置上诉委员会小组", basepath+'tc_chi/boards/waste_appeal/maincontent.html', '', 1, 0, 0);
menu[6][12] = new Item2(space,"&#x6c34;&#x6c61;&#x67d3;&#x7ba1;&#x5236;&#x4e0a;&#x8bc9;&#x59d4;&#x5458;&#x4f1a;&#x5907;&#x9009;&#x59d4;&#x5458;&#x5c0f;&#x7ec4;", basepath+'tc_chi/boards/water_appeal/maincontent.html', '', 2, 0, 0);

menu[7] = new Array();
menu[7][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[7][1] = new Item2(space,"网上申请", basepath+'tc_chi/application_for_licences/online_applic/online_app.html', '', 1, 0, 0);
menu[7][2] = new Item2(space,"申请表格", basepath+'tc_chi/application_for_licences/applic_froms/forms.html', '', 1, 0, 0);
menu[7][3] = new Item2(space,"申请牌照的指引说明", basepath+'tc_chi/application_for_licences/guidance/guidance_licence.html', '', 1, 0, 0);
menu[7][4] = new Item2(space,"&#x6536;&#x8cbb;", basepath+'tc_chi/application_for_licences/fees_charges/newfee.html', '', 1, 0, 0);
menu[7][5] = new Item2(space,"如何递交申请表格", basepath+'tc_chi/application_for_licences/sub_applic/application_maincontent38.html', '', 1, 0, 0);

menu[8] = new Array();
menu[8][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[8][1] = new Item2(space,"投诉污染", basepath+'tc_chi/how_help/report_pollution/reportpollution.html', '', 1, 0, 0);
menu[8][2] = new Item2(space,"减少废物及废物分类回收", 'https://www.wastereduction.gov.hk', '_blank', 1, 0, 0);
menu[8][3] = new Item2(space,"保持空气清新", 'http://www.gov.hk/sc/residents/environment/public/green/helpcleanair.htm', '_blank', 1, 0, 0);
menu[8][4] = new Item2(space,"保护环境人人有责", basepath+'tc_chi/how_help/tips_savearth/tips_save.html', '', 1, 0, 0);
menu[8][5] = new Item2(space,"环境管理工具", basepath+'tc_chi/how_help/tools_ems/overview.html', '', 1, 0, 0);
menu[8][6] = new Item2(space,"环保采购守则", basepath+'tc_chi/how_help/green_procure/green_procure.html', '', 1, 0, 0);
menu[8][7] = new Item2(space,"申请资助基金", basepath+'tc_chi/how_help/app_funds/app_funds.html', '', 1, 0, 0);

menu[9] = new Array();
menu[9][0] = new Menu(true, '>', widthL1, 0, widthL2-10, OverL2, BackL2, 'itemBorder', 'itemText');
menu[9][1] = new Item2(space,"香港的环保教育及环保意识", basepath+'tc_chi/envir_education/enviredu_aware/overview.html', '', 2, 0, 0);
menu[9][2] = new Item2(space,"环保教材套", basepath+'tc_chi/envir_education/envir_explorer/packages_main.html', '', 1, 0, 0);
menu[9][3] = new Item2(space,"环境教育展览及环境资源中心", 'http://www.gov.hk/sc/residents/environment/public/activities/envcentres.htm', '_blank', 2, 0, 0);
menu[9][4] = new Item2(space,"趣致廊", basepath+'tc_chi/envir_education/gallery/gallery.html', '', 1, 0, 0);

menu[10] = new Array();
menu[10][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[10][1] = new Item2(space,"香港环境保护里程碑", basepath+'tc_chi/resources_pub/history/history_hkep.html', '', 1, 0, 0);
menu[10][2] = new Item2(space,"政策及谘询文件", basepath+'tc_chi/resources_pub/policy/pub_policy.html', '', 1, 0, 0);
menu[10][3] = new Item2(space,"刊物", basepath+'tc_chi/resources_pub/publications/publications.html', '', 1, 0, 0);
menu[10][4] = new Item2(space,"资源材料", basepath+'tc_chi/resources_pub/resource_materials/resource_materials.html', '', 1, 0, 0);
menu[10][5] = new Item2(space,"环保法例", basepath+'tc_chi/laws_regulations/envir_legislation/laws_maincontent_el.html', '', 1, 0, 0);
menu[10][6] = new Item2(space,"环保统计数字", basepath+'tc_chi/resources_pub/envir_info/envir_info.html', '', 1, 0, 0);
menu[10][7] = new Item2(space,"环保标准及指引", basepath+'tc_chi/envir_standards/esg_maincontent.html', '', 1, 0, 0);
menu[10][8] = new Item2(space,"短片", basepath+'tc_chi/resources_pub/videos/video.html', '', 1, 0, 0);
menu[10][9] = new Item2(space,"常用英汉辞汇", 'http://www.csb.gov.hk/hkgcsb/glossary/glossary_search.php?search_name=&viewcode=&catg_code%5B%5D=Environment', '_blank', 1, 0, 0);
menu[10][10] = new Item2(space,"常见问题", basepath+'tc_chi/resources_pub/faq/faq.html', '', 1, 0, 0);
menu[10][11] = new Item2(space,"环境教育展览及环境资源中心", 'http://www.gov.hk/sc/residents/environment/public/activities/envcentres.htm', '_blank', 1, 0, 0);

menu[11] = new Array();
menu[11][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[11][1] = new Item2(space,"商业机会", basepath+'tc_chi/business_job/business_opp/busopp_maincont.html', '', 1, 0, 0);
menu[11][2] = new Item2(space,"就业机会", basepath+'tc_chi/business_job/job_opp/jobopp_maincont.html', '', 1, 0, 0);

menu[12] = new Array();
menu[12][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');
menu[12][1] = new Item2(space,"本港网站", basepath+'tc_chi/links/local/link_local.html', '', 1, 0, 0);
menu[12][2] = new Item2(space,"内地网站", basepath+'tc_chi/links/mainchina/link_mainchina.html', '', 1, 0, 0);
menu[12][3] = new Item2(space,"海外网站", basepath+'tc_chi/links/overseas/link_overseas.html', '', 1, 0, 0);
menu[12][4] = new Item2(space,"网页推介", basepath+'tc_chi/links/recommend/recommend.html', '', 1, 0, 0);

menu[13] = new Array();
menu[13][0] = new Menu(true, '>', widthL1, 0, widthL2, OverL2, BackL2, 'itemBorder', 'itemText');

menu[13][1] = new Item2(space,"&#x5efa;&#x9020;&#x4e1a;", basepath+'tc_chi/greenconstruction/', '_blank', 1, 0, 0);
menu[13][2] = new Item2(space,"&#x6c7d;&#x8f66;&#x7ef4;&#x4fee;&#x4e1a;", 'http://www.greengarage.com.hk/scindex.html', '_blank', 1, 0, 0);
menu[13][3] = new Item2(space,"&#x7269;&#x4e1a;&#x7ba1;&#x7406;", basepath+'tc_chi/greenproperty/', '_blank', 1, 0, 0);
menu[13][4] = new Item2(space,"&#x996e;&#x98df;&#x4e1a;", 'http://www.greenrestaurant-hk.org/scindex.html', '_blank', 1, 0, 0);
menu[13][5] = new Item2(space,"&#x4f01;&#x4e1a;&#x73af;&#x4fdd;&#x76d1;&#x7406;", basepath+'tc_chi/cac/cem/cem.html', '', 1, 0, 0);



/* Edit Menu Here -- End */

nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');

if (isNS4xx) document.captureEvents(Event.CLICK);
document.onclick = clickHandle;

function AddMenuHeight(y) {
        MHeight = MHeight + y - 1;
}

function cursorhand(x,y) {
	x.style.cursor = 'hand';
        window.status = y;
}

function clearstatus() {
 	window.status='';
}

function gourl(x,y) {
   if(y==""){
	window.location = x;
   }
}

function getRef(id) {
if (isDOMxx) return document.getElementById(id);
if (isIE4xx) return document.all[id];
if (isNS4xx) return document.layers[id];
}

function getSty(id) {
return (isNS4xx ? getRef(id) : getRef(id).style);
}

function popOver(menuNum, itemNum) {
clearTimeout(popTimerxx);
hideAllBut(menuNum);
litNow = getTree(menuNum, itemNum);
changeCol(litNow, true);
targetNum = menu[menuNum][itemNum].target;
if (targetNum > 0) {
thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
with (menu[targetNum][0].ref) {
left = parseInt(thisX + menu[targetNum][0].x);
top = parseInt(thisY + menu[targetNum][0].y);
visibility = 'visible';
      }
   }
}

function popOut(menuNum, itemNum) {
if ((menuNum == 0) && !menu[menuNum][itemNum].target)
hideAllBut(0)
else
popTimerxx = setTimeout('hideAllBut(0)', 500);
}

function getTree(menuNum, itemNum) {

itemArray = new Array(menu.length);

while(1) {
itemArray[menuNum] = itemNum;

if (menuNum == 0) return itemArray;
itemNum = menu[menuNum][0].parentItem;
menuNum = menu[menuNum][0].parentMenu;
   }
}

function changeCol(changeArray, isOver) {
for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
if (changeArray[menuCount]) {
newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
// Change the colours of the div/layer background.
with (menu[menuCount][changeArray[menuCount]].ref) {
if (isNS4xx) bgColor = newCol;
else backgroundColor = newCol;
         }
      }
   }
}
function hideAllBut(menuNum) {
var keepMenus = getTree(menuNum, 1);
for (count = 0; count < menu.length; count++)
if (!keepMenus[count])
menu[count][0].ref.visibility = 'hidden';
changeCol(litNow, false);
}

function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {

this.isVert = isVert;

this.popInd = popInd;

this.x = x;
this.y = y;
this.width = width;
this.overCol = overCol;
this.backCol = backCol;
this.borderClass = borderClass;
this.textClass = textClass;
this.parentMenu = null;
this.parentItem = null;
this.ref = null;

}

function Item1(image, text, href, frame, length, spacing, target) {
this.image = image + ' alt="' + text + '" name="' + text + '"></td>';
this.text = text;
this.href = href;
this.frame = frame;

if(length > 1) {
  this.length = (length - 1) * heightL1 * 1.6;
} else {
  this.length = length * heightL1;  
}
AddMenuHeight(this.length);

this.spacing = spacing;
this.target = target;
this.ref = null;
}

function Item2(image, text, href, frame, length, spacing, target) {
this.image = image + ' alt="' + text + '" name="' + text + '"></td>';
this.text = text;
this.href = href;
this.frame = frame;

if(length > 2) {
  this.length = heightL1 * (1.6 + (length-2)*0.7);
} else if(length > 1) {
  this.length = heightL1 * 1.6;
} else {
  this.length = length * heightL1;  
}

this.spacing = spacing;
this.target = target;
this.ref = null;
}

function moveRoot()
{
 with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
}

function clickHandle(evt)
{
 if (isNS4xx) document.routeEvent(evt);
 hideAllBut(0);
}
