var time;
function getCompanyInfo(objRef, box) {
	url = $(objRef).attr('info');		
	$("#" + box).html('');	
	$.ajax({
	   type: "GET",
	   url: url,
	   async:true,
	   error: function(){
	   },
	   success: function(data) {
			$("#" + box).html(data).css('zIndex','100');
/////////////////************************ //////////////////////////
		var bubble = document.getElementById('thebubble');

		if(bubble!=null)
		{
			bubble.style.display="block";
		}
		try
		{			
			var el_x=0;
			if (objRef.offsetParent) {
				el_x = objRef.offsetLeft;
				var el = objRef;
				while (el = el.offsetParent) {
					el_x += el.offsetLeft;
				}
				
			}
			
			var el_y=0;
			if (objRef.offsetParent) {
				el_y = objRef.offsetTop;
				var el = objRef;
				while (el = el.offsetParent) {		
					el_y += el.offsetTop;
				}
			}
			bubble.style.left = el_x + "px";	

//			if (el_y < 220) {
			if (el_y < (document.body.offsetHeight/2 -15)) {
				bubble.style.top = el_y + 10 + "px";
			} else {		
				bubble.style.top = el_y - $('#bubble_content').attr('offsetHeight') -10 + "px";
			}
	
		}
		catch(e){};
/////////////////************************/////////////////////////*/			
		}
	});
}

function showBubble(bubble, objRef, dX, dY)
{	
	/*if(bubble!=null)
		{
			bubble.style.display="block";
		}
		try
		{			
			var el_x=0;
			if (objRef.offsetParent) {
				el_x = objRef.offsetLeft;
				var el = objRef;
				while (el = el.offsetParent) {
					el_x += el.offsetLeft;
				}
				
			}
			
			var el_y=0;
			if (objRef.offsetParent) {
				el_y = objRef.offsetTop;
				var el = objRef;
				while (el = el.offsetParent) {		
					el_y += el.offsetTop;
				}
			}
			bubble.style.left = el_x + "px";		
//alert('bubble.clientHeight' + bubble.clientHeight + '\n' + 'el_y ' + el_y);
			/*if (el_y < 230) {
//			if (el_y < window.innerHeight/2) {
				console.log("<");
				bubble.style.top = el_y + 15 + "px";
			} else {		
				console.log(">");
				bubble.style.top = el_y - bubble.clientHeight + "px";
			}* /
			
			if (el_y < 220) {
				bubble.style.top = el_y + 10 + "px";
			} else {		
				bubble.style.top = el_y - 200 + "px";
			}
	
		}
		catch(e){};*/

	if(time){
		clearTimeout(time); 	
	}
}

function onMouseOverBubble(){
	if(time){
		clearTimeout(time); 	
	}
}


function hideBubble(bubble)
{
	time=setTimeout('closeBubble()',1000);
}
function closeBubble(){
	var bubble=document.getElementById('thebubble');
	if(bubble!=null)
	{
		bubble.style.display="none";
	}
}
