// check browser version
NS4 = (document.layers) ? 1 : 0;
var delay           = 500; /////
var active_layer_id = -1;  /////
var on_layer_id     = -1;  /////
var buff_id         = -1;  /////

function layer_enter (id)
{
	on_layer_id = id;
}

function layer_exit (id)
{
	on_layer_id = - 1;
	setTimeout ('hide('+ id +')', delay);
}

function menu_enter (id)
{
//alert ("Menu Enter = " + id + "Buff = " + buff_id);
	if (buff_id >= 0)
		hide (buff_id);
	show(id);
	active_layer_id = id;
}

function menu_exit (id)
{
//alert ("Exit ID = " + id + "D = " + delay);
	setTimeout ('hide ('+ id +')', delay);
	buff_id = active_layer_id;
	active_layer_id = -1;

}

function show (id)
{
    if (!NS4){
        if(document.all['Menu' + id]){
            document.all['Menu' + id].style.visibility = "visible";
        }
    }
    else{
        if (document.layers[id]){
            document.layers[id].visibility = "visible";
        }
    }
}

function hide (id)
{
//alert ("Hide ID = " + id); 
   if (active_layer_id != id && on_layer_id != id){
        if (!NS4){
            if(document.all['Menu' + id]){
                document.all['Menu' + id].style.visibility = "hidden";
            }
        }
        else{
            if (document.layers[id]){
	            document.layers[id].visibility = "hide";
            }
        }
    }
}

function generate_layers ()
{
    for (i = 0; i < menu_content.length; i++)
//    alert ("Generate Layers & I = " + i);
    {
        elements = menu_content[i].split (/\s*\|\s*/);
        layer_body = '';
        menu_width = elements[0]*1;
        change = elements[1];
            for (j = 2; j < elements.length; j++) {
                layer_body += "<b>"+elements[j]+"</b>";
                layer_body += '<br>';
            }
            if (!NS4)
                layer_header = '<div id=Menu' + i +
                               ' onMouseOver="layer_enter (' + i + ');" onMouseOut = "layer_exit (' + i + ');"' +
                               ' style="visibility: hidden; position: absolute; left: ' + (left_corner_x) +
                               '; top: ' + left_corner_y + ';">';
            else
                 layer_header = '<layer id=' + i +
                               ' onMouseOver="layer_enter (' + i + ');" onMouseOut = "layer_exit (' + i + ');"' +
                               ' visibility=hide left=' + (left_corner_x) +
                               ' top = ' + left_corner_y + '>';

            layer_header += '<table width=' + menu_width + ' cellpadding=0 cellspacing=0 border = 0>' +
                            '<td bgcolor=' + border_color + '><table width=' + menu_width + ' cellpadding=3 ' +
                            'cellspacing=' + border_size + ' border=0><td class = menuText height = 20 width=' + menu_width + ' bgcolor=' + back_color + '>';
            

            layer_footer = '</b></font></td></table></td></table>';
            if (!NS4)
                layer_footer += '</div>';
            else
                layer_footer += '</layer>';
            document.writeln (layer_header + layer_body + layer_footer);




            x =parseInt(change);
            left_corner_x = left_corner_x + x;
            //alert ("Change = " + x + " && Left = " + left_corner_x );
        }
        if (!NS4) {
            area_map_1 =   '<map name = "Map1">' +
              '<area shape="rect" coords="40,100,140,120" onMouseOver = "menu_enter (0);" onMouseOut = "menu_exit (0);">' +
              '<area shape="rect" coords="145,100,267,120" onmouseover = "menu_enter (1);"  onmouseout = "menu_exit (1);">' +
              '<area shape="rect" coords="272,100,331,120" onmouseover = "menu_enter (2);"  onmouseout = "menu_exit (2);">' +
              '<area shape="rect" coords="336,100,490,120" href = "http://www.adpc.ca/pdf/Schedule of Fees 2008.pdf" target = new>' +
              '<area shape="rect" coords="495,100,575,120" onmouseover = "menu_enter (3);"  onmouseout = "menu_exit (3);">' +
              '<area shape="rect" coords="580,100,652,120" onmouseover = "menu_enter (4);"  onmouseout = "menu_exit (4);">' +
              '<area shape="rect" coords="657,100,760,120" onmouseover = "menu_enter (5);"  onmouseout = "menu_exit (5);">' +
              '<area shape="rect" coords="453,83,547,95" href = "http://www.annapolisroyal.com" target = new>' +
              '<area shape="rect" coords="576,83,648,95" href = "http://www.town.bridgetown.ns.ca" target = new>' +
              '<area shape="rect" coords="677,83,740,95" href = "http://www.town.middleton.ns.ca" target = new>' +
            '</map>';
            area_map_2 =   '<MAP NAME = "Map2">' +
              '<AREA SHAPE="RECT" HREF="ann_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="ann_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_3 =   '<map name = "Map3">' +
              '<area shape="rect" coords="40,100,140,120" onMouseOver = "menu_enter (0);" onMouseOut = "menu_exit (0);">' +
              '<area shape="rect" coords="145,100,267,120" onmouseover = "menu_enter (1);"  onmouseout = "menu_exit (1);">' +
              '<area shape="rect" coords="272,100,331,120" onmouseover = "menu_enter (2);"  onmouseout = "menu_exit (2);">' +
              '<area shape="rect" coords="336,100,490,120" href = "http://www.adpc.ca/pdf/Schedule of Fees 2008.pdf" target = new>' +
              '<area shape="rect" coords="495,100,575,120" onmouseover = "menu_enter (3);"  onmouseout = "menu_exit (3);">' +
              '<area shape="rect" coords="580,100,652,120" onmouseover = "menu_enter (4);"  onmouseout = "menu_exit (4);">' +
              '<area shape="rect" coords="657,100,760,120" onmouseover = "menu_enter (5);"  onmouseout = "menu_exit (5);">' +
              '<area shape="rect" coords="453,83,547,95" href = "http://www.annapolisroyal.com" target = new>' +
              '<area shape="rect" coords="576,83,648,95" href = "http://www.town.bridgetown.ns.ca" target = new>' +
              '<area shape="rect" coords="677,83,740,95" href = "http://www.town.middleton.ns.ca" target = new>' +
              //'<area shape="rect" coords="565,143,670,153" href = "mailto:adpcadmin at adpc dot ca">' +
              '<area shape="rect" coords="695,125,755,152" href = "home.htm">' +
            '</map>';
            area_map_4 =   '<MAP NAME = "Map4">' +
              '<AREA SHAPE="RECT" HREF="bri_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="bri_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_5 =   '<MAP NAME = "Map5">' +
              '<AREA SHAPE="RECT" HREF="mid_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="mid_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_6 =   '<map name = "Map6">' +
              //'<area shape="rect" coords="0,240,160,260" href = "mailto:roger at adpc dot ca">' +
              //'<area shape="rect" coords="0,310,160,330" href = "mailto:wilbert at adpc dot ca">' +
              //'<area shape="rect" coords="0,380,160,400" href = "mailto:tech at adpc dot ca">' +
              //'<area shape="rect" coords="0,140,160,160" href = "mailto:adpcadmin at adpc dot ca">' +
              '<area shape="rect" coords="0,420,160,460" href = "location.htm">' +
            '</map>';
            area_map_7 =   '<map name = "Map7">' +
              //'<area shape="rect" coords="0,240,160,260" href = "mailto:roger at adpc dot ca">' +
              //'<area shape="rect" coords="0,310,160,330" href = "mailto:wilbert at adpc dot ca">' +
              //'<area shape="rect" coords="0,380,160,400" href = "mailto:tech at adpc dot ca">' +
              //'<area shape="rect" coords="0,140,160,160" href = "mailto:adpcadmin at adpc dot ca">' +
              '<area shape="rect" coords="0,420,160,460" href = "home.htm">' +
            '</map>';
        } else {
            area_map_1 =   '<map name = "Map1">' +
              '<area shape="rect" coords="40,100,140,120" href = "welcome.htm" onMouseOver = "menu_enter (0);" onMouseOut = "menu_exit (0);">' +
              '<area shape="rect" coords="145,100,267,120" href = "welcome.htm" onmouseover = "menu_enter (1);"  onmouseout = "menu_exit (1);">' +
              '<area shape="rect" coords="272,100,331,120" href = "welcome.htm" onmouseover = "menu_enter (2);"  onmouseout = "menu_exit (2);">' +
              '<area shape="rect" coords="336,100,490,120" href = "http://www.adpc.ca/pdf/Schedule of Fees 2008.pdf" target = new>' +
              '<area shape="rect" coords="495,100,575,120" href = "ann_open.htm" onmouseover = "menu_enter (3);"  onmouseout = "menu_exit (3);">' +
              '<area shape="rect" coords="580,100,652,120" href = "ann_maps_index.htm" onmouseover = "menu_enter (4);"  onmouseout = "menu_exit (4);">' +
              '<area shape="rect" coords="657,100,760,120" href = "click_home.htm" onmouseover = "menu_enter (5);"  onmouseout = "menu_exit (5);">' +
              '<area shape="rect" coords="453,83,547,95" href = "http://www.annapolisroyal.com" target = new>' +
              '<area shape="rect" coords="576,83,648,95" href = "http://www.town.bridgetown.ns.ca" target = new>' +
              '<area shape="rect" coords="677,83,740,95" href = "http://www.town.middleton.ns.ca" target = new>' +
            '</map>';
            area_map_2 =   '<MAP NAME = "Map2">' +
              '<AREA SHAPE="RECT" HREF="ann_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="ann_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_3 =   '<map name = "Map3">' +
              '<area shape="rect" coords="40,100,140,120" href = "welcome.htm" onMouseOver = "menu_enter (0);" onMouseOut = "menu_exit (0);">' +
              '<area shape="rect" coords="145,100,267,120" href = "welcome.htm" onmouseover = "menu_enter (1);"  onmouseout = "menu_exit (1);">' +
              '<area shape="rect" coords="272,100,331,120" href = "welcome.htm" onmouseover = "menu_enter (2);"  onmouseout = "menu_exit (2);">' +
              '<area shape="rect" coords="336,100,490,120" href = "http://www.adpc.ca/pdf/Schedule of Fees 2008.pdf" target = new>' +
              '<area shape="rect" coords="495,100,575,120" href = "ann_open.htm" onmouseover = "menu_enter (3);"  onmouseout = "menu_exit (3);">' +
              '<area shape="rect" coords="580,100,652,120" href = "ann_maps_index.htm" onmouseover = "menu_enter (4);"  onmouseout = "menu_exit (4);">' +
              '<area shape="rect" coords="657,100,760,120" href = "click_home.htm" onmouseover = "menu_enter (5);"  onmouseout = "menu_exit (5);">' +
              '<area shape="rect" coords="453,83,547,95" href = "http://www.annapolisroyal.com" target = new>' +
              '<area shape="rect" coords="576,83,648,95" href = "http://www.town.bridgetown.ns.ca" target = new>' +
              '<area shape="rect" coords="677,83,740,95" href = "http://www.town.middleton.ns.ca" target = new>' +
              //'<area shape="rect" coords="565,143,670,153" href = "mailto:adpcadmin@adpc.ca">' +
              '<area shape="rect" coords="695,125,755,152" href = "home.htm">' +
            '</map>';
            area_map_4 =   '<MAP NAME = "Map4">' +
              '<AREA SHAPE="RECT" HREF="bri_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="bri_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_5 =   '<MAP NAME = "Map5">' +
              '<AREA SHAPE="RECT" HREF="mid_lub_toc.htm"  COORDS="180,105,383,167">' +
              '<AREA SHAPE="RECT" HREF="mid_mps_toc.htm"  COORDS="0,1,233,98">' +
            '</MAP>';
            area_map_6 =   '<map name = "Map6">' +
              //'<area shape="rect" coords="0,240,160,260" href = "mailto:roger at adpc dot ca">' +
              //'<area shape="rect" coords="0,310,160,330" href = "mailto:wilbert at adpc dot ca">' +
              //'<area shape="rect" coords="0,380,160,400" href = "mailto:tech at adpc dot ca">' +
              //'<area shape="rect" coords="0,140,160,160" href = "mailto:adpcadmin at adpc dot ca">' +
              '<area shape="rect" coords="0,420,160,460" href = "location.htm">' +
            '</map>';
            area_map_7 =   '<map name = "Map7">' +
              //'<area shape="rect" coords="0,240,160,260" href = "mailto:roger at adpc dot ca">' +
              //'<area shape="rect" coords="0,310,160,330" href = "mailto:wilbert at adpc dot ca">' +
              //'<area shape="rect" coords="0,380,160,400" href = "mailto:tech at adpc dot ca">' +
              //'<area shape="rect" coords="0,140,160,160" href = "mailto:adpcadmin at adpc dot ca">' +
              '<area shape="rect" coords="0,420,160,460" href = "home.htm">' +
            '</map>';
        }
        document.writeln (area_map_1);
        document.writeln (area_map_2);
        document.writeln (area_map_3);
        document.writeln (area_map_4);
        document.writeln (area_map_5);
        document.writeln (area_map_6);
        document.writeln (area_map_7);
}
generate_layers ();

/******************************************************************************
 * Functions developed for the ADPC web site forms.
 *
 * Larry Bent
 * January, 2003
 *
******************************************************************************/
function direct() {
//  var newURL = window.navigate("http://www.paradiseconsuting.com/adpc/intro.htm");
  var newURL = "http://www.paradiseconsuting.com/adpc/intro.htm";
  alert ("Here = " + newURL );
  document.write(newURL);
}

