function showImage(oImg,maxWidth){
	var path = oImg.src;
	
	var oClient = new AjaxClient();
	var map = new Hashtable();
	map.put("makediv","true");
	map.put("w",maxWidth);
	map.put("m",4);
	map.put("f",path.substring(path.lastIndexOf("f=")+2));
	
	var oLoading = showLoading(oImg);
	
	oClient.sendParameters("image.php",map,true,function(sTxt,iCode,sStatus){
		var oDiv = document.createElement("div");
		oDiv.innerHTML = sTxt;		
		oDiv.style.position = "absolute";
		var oIDiv = oDiv.firstChild;
		oDiv.style.left = (f_clientWidth()/2-parseInt(oIDiv.style.width)/2)+"px";
		oDiv.style.top = (findPosY(oImg))+"px";
		oDiv.title = "Pulse para cerrar";
		oDiv.style.cursor = "pointer";		
		oDiv.onclick=function(){
			oDiv.parentNode.removeChild(oDiv);
		}
		document.body.appendChild(oDiv);
		hideLoading(oLoading);
	});
}

function showLoading(oRefObj){
	var oDiv = document.createElement("div");
	oDiv.innerHTML = "<p>Cargando imagen</p>";		
	oDiv.style.position = "absolute";
	oDiv.style.left = (findPosX(oRefObj))+"px";
	oDiv.style.top = (findPosY(oRefObj))+"px";
	oDiv.style.background = "#FFF";
	oDiv.style.border = "#333 4px solid";
	oDiv.style.padding = "10px";	
	document.body.appendChild(oDiv);
	return oDiv;
}

function hideLoading(oLoadingObj){
	oLoadingObj.parentNode.removeChild(oLoadingObj);
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

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;
}

