








function BulleBD(owner){
   this.owner=owner;
   this.contentDiv=null;
   this.loadedobjects="";
   this.ini();
   this.mustMove = false;
   this.destX = 0;
   this.destY = 0;
   this.curAnim = null;
   this.curX = 0;
   this.curY = 0;
}


BulleBD.prototype.loadobjs=function(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (this.loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
this.loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}


BulleBD.prototype.setContent=function(content)
  {
    this.contentDiv.innerHTML = content;
	
  };

  
 
BulleBD.prototype.setVisible=function(bVisible)
  {
  if(bVisible)
    this.owner.style.display = "block";
	else
	 this.owner.style.display = "none";
	
  };
  
  
 BulleBD.prototype.setVisibility=function(bVisible)
  {
  if(bVisible)
    this.owner.style.display = "hidden";
	else
	 this.owner.style.display = "visible";
	
  };
  
BulleBD.prototype.getVisible=function()
  {
  if(this.owner.style.display ="block")
    return(true);
	else
	 return(false);
	
  };

BulleBD.prototype.moveTo=function(x,y) {  

	this.owner.style.visibility = "hidden";
	this.owner.style.display = "block";
	
	var deltaY = this.owner.offsetHeight;
	var deltaX = 23;

	this.owner.style.position = "absolute";
	
	this.destY = y-deltaY;
	this.destX = x-deltaX;
	this.animMove(this.destX,this.destY,15,0,-100);
	this.owner.style.visibility = "visible";
//	this.owner.style.top = 	y-deltaY;
//	this.owner.style.left = x-deltaX;
}

function animMoveDoObject() {

	infoBulle.animMoveDo ();
}

BulleBD.prototype.animMove=function(x,y,speed,dx,dy) {  
	this.owner.style.top = 	y+dy;
	this.owner.style.left = x+dx;
	
	this.curX = x+dx;
	this.curY = y+dy;
	this.curAnim = setInterval(animMoveDoObject,speed);

}

BulleBD.prototype.animMoveDo=function() {  
	var dx = 0;
	var dy = 10;
	
//	var delta = this.curY - this.destY;
//	dy = 10*Math.sin(delta)/delta;
	
	if(this.curY>this.destY)
	//if(dy<2)
	{
		this.owner.style.top = this.destY;
		clearInterval(this.curAnim);
		this.curAnim = null;
	}
	else
	{
		this.curX = this.curX+dx;
		this.curY = this.curY+dy;
		this.owner.style.top = 	this.curY;
		this.owner.style.left = this.curX;
	}
}

BulleBD.prototype.ini=function() {


this.loadobjs("./bulleBD/bulle.css");
var t = document.createElement("TABLE");
var b = document.createElement("TBODY");
t.setAttribute("cellSpacing","0");
t.setAttribute("cellPadding","0");
t.setAttribute("border","0");
t.appendChild(b);

//top
var tr = document.createElement("TR");

b.appendChild(tr);
//left
var td = document.createElement("TD");
tr.appendChild(td);
td.className= "corneBulle";
var im =  document.createElement("IMG");
im.setAttribute("src","Images/infoBD/tl.gif");
td.appendChild(im);
//middle
td = document.createElement("TD");
tr.appendChild(td);
td.className= "tBulle";
td.setAttribute("colSpan","2");
//right
td = document.createElement("TD");
tr.appendChild(td);
td.className= "corneBulle";
td.parentTable = this;
td.onclick = function(){this.parentTable.owner.style.display="none";this.parentTable.mustMove = false}
im =  document.createElement("IMG");
im.setAttribute("src","Images/infoBD/tr.gif");
td.appendChild(im);

//middle

tr = document.createElement("TR");
b.appendChild(tr);
//Left
td = document.createElement("TD");
tr.appendChild(td);
td.className= "lBulle";

td = document.createElement("TD");
td.setAttribute("colSpan","2");
tr.appendChild(td);
//content
this.contentDiv = document.createElement("DIV");
this.contentDiv.className = "divCont";
td.appendChild(this.contentDiv);

//right
td = document.createElement("TD");
tr.appendChild(td);
td.className= "rBulle";

//bottom

tr = document.createElement("TR");
b.appendChild(tr);
//left

td = document.createElement("TD");
tr.appendChild(td);
td.className= "corneBulle";
td.setAttribute("vAlign","top");
im =  document.createElement("IMG");
im.setAttribute("src","Images/infoBD/bl.gif");
td.appendChild(im);
td.parentTable = this;
td.onclick = function(){this.parentTable.owner.style.display="none";this.parentTable.mustMove = false}
//fleche
td = document.createElement("TD");
tr.appendChild(td);
td.className= "fleche";
td.setAttribute("width","93px");
im =  document.createElement("IMG");
im.setAttribute("src","Images/infoBD/fleche.gif");
td.appendChild(im);
td.parentTable = this;
td.onclick = function(){this.parentTable.owner.style.display="none";this.parentTable.mustMove = false}
// suite
td = document.createElement("TD");
tr.appendChild(td);
td.className= "bBulle";
td.parentTable = this;
td.onclick = function(){this.parentTable.owner.style.display="none";this.parentTable.mustMove = false}

//bottom right

td = document.createElement("TD");
tr.appendChild(td);
td.setAttribute("vAlign","top");
td.className= "corneBulle";
im =  document.createElement("IMG");
im.setAttribute("src","Images/infoBD/br.gif");
td.appendChild(im);
td.parentTable = this;
td.onclick = function(){this.parentTable.owner.style.display="none";this.parentTable.mustMove = false}

this.owner.appendChild(t);
	};



	