function getPositionOfObject(cmp){
		var tagname="", x=0, y=0;
	  
		while((typeof(cmp) == "object") && (typeof(cmp.tagName) != "undefined"))
		{
			y += cmp.offsetTop;     
			x += cmp.offsetLeft;    
			tagname = cmp.tagName.toUpperCase();

			if(tagname == "BODY"){
				cmp = 0;
			}

			if(typeof(cmp) == "object"){
				if(typeof(cmp.offsetParent) == "object"){
					cmp = cmp.offsetParent;
				}
			}
		}
		
		var positonObject = new Object();
		positonObject['x'] = x;
		positonObject['y'] = y;
		
		return positonObject;
	}
	
	var paddingDetails = 10;
	
	var currentCmpState = null;
	var currentDetailCmpState = null;
	
	var IE='\v'=='v';
	
	function showCPDetails(obj, nb, md){
		if(typeof(vMode) != "undefined"){
			return;
		}
		
		if(currentDetailCmpState != null){
			hideDetails();
		}
		
		var pos = getPositionOfObject(obj);
		var layerName = 'cpDetails' + nb;
		var hoverCmp = document.getElementById(layerName);
		
		var pW = 425;
		hoverCmp.style.width = pW;
		
		var pH = 215;
		hoverCmp.style.height = pH;
		hoverCmp.style.display = 'block';
		
		var pX = 0;
		
		if(md == 1){
			pX = pos.x + 105 - paddingDetails;
			
			if(!IE){
				pX += 1;
			}
		}
		else if(md == 2){
			pX = pos.x - pW + paddingDetails;
			
			if(IE){
				pX += 1;
			}
		}
		
		hoverCmp.style.left = pX;
		
		var pY = pos.y - 155;
		hoverCmp.style.top = pY;
		
		currentCmpState = new Object();
		currentCmpState['x'] = pos.x;
		currentCmpState['y'] = pos.y;
		currentCmpState['w'] = 105;
		
		currentCmpState['h'] = 65;
		currentCmpState['name'] = layerName;
		
		currentDetailCmpState = new Object();
		currentDetailCmpState['x'] = pX;
		currentDetailCmpState['y'] = pY;
		currentDetailCmpState['w'] = pW;
		currentDetailCmpState['h'] = pH;
		currentDetailCmpState['name'] = layerName;
	}
	
	function parseIntValue(value){
		var regExp = /(\d+).*/gi;
		regExp.exec(value);
		return parseInt(RegExp.$1);
	}
	
	var mPosX, mPosY;
	
	function captureMousePosition(e){
		mPosX = e? e.pageX : window.event.x;
		mPosY = e? e.pageY : window.event.y + document.body.scrollTop;	
	}

	function handleMouseMove(e){
		captureMousePosition(e);
		tryHideDetails();
		
		return true;
	}
	
	document.onmousemove = handleMouseMove;
	
	function tryHideDetails(){
		if(typeof(vMode) != "undefined"){
			return;
		}
		
		if(currentDetailCmpState == null){
			return;
		}
		//window.status = "x:" + mPosX + "=" + currentDetailCmpState.x + " -> " +  (currentDetailCmpState.x + currentDetailCmpState.w) + ", y=" + mPosY + ":" + currentDetailCmpState.y + " -> " + (currentDetailCmpState.y + currentDetailCmpState.h);
		
		var cursorIntersectsCmp = (mPosX >= currentCmpState.x && mPosX < (currentCmpState.x + currentCmpState.w)) && (mPosY >= currentCmpState.y && mPosY < (currentCmpState.y + currentCmpState.h));
		var cursorIntersectsHoverCmp = (mPosX >= currentDetailCmpState.x && mPosX < (currentDetailCmpState.x + currentDetailCmpState.w)) && (mPosY >= currentDetailCmpState.y && mPosY < (currentDetailCmpState.y + currentDetailCmpState.h));

		if(cursorIntersectsCmp == false && cursorIntersectsHoverCmp == false){
			hideDetails();
		}
	}
	
	function hideDetails(){
		if(currentDetailCmpState == null){
			return;
		}
		
		var hoverCmp = document.getElementById(currentDetailCmpState['name']);
	
		hoverCmp.style.display = 'none';
		currentDetailCmpState = null;
	}
