///////////////////////////////////////////////////////////////
// floating div functions
///////////////////////////////////////////////////////////////
//function moveDiv(id) {
function moveDiv(id,addx,addy) {
	if (isNaN(addx)) addx = 0;
	if (isNaN(addy)) addy = 0;
//alert("moveDiv "+id);
// NB: this function will only work with elements that are in 'block' mode
// set them to be visibility: hidden but leave them as a block!
  var divW = document.getElementById(id).offsetWidth;
  var divH = document.getElementById(id).offsetHeight;
  var vWidth = 0, vHeight = 0;
  if( typeof( window.innerWidth ) == "number" ) {
    vWidth = window.innerWidth;
    vHeight = window.innerHeight;
  } else if( document.documentElement &&
             ( document.documentElement.clientWidth ||
               document.documentElement.clientHeight )) {
    vWidth = document.documentElement.clientWidth;
    vHeight = document.documentElement.clientHeight;
  } else if( document.body && 
             ( document.body.clientWidth || 
               document.body.clientHeight )) {
    vWidth = document.body.clientWidth;
    vHeight = document.body.clientHeight;
  }
  scr = getScrollXY();
//alert("top: "+(vHeight/2)+" - "+(divH/2)+" + "+scr[1]);
//  document.getElementById(id).style.top = parseInt((vHeight/2)-(divH/2)+scr[1]) + 'px';
  document.getElementById(id).style.top = parseInt((vHeight/2)-(divH/2)+scr[1]+addy) + 'px';
//alert("left: "+(vWidth/2)+" - "+(divW/2)+" + "+scr[0]);+
//  document.getElementById(id).style.left = parseInt((vWidth/2)-(divW/2)+scr[0]) + 'px';
  document.getElementById(id).style.left = parseInt((vWidth/2)-(divW/2)+scr[0]+addx) + 'px';
}
function getScrollXY() {
	var scrX = 0, scrY = 0;
  if( typeof( window.pageYOffset ) == "number" ) {
    scrY = window.pageYOffset;
    scrX = window.pageXOffset;
  } else if( document.body &&
             ( document.body.scrollLeft ||
               document.body.scrollTop )) {
    scrY = document.body.scrollTop;           
    scrX = document.body.scrollLeft;           
  } else if( document.documentElement &&
             ( document.documentElement.scrollLeft ||
               document.documentElement.scrollTop )) {
    scrY = document.documentElement.scrollTop;           
    scrX = document.documentElement.scrollLeft;           
  }
  return [ scrX, scrY ];
}


