/*

This is a very handy function written by Simon Willison:
http://simon.incutio.com/archive/2004/05/26/addLoadEvent

It allows you to queue up a whole series of events to be triggered when the document loads.

If you simply use window.onload = func, then you run the risk of overwriting existing functions that are supposed to run when the onload event is triggered.

*/

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}



/*----------------------------------------------------------*/



function show(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=50; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}



function showall(id) {
var d = document.getElementById(id);
	for (var i = 30; i<=50; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='block';}
	}
if (d) {d.style.display='block';}
}


/*----------------------------------------------------------*/

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Chris Heilmann :: http://www.alistapart.com/articles/tableruler */

function tableruler() {
  if (document.getElementById && document.createTextNode) {
    var tables=document.getElementsByTagName('table');
    for (var i=0;i<tables.length;i++)
    {
      if(tables[i].className=='ruler') {
        var trs=tables[i].getElementsByTagName('tr');
        for(var j=0;j<trs.length;j++)
        {
          if(trs[j].parentNode.nodeName=='TBODY') {
            trs[j].onmouseover=function(){this.className='ruled';return false}
            trs[j].onmouseout=function(){this.className='';return false}
          }
        }
      }
    }
  }
}


function doPopups() {
  if (!document.getElementsByTagName) return false;
  var links=document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("popup")) {
      links[i].onclick=function() {
        // Below - to open a full-sized window, just use: window.open(this.href);
        window.open(this.href, "", "top=20,left=20,width=532,height=532,");
        return false;
      }
    }
  }
}

/*----------------------------------------------------------*/


addLoadEvent(tableruler);
addLoadEvent(show);
addLoadEvent(doPopups);
