function isString(param) { return typeof(param)=="string" }
/**
 * Shorthand for document.getElementById($id)
 */
function $($id) {
  return (isString($id)) ? document.getElementById($id) : $id;
}

var menu_arr = new Array(35)
for (i=0; i<35; i++){
	menu_arr[i] = "day"+i;
}
/*menu_arr[0][1] = "";
menu_arr[1][1] = "";
menu_arr[2][1] = addEvents(2, "SC Morning Tennis", "#") + addEvents(2, "SC Morning Tennis 2", "#");*/


function addEvents(no, content, url){
	var items ="<li><table border='0' cellpadding='0' cellspacing='0'><tr><td valign='top' width='5'>- </td><td><a href=\""+ url +"\" onMouseOver=\"subMenu.showPopup("+ no +");hideOthers("+ no +");\" onMouseOut=\"subMenu.hidePopup("+ no +");\">"+ content +"</a></td></tr></table></li>";
	return(items);
}

var subMenu = {
  timeout : null,
  showPopup : function( index ){
    // Show this
    $obj=$(menu_arr[index]);
    clearTimeout(this.timeout);
    if($obj.style.visibility == 'hidden')show($obj);
  },
  hidePopup : function( index ){
		clearTimeout(this.timeout);
		$hidemenu=$(menu_arr[index]);
		this.timeout = setTimeout(function(){hide($hidemenu);},3000);
	
  }
}

function hide($obj){$obj.style.visibility='hidden';}
function show($obj){
hideOthers($obj);
$obj.style.visibility='visible';
}
function hideOthers($obj){
	for (var i=0; i<menu_arr.length; i++){
		if (i!=$obj){
			$hidemenu=$(menu_arr[i]);
			hide($hidemenu);
			
		}
	}
}



function writeEvents(name, positiontop, positionleft, content){
	var events;
	events = "<div id=\""+ name +"\" style=\"visibility:hidden; padding:0px; position:absolute; z-index:100; left: "+ positionleft +"px; top: "+ positiontop +"px;\">";
	events += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\" class=\"calendar_desc\"><tr><td>";
	events += "<ul>";
	events += content;
	events += "</ul></td></tr></table></div>";
	
	document.write(events);

}