/*
ns dc       http://purl.org/dc/elements/1.1/
dc:date     2006-11-15
dc:creator  benjamin nowack
*/

if(!window["js_libs"]){window.js_libs={};}

window.js_libs["bubblehelp"]={
	onload : function(){
    try { bubblehelp_hide(); } catch(e) {};
		bubblehelp_activate_bubble_links();
	} 
}

function bubblehelp_activate_bubble_links(){
  /* bubble div */
  addEvent(bubblehelp_get_bubble(), 'mouseover', 
    function() {
      try {bubblehelp_show();} catch(e) {};
    	return true;
		}
	);
  addEvent(bubblehelp_get_bubble(), 'mouseout', 
    function() {
      try { bubblehelp_hide(); } catch(e) {};
    	return true;
		}
	);
  /* bubbles */
	var els;
	if(els = elsByClass("bubble")){
		for (var i = 0; i < els.length; i++) {
      bubblehelp_activate_bubble_link(els[i]);
		}
	}
}

function bubblehelp_get_bubble() {
  if (!elById('bubble')) {
    div = document.createElement("div");
    div.id = 'bubble';
    elByClass('page').appendChild(div);
  }
  return elById('bubble');
}

function bubblehelp_activate_bubble_link(el){
  addEvent(el.parentNode, 'mouseover', 
    function() {
      if (window['bubblehelp_show']) {
        bubblehelp_show(el);
      }
    	return true;
		}
	);
  addEvent(el.parentNode, "mouseout", 
    function() {
      if (window['bubblehelp_hide']) {
        bubblehelp_hide();
      }
      return true;
    }
  );
}

function bubblehelp_show(el){
  try {clearTimeout(window.bubblehelpTO)} catch(e) {}
  var b = bubblehelp_get_bubble();
  var move = b.style.display != "block" ? 1 : 0
  b.style.display = "none";
  if (el) {
    b.innerHTML = el.innerHTML;
  }
  if (true || move) {
    b.style.left = (parseInt(window.m_x) - 5) +'px';
    b.style.top = (parseInt(window.m_y) + 20) +'px';
  }
  b.style.display = "block";
}

function bubblehelp_hide(){
  try {clearTimeout(window.bubblehelpTO)} catch(e) {}
  var b = bubblehelp_get_bubble();
  window.bubblehelpTO = window.setTimeout(function(){ b.style.display = "none";}, 100);
}

