function _w(str)
{
  document.write(str);
}

function findPosX(obj)
{
  var curleft = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.x)
      curleft += obj.x;
  return curleft;
}

function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1)
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.y)
      curtop += obj.y;
  return curtop;
}

var showAvailability_status = false;

function showAvailability_delay(status, delay, parent, parent_width, offset, className, text)
{
  showAvailability_status = status;
  setTimeout('showAvailability("' + parent + '", ' + parent_width + ', ' + offset + ', "' + className + '","' + text + '")', delay);
}

function showAvailability(parent, parent_width, offset, className, text)
{
  var status = showAvailability_status;
  parent_object = document.getElementById(parent);    // 'availabilityDiv');
  popup_object = document.getElementById('availabilityPopup');
  if (status)
  {
    popup_object.className = 'AvailabilityPopup_' + className;
    popup_object.innerHTML = text;
		
    popup_object.style.display = '';
    popup_object.style.position = 'absolute';
    // There's no reliable way to detect the correct actual object size in IE - we have to hardcode instead
    popup_object.style.left = "" + (findPosX(parent_object)+(parent_width-240)/2) + "px";
    popup_object.style.top = "" + (findPosY(parent_object)+offset) + "px";
  }
  else  
  {
    popup_object.style.display = 'none';
  }
}

  function femifit_showTooltip(popup_id, parent_id, status, offset_x, offset_y, class_name, inner_html)
  {
    var popup_object = document.getElementById(popup_id);
    var parent_object = document.getElementById(parent_id);
    if (status)
    {
      popup_object.className = class_name;
      popup_object.innerHTML = inner_html;
      popup_object.style.display = '';
      popup_object.style.position = 'absolute';
      popup_object.style.left = "" + (findPosX(parent_object)+offset_x) + "px";
      popup_object.style.top = "" + (findPosY(parent_object)+offset_y) + "px";
    }
    else  
    {
      popup_object.style.display = 'none';
    }
  }
	
