/**
 * @author leo
 */
if(typeof menuObj == 'undefined') 
menuObj = function(){
globalObj = null;
	
showMenu = function(obj, leftImg){
	if (obj && $(obj)){
		var coords = menuObj.getXY($('mainImg'));
		var xcord = coords.x + leftImg + 50;
		$(obj).style.left = xcord + 'px';
		$(obj).style.display = 'block';
	}
}

hideMenu = function(obj){
	if (obj && $(obj)){
		$(obj).style.display = 'none';
	}
}

preloadImage = function(imgSrc){
	var img = new Image();
	img.src = imgSrc;
}

getXY = function(obj){
  var curleft = 0;
  var curtop = obj.offsetHeight + 5;
  var border;
  if (obj.offsetParent)
  {
    do
    {
      // XXX: If the element is position: relative we have to add borderWidth
      if (menuObj.getStyle(obj, 'position') == 'relative')
      {
        if (border = _pub.getStyle(obj, 'border-top-width')) curtop += parseInt(border);
        if (border = _pub.getStyle(obj, 'border-left-width')) curleft += parseInt(border);
      }
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
    while (obj = obj.offsetParent)
  }
  else if (obj.x)
  {
    curleft += obj.x;
    curtop += obj.y;
  }
  return {x: curleft, y: curtop};
}

getStyle = function(obj, styleProp)
{
  if (obj.currentStyle)
    return obj.currentStyle[styleProp];
  else if (window.getComputedStyle)
    return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
}

return {
       hideMenu: hideMenu,
       showMenu: showMenu,
	   preloadImage: preloadImage,
	   getXY: getXY,
	   getStyle: getStyle
  }
	
}();