var jscomplete=0;
var dhtml=0;
if ((document.all)||(document.layers)) dhtml=1;

var layerName = new Array(5);
layerName[1] = "ipower";
layerName[2] = "ideas";
layerName[3] = "order";
layerName[4] = "contact";
layerName[5] = "seminar";

var TimeKeeper;

function swtch(menuName,state) {
	if (jscomplete == 1) {
		swtchlayer(menuName,state);
	}
}

function swtchlayer(whichLayer, state) {
	if (state)  {
	    clearTimeout(TimeKeeper);
	    hideparents(whichLayer);
	    showLayer(layerName[whichLayer]);
	}  else  {
	    clearTimeout(TimeKeeper);
	    TimeKeeper = setTimeout('hideparents(0)', 1000);
	}
}

function hideparents(exceptThis)  {
  if (exceptThis != 1) hideLayer(layerName[1]);
  if (exceptThis != 2) hideLayer(layerName[2]);
  if (exceptThis != 3) hideLayer(layerName[3]);
  if (exceptThis != 4) hideLayer(layerName[4]);
  if (exceptThis != 5) hideLayer(layerName[5]);
}

function hideLayer(name) {
  var layer = getLayer(name);
  if (document.layers)
    layer.visibility = "hide";
  if (document.all)
    layer.visibility = "hidden";
}

function showLayer(name) {
  var layer = getLayer(name);
  if (document.layers)
    layer.visibility = "show";
  if (document.all)
    layer.visibility = "visible";
}

function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {
  var layer = getLayer(name);
  if (document.layers) {
    layer.clip.left   = clipleft;
    layer.clip.top    = cliptop;
    layer.clip.right  = clipright;
    layer.clip.bottom = clipbottom;
  }
  if (document.all) {
    layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
  }
}

function getLayer(name) {
  if (document.layers) {
	return(document.layers[name]);
  } else if (document.all) {
    layer = eval('document.all.' + name + '.style');
    return(layer);
  }  else
    return(null);
}

function subroll(state) {
  if (state)  {
    clearTimeout(TimeKeeper);
  }  else  {
    clearTimeout(TimeKeeper);
    TimeKeeper = setTimeout('hideparents(0)', 2000);
  }
}

var layerList = new Array();

function createLayer(name, left, top, width, height, visible, content) {
  var i = layerList.length;
  var layer;

  layerList[i] = name;

  if (document.layers) {
    document.writeln('<layer name="' + name + '" left=' + left + ' top=' + top + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') + ' z-index=' + i + '>');
    document.writeln(content);
    document.writeln('</layer>');
    layer = getLayer(name);
    layer.width = width;
    layer.height = height;
  }

  if (document.all) {
    top+=8;
    document.writeln('<div id="' + name + '" style="position:absolute; overflow:none; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') + ' z-index:' + i + '">');
    document.writeln(content);
    document.writeln('</div>');
  }
  clipLayer(name, 0, 0, width, height);
}