var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
//var menu_opacity = (ie5 ? 75 : (ns6 ? 92 : 100));
var menu_opacity = 100;

var timer;
var visible_menu = '';
function start_timer() {
  timer = setTimeout("close_menu()", 350);
} // end function
function open_menu(menu_name) {
  if (visible_menu != menu_name) close_menu();
  if (timer) clearTimeout(timer);
  var mnu = document.getElementById(menu_name);
  if (mnu.style.display != 'block') {
	mnu.style.display = 'block';
	set_opacity(menu_name, menu_opacity);
    ifr = document.getElementById(menu_name+'_iframe');
	if (ifr) {
	  ifr.style.display = 'block';
	  set_opacity(menu_name+'_iframe', menu_opacity);
	  //window.status = 'setting iframe height to ' + ((mnu.clientHeight-21) + 'px');
	  ifr.style.height = (mnu.clientHeight-21) + 'px';
	  ifr.style.width = mnu.clientWidth + 'px';
	} // end if
	cell_name = menu_name + '_cell';
	visible_menu = menu_name;
  } // end if
  return true;
} // end function
function close_menu() {
  divs = document.getElementsByTagName("div");
  for (var i=0;i<divs.length;i++) {
    if (divs[i].id.indexOf("menu_") != -1) divs[i].style.display = 'none';
  } // next
  ifrs = document.getElementsByTagName("iframe");
  for (var i=0;i<ifrs.length;i++) {
    if (ifrs[i].id.indexOf("menu_") != -1) ifrs[i].style.display = 'none';
  } // next
  visible_menu = '';
} // end function

function add_favorite() {
  if (window.external) {
	external.AddFavorite(location.href, "<? echo $header_title; ?>");
  } else {
  alert("Your browser does not support this feature.  If you are using Netscape Navigator --\n" + "Click \"Bookmarks\" and then \"Add Bookmark\" or type \"Ctrl+D\" to add this site to your favorites.");
  }
}

function set_opacity(el, opac) {
  var ele = document.getElementById(el);
  ele.style.opacity = (opac / 100);
  ele.style.MozOpacity = (opac / 100);
  ele.style.KhtmlOpacity = (opac / 100);
  ele.style.filter = "alpha(opacity=" + opac + ")";
} // end function

function colorize(id) {
  //document.getElementById('image'+id).style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=0)';
  set_opacity('fp_image'+id, 100);
  document.getElementById('fp_desc'+id).style.display = "block";
} // end function

function decolorize(id) {
  //document.getElementById('image'+id).style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)';
  set_opacity('fp_image'+id, 75);
  document.getElementById('fp_desc'+id).style.display = "none";
} // end function

function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object
   var msg;
   for (var i in obj) {
      // if a parent (2nd parameter) was passed in, then use that to
      // build the message. Message includes i (the object's property name)
      // then the object's property value on a new line
      if (parent) {
	    msg = parent + "." + i + " = " + obj[i];
	  } else {
	    msg = i + " = " + obj[i];
	  }
      // Display the message. If the user clicks "OK", then continue. If they
      // click "CANCEL" then quit this level of recursion
      //if (!confirm(msg)) { return; }
	  document.writeln(msg + "<BR>");
      // If this property (i) is an object, then recursively process the object
      if (typeof obj[i] == "object") {
         if (i == 'style') {
		 //if (obj[i] instanceof CSSStyleDeclaration) {
		   if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
		 } // end if
      }
   }
} // end function

function quicktime(filename, width, height) {
  document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="' + width + '" HEIGHT="' + height + '">');
  document.write('<param name="src" value="' + filename + '">');
  document.write('<embed type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" src="' + filename + '" width="' + width + '" height="' + height + '"></embed></object>');
} // end function
