// <![CDATA[
// tooltip.js
// September 14, 2007
// tooltip("absolute positioned div", "appearing/disappearing div", "show or hide", "change in x", "change in y")



function tooltip(parentid, childid, todo, level, xChange, yChange, myEffect, myEffectDuration, checkChildHover, mylevel, linktoPageUrl) {
	// The variables below may be modified to suit the needs of your current application
// 	var xChange = 25;
//	var yChange = 140;
	
	// We need to find the positioning of the parent id so we can position the child appropriately
	workingElem = document.getElementById(parentid);
	var curleft = 0;
	var curtop = 0;
	var xScroll, yScroll;
	var windowWidth, windowHeight;
	var mylevel = level;
	
	
	if(workingElem.offsetParent) {
		curleft = workingElem.offsetLeft;
		curtop = workingElem.offsetTop;
		while (workingElem = workingElem.offsetParent) {
			curleft += workingElem.offsetLeft;
			curtop += workingElem.offsetTop;
		}
	}
	
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(xChange == "center") {
		xChange = windowWidth/2 - 180;	
	}

	
	switch(todo) {
		case "showPink":
			// Clear all pinks, then show the one selected.
			allMyPinks = getElement
		case "show":
			hideFlash();
			document.getElementById(childid).style.top = parseInt(curtop) - parseInt(yChange) + "px";
			document.getElementById(childid).style.left = parseInt(curleft) - parseInt(xChange) + "px";
			// Check if any effects are wanted
			if(myEffect == "Appear") {
				new Effect.Appear(childid, { duration: myEffectDuration });
			} else {
				// No effect, just display
				document.getElementById(childid).style.display = "block";
			}
			break;
		case "showDiclaimer":
			hideFlash();
			document.getElementById(childid).style.top = parseInt(curtop) - parseInt(yChange) + "px";
			document.getElementById(childid).style.left = parseInt(curleft) - parseInt(xChange) + "px";
			// Check if any effects are wanted
			if(myEffect == "Appear") {
				new Effect.Appear(childid, { duration: myEffectDuration });
			} else {
				// No effect, just display
				document.getElementById(childid).style.display = "block";
			}
			document.getElementById('linktoUrl').innerHTML = linktoPageUrl;
			break;	
		case "hide":
				document.getElementById(childid).style.top = -6000 + "px";
				document.getElementById(childid).style.display = "none";
				showFlash();
			break;
		case "hideEmailPopOver":
				document.getElementById(childid).style.top = -6000 + "px";
				document.getElementById(childid).style.display = "none";
				showFlash();
			break;	
		case "showoverlay":
			hideFlash();
			document.getElementById(childid).style.top = parseInt(yScroll) + parseInt(yChange) + "px";
			document.getElementById(childid).style.left = parseInt(xScroll) + parseInt(xChange) + "px";
			// Check if any effects are wanted
			if(myEffect == "Appear") {
				new Effect.Appear(childid, { duration: myEffectDuration });
			} else {
				// No effect, just display
				document.getElementById(childid).style.display = "block";
			}
			break;
		case "hideoverlay":
			showFlash();
			document.getElementById(childid).style.top = -6000 + "px";
			document.getElementById(childid).style.display = "none";
			break;
		case "gotoHCP":
			document.getElementById(childid).style.top = -6000 + "px";
			document.getElementById(childid).style.display = "none";
			
			HCP_urlLink = document.getElementById('linktoUrl').innerHTML;
			if (HCP_urlLink != ""){ level = "4";}
			
			
			switch(level) {
			case "1":
				window.parent.location = "hcp/index.html"; 
				break;
			case "2":
				window.parent.location = "../hcp/index.html";
				break;
			case "3":
				window.parent.location = "../../hcp/index.html";
				break;	
			case "4":
				window.parent.location = HCP_urlLink;
				break;		
			}
			break;	
	}
}


function showFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
		// flashObjects[i].style.display = "block";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
		// flashEmbeds[i].style.display = "block";
	}
}

function hideFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
		// flashObjects[i].style.display = "none";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
		// flashEmbeds[i].style.block = "none";
	}

}



// ]]>