/** REQUIRES : lib_navig.js */

 function div_createPNGDiv(name, img, styleExtra) {
  if (styleExtra == null) { styleExtra = ""; }
  return("<DIV id='"+ name +"' style=\""+ styleExtra +
         (navig_isIE() ? "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ img +"', sizingMethod='crop');" : "")+         
         "\">\n"+
         (!navig_isIE() ? " <IMG src='"+ img +"'>" : "")+"\n"+
         "</DIV>" );
 }

 function getObj(objID) {
 return( document.getElementById( objID ) );
 }


 function div_setLocation(div, x, y) {
  div_setLocationX(div, x);
  div_setLocationY(div, y);
 }
 
 function div_setLocationX(div, x) {
  // surtout pas " px"
  div.style.left = parseInt(x)+"px";
 }

 function div_setLocationY(div, y) {
  div.style.top  = parseInt(y)+"px";
 }
 
 function div_getLocation(div) {
  // div.style.left = '10px' sauf sous Opera => div.style.left = '10' !! 
  var x = div.style.left; if (x != "") { x = parseInt(x); } else { x = -1; }
  var y = div.style.top;  if (y != "") { y = parseInt(y); } else { y = -1; }
  return( [ x, y ] );
 }


 /** ne fonctionne pas sous Opera 6.06 */
 function div_setSize(div, w, h) {
  div_setSizeW(div, w);
  div_setSizeH(div, h);
 }

 function div_setSizeW(div, w) {
  div.style.width  = parseInt(w)+"px";
 }

 function div_setSizeH(div, h) {
  div.style.height = parseInt(h)+"px";
 }

 /** ne fonctionne pas sous Opera 6.06 */
 function div_getSize(div) {
  var w = div.style.width;  if (w != "") { w = parseInt(w); } else { w = -1; }
  var h = div.style.height; if (h != "") { h = parseInt(h); } else { h = -1; }
  return( [ w, h ] );
 }


 function div_setBounds(div, x, y, w, h) {
  div_setLocation(div, x, h);
  div_setSize(div, w, h);
 }

 function div_setVisible(div, state) {
  div.style.visibility = (state ? "visible" : "hidden");
 }

function div_moveTo(div, x, y, animated, speedX, speedY) {
 if ( speedX == null ) speedX = 1;
 if ( speedY == null ) speedY = speedX;
 if ( animated == null ) animated = false;

 if (!animated) {
  div_setLocation(div, x, y);
 }
 else {
  var step = 1;
  var pt = div_getLocation( div );
  var stepX = (pt[0] > x ? -1 : (pt[0] == x ? 0 : 1));
  if ( Math.abs(pt[0] - x) > speedX ) stepX *= speedX;
  var stepY = (pt[1]  > y ? -1 : (pt[1] == y ? 0 : 1));
  if ( Math.abs(pt[1] - y) > speedY ) stepY *= speedY;
  div_setLocation(div, pt[0]+stepX, pt[1]+stepY);
  setTimeout("var pt = div_getLocation( div_get('"+ div.id +"') );"+
             //"debug(pt[1]+' '+ "+y+");"+
             "if (pt[0] != "+x+" || pt[1] != "+y+") {"+
              "div_moveTo( div_get('"+ div.id +"'), "+x+", "+y+", "+ animated +", "+speedX+", "+ speedY +");"+
             "}", 0);
 }
}

//alert("toto");