// JavaScript Document

var timeout = null;
var timeout2 = null;
var objects = new Array('personalities', 'news', 'promo_events', 'about', 'contact');

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


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


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



// this solves the problem of our drop down menu not covering
// over select menus
function selectMenuFix(showOrHide, delay) {
  if (delay == null) {
	delay = true;  
  }
  obj = findObj('s_type').style;
  if (showOrHide == 'show') {
	if (delay) {
	  timeout2 = setTimeout("obj.visibility = 'visible'", 500);
	}
	else {
	  obj.visibility = 'visible';
	}
  }
  else {
	if (timeout2 != null) {
	  clearTimeout(timeout2);	
	}
	obj.visibility = 'hidden';  
  }
}