/************************************************************************************************************
(C) www.dhtmlgoodies.com, March 2005

This is a script by Stefan Born(http://home.arcor.de/xbo/title-to-note/) featured at www.dhtmlgoodies.com.
You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var titleToNote = {
 // Define which elements should be affected:
 elements : ['a', 'img', 'input'],
 setup : function() {
//ajout yann
document.onmousemove = mouse_coordinates; 
//#
	 
 if(!document.getElementById || !document.createElement) return;
   // create note
   		if (!document.getElementById('title2note')) {
	   var div = document.createElement("div");
	   div.setAttribute("id", "title2note");
	   document.getElementsByTagName("body")[0].appendChild(div);
		}
	document.getElementById("title2note").style.display = "none";
   // attach events
   for(j=0;j<titleToNote.elements.length;j++){
     for(i=0;i<document.getElementsByTagName(titleToNote.elements[j]).length;i++){
       var el = document.getElementsByTagName(titleToNote.elements[j])[i];
       if(el.getAttribute("title") && el.getAttribute("title") != ""){
         el.onmouseover = titleToNote.showNote;
         el.onmouseout = titleToNote.hideNote;
       }
     }
   }
 },
 showNote : function() {
	 if (this.getAttribute("title")!=""){
	   document.getElementById("title2note").innerHTML = this.getAttribute("title");
	   this.setAttribute("title", "");  
	   
	   document.getElementById("title2note").style.left = mouse_posx - 100 + "px";
	   document.getElementById("title2note").style.top = mouse_posy + 10 + "px";
	   document.getElementById("title2note").style.display = "block";	   
	 }
 },
 hideNote : function() {
   this.setAttribute("title", document.getElementById("title2note").innerHTML);
   document.getElementById("title2note").innerHTML = "";
   document.getElementById("title2note").style.display = "none";
 }
}
 /* End Title To Note */
 
//ajout yann
var mouse_posx=0;
var mouse_posy=0;

function mouse_coordinates(e) {
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		mouse_posx = e.pageX;
		mouse_posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		mouse_posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		mouse_posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	
//window.status='x:'+mouse_posx+' y:'+mouse_posy;
}