// JavaScript Document

var timeout = null;
var timeout2 = null;
var objects = new Array('nfba', 'events', 'membership', 'bands', 'jam');

// this function shows the drop down menu passed
function showSubMenu(obj) {
  if (timeout != null) {
	clearTimeout(timeout);
	for (i = 0; i < objects.length; i++) {
	  delayMenuHide(objects[i]);
	}
  }
  var main_obj = findObj(obj).style;
  var sub_obj = findObj(obj + '_sub').style;
  main_obj.color = '#FFFFFF';
  sub_obj.visibility = 'visible';
}


// this function hides the menu after a half second delay
function hideSubMenu(obj) {
  timeout = setTimeout("delayMenuHide('" + obj + "')", 500);
}


// this is the function that actually hides the menu
function delayMenuHide(obj) {
  var main_obj = findObj(obj).style;
  var sub_obj = findObj(obj + '_sub').style;
  main_obj.color = '#CCCCCC';
  sub_obj.visibility = 'hidden';
}



function findObj(theObj, theDoc) {
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}



function showCal() {
  window.open('/events/calendar.php', 'calendar', 'status=1,menubar=1,scrollbars=1,width=900,height=625');	
}
