if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function
(where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function
(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function
(where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
  // MENU SECTION
  //
  // Description:       Horizontal Menu Matrix
  // Version:           1.0.0
  // Author:            David Clark
  //
  // NOTES:
  // - copy and paste arrays to create more menus and also adjust totalmenus value to compensate
  // - adjust menutop to equal menubar width
  // - change menu.size to 0 to disable menu creation
///////////////////////////////////////////////////////////////////////////////////////////////////////

  var menutop = 18;

  var offsetLeft = 0;
  var offsetTop = 0;

  var totalmenus = 7;
  var menubarhtml = '';
  var menuhtml = '';
  var menu = new makeArray(totalmenus);

  menu[0] = new menuObject(4,'ABOUT US','about_us.htm');
  menu[0].menuCell[0] = new menuCellObject('Who We Are','about_us.htm#1');
  menu[0].menuCell[1] = new menuCellObject('Meet Our Staff','about_us.htm#2');
  menu[0].menuCell[2] = new menuCellObject('Awards','about_us.htm#3');
  menu[0].menuCell[3] = new menuCellObject('Testimonials','about_us.htm#4');
  menu[1] = new menuObject(0,'SERVICES','services.htm');
  menu[1].menuCell[0] = new menuCellObject('Option 1','services.htm#');
  menu[1].menuCell[1] = new menuCellObject('Option 2','services.htm#');
  menu[2] = new menuObject(5,'POOLS','pools.htm');
  menu[2].menuCell[0] = new menuCellObject('Products / Accessories','pools.htm#1');
  menu[2].menuCell[1] = new menuCellObject('Maintenance','pools.htm#2');
  menu[2].menuCell[2] = new menuCellObject('San Juan Fiberglass Pools','pools_sanjuan.htm');
  menu[2].menuCell[3] = new menuCellObject('Eternity Swimming Pools','pools_eternity.htm');
  menu[2].menuCell[4] = new menuCellObject('Generation Swimming Pools','pools_generation.htm');  
  menu[3] = new menuObject(0,'SAUNAS','saunas.htm');
  menu[3].menuCell[0] = new menuCellObject('Option 1','saunas.htm#');
  menu[3].menuCell[1] = new menuCellObject('Option 2','saunas.htm#');
  menu[4] = new menuObject(19,'HOT TUBS','hot_tubs.htm');
  menu[4].menuCell[0] = new menuCellObject('Products / Accessories','hot_tubs.htm#1');
  menu[4].menuCell[1] = new menuCellObject('Benefits / Maintenance','hot_tubs.htm#2');
  menu[4].menuCell[2] = new menuCellObject('<u>SELF-CLEANING</u>: Features','selfclean_sf.htm');
  menu[4].menuCell[3] = new menuCellObject('2-3 Persons','selfclean_23.htm');
  menu[4].menuCell[4] = new menuCellObject('4-5 Persons','selfclean_45.htm');
  menu[4].menuCell[5] = new menuCellObject('5-6 Persons','selfclean_56.htm');
  menu[4].menuCell[6] = new menuCellObject('6-8 Persons','selfclean_68.htm');
  menu[4].menuCell[7] = new menuCellObject('8-10 Persons','selfclean_810.htm');
  menu[4].menuCell[8] = new menuCellObject('Planning','selfclean_plan.htm');
  menu[4].menuCell[9] = new menuCellObject('<u>SERENITY</u>: Features','serenity_sf.htm');
  menu[4].menuCell[10] = new menuCellObject('2-3 Persons','serenity_23.htm');
  menu[4].menuCell[11] = new menuCellObject('4-5 Persons','serenity_45.htm');
  menu[4].menuCell[12] = new menuCellObject('5-6 Persons','serenity_56.htm');
  menu[4].menuCell[13] = new menuCellObject('6-8 Persons','serenity_68.htm');
  menu[4].menuCell[14] = new menuCellObject('Planning','serenity_plan.htm');
  menu[4].menuCell[15] = new menuCellObject('<u>SWIM SPAS</u>: Aquaplay','swimspas_ap.htm');
  menu[4].menuCell[16] = new menuCellObject('Aquatrainer','swimspas_at.htm');
  menu[4].menuCell[17] = new menuCellObject('Planning','swimspas_plan.htm');
  menu[4].menuCell[18] = new menuCellObject('<u>RENTALS</u>: OMNI Hot Tubs','hottub_omni.htm');
  menu[5] = new menuObject(0,'PROMOTIONS','promotions.htm');
  menu[5].menuCell[0] = new menuCellObject('Option 1','promotions.htm#');
  menu[5].menuCell[1] = new menuCellObject('Option 2','promotions.htm#');
  menu[6] = new menuObject(0,'CONTACT US','contact_us.htm');
  menu[6].menuCell[0] = new menuCellObject('Option 1','contact_us.htm#');
  menu[6].menuCell[1] = new menuCellObject('Option 2','contact_us.htm#');

  function makeArray(n)
  {
    this.size = n;
    for(i=0; i<n; i++)
    {
      this[i] = 0;
    }
    return(this);
  }
  function menuObject(n,menuTitle,menuURL)
  {
    this.size = n;
    this.menuTitle = menuTitle;
    this.menuURL = menuURL;
    this.menuCell = new makeArray(n);
  }
  function menuCellObject(menuCellTitle,menuCellURL)
  {
    this.menuCellTitle =  menuCellTitle;
    this.menuCellURL = menuCellURL;
  }
  function createMenus()
  {
    menubarhtml += '<div id="MENUBAR">';
    for(a=0;a<totalmenus;a++)
    {
      menubarhtml += '<span class="MENUBARCELL" id="' + 'MENUBARCELL_' + a + '\"';
      menubarhtml += ' onClick="hrefLink(\'' + menu[a].menuURL + '\');"';
      menubarhtml += ' onmouseOver="linkOver(this,\'' + menu[a].menuURL + '\');';
      menubarhtml += 'showMenu(\'MENU_' + a + '\',\'MENUBARCELL_' + a + '\');"';
      menubarhtml += ' onmouseOut="linkOut(this);hideMenu(\'MENU_' + a + '\');"';
      menubarhtml += '>' + menu[a].menuTitle + '</span>';
    }
    menubarhtml += '</div>';
    if((menubarhtml)&&(menubarhtml!=''))
    {
      window.document.getElementById("SECTION02").insertAdjacentHTML("afterBegin",menubarhtml);
    }
    for(b=0;b<totalmenus;b++)
    {
      if(menu.size != 0)
      {
      menuhtml += '<div id="MENU_' + b + '\"';
      menuhtml += ' onmouseOver="showMenu(\'MENU_' + b + '\',\'MENUBARCELL_' + b + '\');"';
      menuhtml += ' onmouseOut="hideMenu(\'MENU_' + b + '\');"' + '>';
      for(c=0;c<menu[b].size;c++)
      {
        menuhtml += '<div class="MENUCELL" id="MENU_' + b + '_' + c + '\"';
        menuhtml += ' onClick="hrefLink(\'' + menu[b].menuCell[c].menuCellURL + '\');"';
        menuhtml += ' onmouseOver="linkOver(this,\'' + menu[b].menuCell[c].menuCellURL + '\');"';
        menuhtml += ' onmouseOut="linkOut(this);"';
        menuhtml += '>' + menu[b].menuCell[c].menuCellTitle + '</div>';
      }
      menuhtml += '</div>';
      }
    }
    if((menuhtml)&&(menuhtml!=''))
    {
      window.document.body.insertAdjacentHTML("afterBegin",menuhtml);
    }
  }
  function showMenu(tId,mbId)
  {
    getElementPosition(mbId);
    window.document.all(tId).style.left = offsetLeft
    window.document.all(tId).style.top = offsetTop + menutop
    window.document.all(tId).style.visibility = "visible"
    offsetLeft = 0;
    offsetTop = 0;
  }
  function hideMenu(tId)
  {
    offsetLeft = 0;
    offsetTop = 0;
    window.document.all(tId).style.left = offsetLeft
    window.document.all(tId).style.top = offsetTop
    window.document.all(tId).style.visibility = "hidden"
  }
  function getElementPosition(elemID)
  {
    var offsetTrail = document.getElementById(elemID);
    while(offsetTrail)
    {
      offsetLeft += offsetTrail.offsetLeft;
      offsetTop += offsetTrail.offsetTop;
      offsetTrail = offsetTrail.offsetParent;
    }
  }
  function linkOver(link,URLId)
  {
    link.style.backgroundColor = "#9CCE63"
    link.style.cursor = "pointer"
    if(URLId != "")
    {
      window.status = URLId
    }
  }
  function linkOut(link,tId)
  {
    link.style.backgroundColor = "#00529C"
    link.style.cursor = "auto"
    window.status = ""
  }
  function hrefLink(URLId)
  {
    if(URLId != "")
    {
      window.location.href = URLId
    }
  }
///////////////////////////////////////////////////////////////////////////////////////////////////////