﻿    function $(ElementId)
	{
    if(document.getElementById(ElementId) != null)
    {
	    return document.getElementById(ElementId);
	}
	else
	{
	    return document.getElementById('ctl00_ctl00_uiBodyPlaceHolder_uiWrappedContentPlaceHolder_ctl00_ctl00_' + ElementId);
	}
	}
    
    function ShowTODetails(ControlId,Message,Timeout,Position,Coords,ShowLeft)
	{
		var Ctl = $(ControlId);
		if (Ctl == null)
		{
			return;
		}
		
		var ToolTip = $(ControlId + "_ToolTip")
		var Arrow = $(ControlId + "_ToolTipArrow")
		var ParentDiv = $(ControlId)
		if ( Arrow == null)
			Arrow = document.createElement('div');
		ParentDiv.style.backgroundColor = '#d3dde8';
		var ToolTipHtml = Message
		var Added = false;
		if ( ToolTip == null)
		{
			ToolTip = document.createElement('div');
			Ctl.parentNode.appendChild(Arrow);
			Ctl.parentNode.appendChild(ToolTip);
		}
		if ( Position == null)
			Position = "BottomLeft";
		var Style=ToolTip.style;
		var Style3=Arrow.style;
		Style.display = '';
		Style.width='415';
		Style.height='';
		ToolTip.id = ControlId + "_ToolTip";
		Style.background = "#fff";
		Style.color = "#000";
		Style.border = "2px solid #317082";
		Style.borderWidth="2px";
		Style.borderStyle="solid";
		Style.borderColor="#317082";
		Style.zIndex = "10000002";
		Style.padding="2";
		Style.fontFamily = "verdana";
		Style.fontSize = "8pt";
		Style.fontWeight = "normal";
		ToolTip.innerHTML = ToolTipHtml;
		Style.position = "absolute";
		var Left = Ctl.offsetLeft +  10;
		var Top = Ctl.offsetTop + Ctl.offsetHeight - 5;
		if( Position == "Right")
		{
			Left = Ctl.offsetLeft + Ctl.offsetWidth + 40;
			Top = Ctl.offsetTop + Ctl.offsetHeight + 10;
		}
		else if( Position == "BottomRight")
		{
			Left = Ctl.offsetLeft + Ctl.offsetWidth - 10;
			Top = Ctl.offsetTop + Ctl.offsetHeight - 5;
		}
		else if (Position == "TopLeft")
		{
			Left = Ctl.offsetLeft + 2;
			Top = Ctl.offsetTop + 2;
			var mOffSet
			if(ShowLeft == true)
			{
				mOffSet = $(ControlId).offsetLeft + 450;
			}
		    Left -= mOffSet;
		    
		}
		else if (Position == "Absolute")
		{
			Left = Coords.split(',')[0];
			Top = Coords.split(',')[1];
		}
		else if( Position == "Mouse")
		{
		    if(window.event)
            {
                mouseX = window.event.clientX;
                mouseY = window.event.clientY;
            }
			Style.position = "absolute";
				var mOffSet = $(ControlId).offsetLeft;
				if(ShowLeft == true)
					{
						mOffSet = $(ControlId).offsetLeft + 850;
					}
				Left = mouseX - mOffSet;
				Top = mouseY;
		}
		var Width = 415;
		Style.left = Left + "px";
		Style.top = Top + "px";
		Style.width= Width + "px";
		Arrow.id = ControlId + "_ToolTipArrow";
		Style3.position = "absolute";
		if(ShowLeft == true)
		{
			Style3.backgroundImage = "url(http:\/\/localhost:81\/sourcesafe\/APPLICATIONS\/THOMASCOOK\/v2.2\/WWW\/5\/Source\/media\/images\/arrow_right.gif)";
		}
		else
		{
			Style3.backgroundImage = "url(http:\/\/localhost:81\/sourcesafe\/APPLICATIONS\/THOMASCOOK\/v2.2\/WWW\/5\/Source\/media\/images\/arrow.gif)";
		}
		Style3.backgroundPositionX = "left";
		Style3.backgroundPositionY = "center";
		Style3.backgroundRepeat = "no-repeat";
		Style3.display = "block";
		Style3.height = "60px";
		Style3.width = "20px";
		var paddingOffset = -3;
		if(ShowLeft == true)
		{			
		    if(document.forms.length > 1)
		    { 
		        paddingOffset = 5;
		    }
			var offsetBrowser = parseInt(Style.pixelWidth) + paddingOffset; //represents padding left & padding right width
			Style3.left = Left + offsetBrowser + "px";
		}
		else
		{
			Style3.left = Left - 18 + "px";
		}
		Style3.top = Top - 21 + "px";
		Style3.position = "absolute";
		Style3.zIndex = "10000005";
	}

	function HideTODetails(ControlId)
	{
		var Ctl = $(ControlId +  "_ToolTip");
		
		if (Ctl == null)
			return;
		Ctl.style.display="none";
		Ctl = $(ControlId +  "_ToolTipArrow").style.display="none";
	}