/* Bottom Bar Start */

/* Function to get the total offset position */
function getposOffset(overlay, offsettype)
{
	/* To get the total offset depending on the offset type */
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	/* To get the parent offset of the overlay passed as the parameter */
	var parentEl=overlay.offsetParent;
	/* To check if the parent offset is not NULL */
	while (parentEl!=null)
	{
		/* To get total offset depending on the offset type */
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		/* To assign offset parent to the parent offset */
		parentEl=parentEl.offsetParent;
	}
	/* To return the total offset */
	return totaloffset;
}

function showDiv(obj)
{
	$('.infoDiv').fadeOut('slow');
	var divName = 'div_' + obj.id;

	var xpos = 0;
	var ypos = 0;
	xpos=getposOffset(obj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-obj.offsetWidth) : 0);

	var clientW = document.body.clientWidth;
	var clientW1 = document.body.clientWidth + $(window).scrollLeft();

	var infoDivRight = xpos + 250;
	/* To get the Y co-ordinate */
	//ypos=getposOffset(obj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? obj.offsetHeight : 0);

	xpos = xpos - 1;
	//ypos = ypos + 21;

	$('#' + divName).toggle();
	/* To assign X-Y co-ordinate values to the div style positioning */

	if (infoDivRight > clientW)
	{
		$('#' + divName).css("left", clientW1 - 250 + "px");
	}
	else
	{
		$('#' + divName).css("left", xpos+"px");
	}
	//$('#' + divName).css("top", ypos+"px");
}

$(document).ready(function(){
	$('#topBar td').hover( 
		function () {
			$(this).addClass("activeBotTab");
		},
		function () {
			$(this).removeClass("activeBotTab");
		}
	);

	$('.closeInfoDiv').click(function () {
		$('.infoDiv').fadeOut('slow');
	});
});
/* Bottom Bar End */

function getTopBarData(actioType, divID)
{
	$.ajax({
		type: "POST",
		url: HTTP_SERVER+DIR_WS_HTTP+"ajaxTopBarData.php",
		data: "actionType=" + actioType,
		success: function(msg){
			$('#div_'+divID+'_content').empty();
			$('#div_'+divID+'_content').html(msg);
		}
	});
}
