/************************************************************************************************************
Ajax dynamic list
Copyright (C) September 2005  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
	
************************************************************************************************************/	
function showImageToolTip(e,tooltip,content_id,imgsrc) {
	imghtml = '<img src=\''+imgsrc+'\' onload=\'javascript:fnPutBorder(this);\'/>'
	showToolTip(e,tooltip,content_id,imghtml)
}

function showToolTip(e,tooltip_id,content_id,text){

  var offset = $(Event.element(e).cumulativeOffset())
  var obj   = $(tooltip_id);
	var obj2  = $(content_id);
	
  obj2.innerHTML = text;
  obj.show();
    
  obj.setStyle({position: 'absolute'})
  obj.clonePosition($(Event.element(e)), {offsetLeft: parseInt(obj2.getStyle('width').gsub('px', ''))+20, offsetTop: 100})
	return true;
}	

function hideToolTip(tooltip_id)
{
	$(tooltip_id).hide()
}
var timerforanswerMouseOver = null; 
var currentContentId = '';
function mouseovertooltip(e,tooltip_id,content_id,text){
var showNewTip = false;

if(!(typeof(text) == "undefined") && currentContentId != text )
  showNewTip = true;
if(timerforanswerMouseOver != null)
{
  clearTimeout(timerforanswerMouseOver);
  timerforanswerMouseOver = null;
  }
if(showNewTip){
  currentContentId = text;
  showToolTip(e,tooltip_id,content_id,text);
  }
  
timerforanswerMouseOver = setTimeout("hideAnswertip(\""+tooltip_id+"\")", 2000);
}

function hideAnswertip(tooltip_id)
{
if(timerforanswerMouseOver != null){
  hideToolTip(tooltip_id);
  clearTimeout(timerforanswerMouseOver);
  timerforanswerMouseOver = null;
  currentContentId = '';
  } 
}
function fnPutBorder(obj)
{
  if(obj )
  {
    obj.style.border = "4px solid #828282";
  }
}