/*--------------------------------------------------
definition: show the tooltip that contains the color
            description.

parameter: pos - postion of the color
           display - true = show; false = hide
--------------------------------------------------*/
function showTooltip (pos,display,color,description)
{
	//declare the variables, and create objects
	var toolPoint = document.getElementById('point');
	var container = document.getElementById('tooltip_container');
	var textBox = document.getElementById('box');
	var ypos,xpos;
	var xmlHttp = ajaxFunction();
	var params = '';
	
	//hide tooltip
	if(!display) 
	{
		container.style.display = 'none'
		return;
	}
	
	//apply text
	textBox.innerHTML = '<strong>'+color+'</strong> '+description;
	
	//calculate the position of the tooltip
	if(pos >= 13) ypos = ((pos-13)*27)+2;
	else ypos = (pos*27)+2;
	toolPoint.style.left = ypos+'px';
	
	//show or hide the tooltip
	if(display)	container.style.display = 'block';

	//execute ajax functions
	/*params = "action=1&color="+color;

	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			var description = xmlHttp.responseText;
			
			//apply text
			textBox.innerHTML = '<strong>'+color+'</strong> '+description;	
			
			//calculate the position of the tooltip
			if(pos >= 13) ypos = ((pos-13)*27)+2;
			else ypos = (pos*27)+2;
			toolPoint.style.left = ypos+'px';
			
			//show or hide the tooltip
			if(display)	container.style.display = 'block';
      	}
	}
	xmlHttp.open("POST","../../../php_inc/ajax/color_tooltip/tooltip_process.php",true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
  	xmlHttp.send(params);*/
	
	return;
}





/*--------------------------------------------------
definition: create the ajax object

parameter: none
--------------------------------------------------*/
function ajaxFunction()
{
	var xmlHttp;
	try
  	{
  		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
  		// Internet Explorer
  		try
    	{
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e)
    	{
    		try
      		{
      			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      		}
    		catch (e)
      		{
      			alert("Your browser does not support AJAX!");
      			return false;
      		}
    	}
  	}
	
	return xmlHttp;
}