//{{{ 1k DHTML API
d=document;ts=2;ti=60;px='px'
var browser = navigator.appName;var ie = browser.indexOf("Microsoft") > -1 ? true : false;
var op =  browser.indexOf("pera") > -1 ? true : false;
var platform = navigator.platform;var mac = platform.indexOf("ac") > -1 ? true : false;
function gE(e,f){return d.getElementById(e);}
function sE(e){e.style.visibility='visible';}
function hE(e){e.style.visibility='hidden';}
function sZ(e,z){e.style.zIndex=z;}
function sX(e,x){e.style.left=x+'px';}
function sY(e,y){e.style.top=y+'px';}
function sW(e,w){e.style.width=w+'px';}
function sH(e,h){e.style.height=h+'px';}
function sC(e,t,r,b,x){e.style.clip='rect('+t+px+' '+r+px+' '+b+px+' '+x+px+')';}
function gX(e){var x=e.offsetLeft;var op=e.offsetParent;while(op!=null){x+=op.offsetLeft;op=op.offsetParent;}return x;}
function gY(e){var y=e.offsetTop;var op=e.offsetParent;while(op!=null){y+=op.offsetTop;op=op.offsetParent;}return y;}
//function gY(e){return e.offsetTop;}
function wH(e,h){e.innerHTML=h;}
function gW(e){return e.offsetWidth}
//function gW(e){return e.style.width;}
function gH(e){return e.offsetHeight}
function gpX(e){var x=e.offsetLeft;var ep=e.offsetParent;while(ep!=null){x+=ep.offsetLeft;op=ep.offsetParent;}return x;}
function gpY(e){var y=e.offsetTop;var ep=e.offsetParent;while(ep!=null){y+=ep.offsetTop;ep=ep.offsetParent;}return y;}
// my extensions
function gcH(e){var h = (ie && mac) ? e.offsetHeight : e.scrollHeight; return h;}
function gsT()
{
  var sT=(ie && mac)? d.body.scrollTop : ie ? d.documentElement.scrollTop : d.body.scrollTop;
  return sT;
}
function gwH()
{
  var wH=(ie && mac) ? d.body.clientHeight : ie ? d.documentElement.clientHeight : self.innerHeight;
  return wH;
}
function gwW()
{
  var wW=(ie && mac) ? d.body.clientWidth : ie ? d.documentElement.clientWidth : self.innerWidth;
  return wW;
}
function gbH()
{
  //var bH=(ie && mac) ? d.body.clientHeight : ie ? d.documentElement.clientHeight : d.body.clientHeight;
  var bH=(ie && mac) ? d.body.clientHeight : ie ? d.documentElement.clientHeight : self.innerHeight;
  return bH;
}
function gbW()
{
  //var bW=(ie && mac) ? d.body.clientWidth : ie ? d.documentElement.clientWidth : d.body.clientWidth;
  var bW=(ie && mac) ? d.body.clientWidth : ie ? d.documentElement.clientWidth : self.innerWidth;
  return bW;
}
function sS(e,sprop,svalue)
{
  eval("e.style." + sprop + "='" + svalue + "'");
}
// greg bells' create element extension (modified)
function cE(i,s)
{
  var X='<div';X=i?X+' id="'+i+'"':X;X=s?X+' style="'+s+'"':X;X+='>';
  var Y=d.createElement("DIV");
  if(Y){Y.innerHTML=X;d.body.appendChild(Y);Y = gE(i);}
  return Y;
}
function cN(e,i,s)
{
  var X='<div';X=i?X+' id="'+i+'"':X;X=s?X+' style="'+s+'"':X;X+='>';
  var Y=d.createElement("DIV");
  if(Y){Y.innerHTML=X;e.appendChild(Y);Y = gE(i);}
  return Y;
}
// end of API
//}}}

//{{{ menu dropdown stuff

// holding tank for the last header item turned on
var lastTopItem = null;

// holding tank for the last top menu turned on
var lastTopMenu = null;

// holding tank for the last submenu turned on
var lastSubMenu = null;

// holding tank for the last menu item that had a submenu
lastMenuItem = null;

// the name of the last submenu turned on
var lsman = "";

// holding tank for the last menu itme turned on
var lmi = null;

// the height of the menu bars
var menuHeight = 16;

// the width of a menu item
var menuWidth = 160;

// the background color when a menu header is turned on
var menuOnBackground = "#fff";

// the background color when a menu item is turned off
var menuOffBackground = "transparent";

// a holding tank for the menu timer object
var menuTimer = null;

// do all the dropdown navigation startup stuff
function navStart(navElement) {
  //alert("here");
  var header = gE(navElement);
  // get all the links in the header uls
  var huls = header.getElementsByTagName("ul");
  for(var huli = 0; huli < huls.length; huli++) {
    var hul = huls[huli];
    var lis = hul.getElementsByTagName("a");
    for(var lii = 0; lii < lis.length; lii++) {
      var li = lis[lii];
      // attach the display handlers to it
      li.onmouseover = menuOn;
      li.onmouseout = setMenuTimer;
      // see if it has a menu and process the menu items if it does
      var menuName = li.getAttribute("menu");
      if(menuName != null) {
        var dd = gE(menuName);
        if(dd != null) {
          //alert(menuName);
          dd.onmouseover = clearMenuTimer;
          dd.onmouseout = setMenuTimer;
          // go through this menu and look for submenus
          var mls = dd.getElementsByTagName("a");
          for(var mli = 0; mli < mls.length; mli++) {
            var sml = mls[mli];
            sml.onmouseover = subMenuOn;
            var subMenuName = sml.getAttribute("submenu");
            if(subMenuName != null) {
              var subMenu = gE(subMenuName);
              if(subMenu != null) {
                // set the mouse actions on the submenu
                subMenu.onmouseover = clearMenuTimer;
                subMenu.onmouseout = setMenuTimer;
              }
            }
          } // end of submenu loop
        } // end of check for a valid menu item
      } // end of check for a menu name
    } // end of header ul link processing loop

  } // end of header ul loop

}// end of navStart() function

// this function changes the background color of a top-level
//  menu item to the appropriate and turns on the submenu dropdown at
//  the same time. It also turns off any menus that may
//  be on before it does anything else
function menuOn(event)
{
  // turn off the menu timer
  //clearMenuTimer();
  // turn off any previously displayed menus
  //alert("on");
  hideMenus();

  var smn = this.getAttribute("menu");
  //alert("menu " + smn);
  //if we've gone to a new menu, do some stuff
  if(smn != null)
  {
    // set the background color of the header and save
    //  the header for turning it off later
    lastTopItem = this;
    lastTopItem.style.background = menuOnBackground;
    lastTopItem.style.color = "#333";
    // get the position of the header to position the dropdown
    var mx = gX(this);
    mx = ie ? mx + 2 : mx;
    var my = gY(this);
    var sme = gE(smn);
    sX(sme,mx);
    sY(sme,my + menuHeight);
    sE(sme);
    lastTopMenu = sme;
    //alert("on");
  }
} // end of function menuOn()

//turn a submenu on
function subMenuOn() {
  // if there is a submenu visible, turn it off
  if(lastSubMenu != null) {
    hE(lastSubMenu);
    lastSubMenu = null;
    // if there is a menu item that turned on the submenu
    //  change it's color and background color
    if(lastMenuItem != null) {
      lastMenuItem.style.color = "#333";
      lastMenuItem.style.background = "#fff";
    }
  }
  clearMenuTimer();
  // see if this menu item has a submenu and turn
  //  it on if it does
  var smn = this.getAttribute("submenu");
  if(smn != null) {
    // get the position of the item to position the submenu
    var mx = gX(this);
    mx = ie ? mx + 2 : mx;
    mx += menuWidth;
    var my = gY(this);
    var sme = gE(smn);
    sX(sme,mx);
    sY(sme,my);
    sE(sme);
    lastSubMenu = sme;
    // change the stye of this item and save
    //  it for later
    lastMenuItem = this;
    this.style.background = "#ED2027";
    this.style.color = "#fff";
  }
}

// clears the menu turn-off timer
function clearMenuTimer(){
  clearInterval(menuTimer);
}

// turn all the navigation menus off
function hideMenus()
{
  if(lastTopItem != null ) {
    lastTopItem.style.background = menuOffBackground;
    lastTopItem.style.color = "#333";
    lastTopItem = null;
  }
  if(lastSubMenu != null)
  {
    hE(lastSubMenu);
    lastSubMenu = null;
  }
  if(lastMenuItem != null) {
    lastMenuItem.style.color = "#333";
    lastMenuItem.style.background = "#fff";
  }
  if(lastTopMenu != null)
  {
    hE(lastTopMenu);
    lastTopMenu = null;
  }
  clearMenuTimer();
} // end of hideMenus() function

// sets a timer to turn off the menus
function setMenuTimer(){
  menuTimer = setInterval(hideMenus,250);
}
//}}}


//{{{ playVideo stuff
function playVideo(clipName){
    var clipFileName = clipName + ".html";
    //alert(clipFileName);
    var pw = window.open(clipFileName,"Video clip","width=400,height=350");
}
//}}}
// jEdit folding commands
// :folding=explicit:collapseFolds=1
//


