var i;

var menuBulk = new Array;
menuBulk[0] = '<a class="revealMenu" href="http://www.crowninn-tisbury.co.uk">The Crown Inn</a>';
menuBulk[1] = '<a class="revealMenu" href="http://www.palladiostone.com">Palladio Stone</a>';
menuBulk[2] = '<a class="revealMenu" href="http://www.tjs-servicecentre.co.uk">TJS Service Centre</a>';
menuBulk[3] = '<a class="revealMenu" href="http://www.summerleazegallery.co.uk">Summerleaze Gallery</a>';
menuBulk[4] = '<a class="revealMenu" href="http://www.tilleard.co.uk">Robert Tilleard</a>';
menuBulk[5] = '<a class="revealMenu" href="http://www.comptonmarbling.co.uk">Compton Marbling</a>';
//menuBulk[7] = '<a class="revealMenu" href="http://91.85.206.65/SurreyAssociates">SurreyAssociatesDemo</a>';
//menuBulk[6] = '<a class="revealMenu" href="http://www.surreyassociates.co.uk">Surrey Associates</a>';
//menuBulk[7] = '<a class="revealMenu" href="http://www.freewebs.com/website-evaluation">Nadder Valley Demo</a>';
//menuBulk[6] = '<a class="revealMenu" href="http://www.teamswork.co.uk">TeamsWork</a>';
menuBulk[6] = '<a class="revealMenu" href="http://www.surreyassociates.co.uk">Surrey Associates</a>';
menuBulk[7] = '<a class="revealMenu" href="http://www.westgarth.eclipse.co.uk">Cicek Villa Demo</a>';


var menuString = '<div style="position:relative;float:left" onMouseOver="revealSubMenu(0)" onMouseOut="hideSubMenu(0)">\n';
menuString += '<span class="flourish">MENU</span>\n';
menuString += '<div id="subMenu1" class="revealMenu">\n';
menuString += '<img src="images/gap.gif" /><br />\n';
for(i = 0; i < menuBulk.length;i++)
{
  menuString += menuBulk[i];
  menuString += "\n";
}
menuString += '<img src="images/flourish2.gif" />\n';
menuString += '</div>\n</div>';

var menuInstance = new Array();
var ie5  = (document.all && document.getElementById);
function startUpMenu()
{
  
  menuInstance[0] = new populateObject("subMenu1",0,(5 + ((menuBulk.length+1) * 20)),0,0,4);
  menuInstance[1] = new populateObject("subMenu2",0,65,0,0,4);
  countId = setInterval("countDown()", 10);
}
function populateObject(ident,currentPos,targetPos,active,count,direction)
{
  this.ident = ident;
  this.currentPos = currentPos;
  this.targetPos = targetPos;
  this.active = active;
  this.count = count;
  this.direction = direction;
}
function buildMenu()
{
document.write(menuString);
}
function revealSubMenu(id)
{

  menuInstance[id].active = 1;
  if(ie5)
    document.getElementById(menuInstance[id].ident).filters.alpha.opacity = 100;
  else
    document.getElementById(menuInstance[id].ident).style.opacity = 1.0;
  document.getElementById(menuInstance[id].ident).style.visibility = "visible";
}
function hideSubMenu(id)
{
  menuInstance[id].active = 2;
}
function countDown()
{
  for(i = 0;i < menuInstance.length; i++)
  {
    switch(menuInstance[i].active)
    {
      case 0:
      break;
      case 1:
      menuInstance[i].currentPos += menuInstance[i].direction;
      if(menuInstance[i].currentPos >= menuInstance[i].targetPos)
      {

        menuInstance[i].currentPos = menuInstance[i].targetPos;
        menuInstance[i].active = 0;
      }
      document.getElementById(menuInstance[i].ident).style.clip = "rect(0px 120px " + menuInstance[i].currentPos +"px 0px)";
      break;
      case 2:
      menuInstance[i].currentPos -= menuInstance[i].direction;
      if(menuInstance[i].currentPos <= 0)
      {
        if(ie5)
          document.getElementById(menuInstance[i].ident).filters.alpha.opacity = 0;
        else
          document.getElementById(menuInstance[i].ident).style.opacity = 0.0;
        document.getElementById(menuInstance[i].ident).style.visibility = "hidden";
        menuInstance[i].currentPos = 0;
        menuInstance[i].active = 0;
      }
      document.getElementById(menuInstance[i].ident).style.clip = "rect(0px 120px " + menuInstance[i].currentPos +"px 0px)";
      break;
    }
  }
}
