// ---------------------------------------------------------------------------------------
//call back function to calculate position fo the form field
// ---------------------------------------------------------------------------------------
function setCordinates(idname) {
	var spanField = document.getElementById(idname);
	var fieldCoords = findPos(spanField);
	
	// Now set the div object
	var divObject = document.getElementById("moreDiv");
	moreDivHeight = $("#moreDiv").height();
	divObject.style.top = (fieldCoords[1] - moreDivHeight) + "px";
	divObject.style.left = fieldCoords[0] -300 + 2 + "px";
}

// ---------------------------------------------------------------------------------------
//call back function to calculate position fo the form field
// ---------------------------------------------------------------------------------------
 function findPos(obj) {
        var curleft = curtop = curheight = 0;
        if (obj.offsetParent) {
                curleft = obj.offsetLeft
                curtop = obj.offsetTop
                while (obj = obj.offsetParent) {
                        curleft += obj.offsetLeft
                        curtop += obj.offsetTop
                }
        }

        return [curleft,curtop];
}

// -----------------------------------------------------------------------------------------------
//hide div tag when the page gets load
// -----------------------------------------------------------------------------------------------

$(function() {
   $("#moreDiv").hide();
});

// ----------------------------------------------------------------------------------------------
//call this function when the more link click and pass particulat div tag id to get left and right 
// -----------------------------------------------------------------------------------------------

function overlayDiv(objDiv) {
 
switch (objDiv) {
  case "complexityspan":
  				$("#moreContent").html("Complexity is a natural  and holistic property of  every system. It is defined as a mix of structure (connectivity) and uncertainty. Just like energy, complexity is a fundamental and intrinsic property of all  dynamical systems: the economy, the society, the internet, the environment, traffic systems, etc. The human body is no exception.  Today, complexity can be measured and turned into a powerful diagnostic and decision-making tool.");
				break;
  case "news_innerspan":
  				$("#moreContent").html("<ul><li>Ontonix S.r.l. spins-off OntoMed LLC, which will  specialize  in complexity ….<li><li>OntoMed introduces an innovative real-time ICU pre-alarm system.</li><li>Want to test our technology? Become a partner</li>");
				break;
   case "workspan":
   $("#moreContent").html("Complexity can be measured if data is available. A good example is the stream of data recorded in an ICU (Intensive care Unit) or during ECG or EEG tests. Even images, such as MRI or US scans can be processed to measure their complexity.<br/>In the presence of traumas, organ malfunctions/failure or even treatment, the complexity of the human body changes. The magnitude of these changes is proportional to the intensity of trauma and provides a measure of the patient’s global stability. Based on this concept, we are able to issue pre-alarms in an ICU or during surgery.");
				break;
    default:
	alert(objDiv);
}
$(function(){
      setCordinates(objDiv);
       $("#moreDiv").show("slow");
});
}


// ---------------------------------------------------------------------------------------
//close the morediv tag
// ---------------------------------------------------------------------------------------

$(function() {
	$("span#close").click(function() {
		$("#moreDiv").hide("slow");
	});
});
 
// ---------------------------------------------------------------------------------------
//provide cursor effect for close span based on browser type
// ---------------------------------------------------------------------------------------

$(function() {
$("span#close").mouseover(function() {
   ($.browser.msie) ? $(this).css({"cursor":"hand"}) : $(this).css({"cursor":"pointer"});
});
});
// ---------------------------------------------------------------------------------------

