tempX = 0;
tempY = 0;

function getMouseXY() 
{
    tempX = document.getElementById('phrase').style.left;
    tempY = document.getElementById('phrase').style.top;
	//opera Netscape 6 Netscape 4x Mozilla 
	if (window.innerWidth || window.innerHeight)
	{
		docwidth = window.innerWidth; 
		docheight = window.innerHeight; 
	} 
	//IE Mozilla 
	if (document.body.clientWidth || document.body.clientHeight)
	{ 
		docwidth = document.body.clientWidth; 
		docheight = document.body.clientHeight; 
	}
	if (docwidth > 900)
	{
		tempX = (docwidth - 900) / 2;
	}
//	alert("x is "+tempX+" and y is "+tempY);
//  return true;
}

function getMatches(search_term) 
{
	getMouseXY();
    new Ajax.Request('http://www.emcadgifts.co.uk/_find_matches.php', 
    {
        method:'post',
        parameters: 
		{
			action: 'prices',
			phrase: search_term
        },

        onSuccess: function(transport, json)
        {
			var data = transport.responseText.evalJSON(true);
			document.getElementById('searchresults').innerHTML	= data[0].matches;
			//x = document.getElementById('searchresults');
	//		x.innerHTML	= data[0].matches;
//			x.style.display = "block";
//			x.style.top = tempY;
//			x.style.left = tempX;

			document.getElementById('searchresults').style.display = 'block';
//			document.getElementById('searchresults').style.top = tempY;
			document.getElementById('searchresults').style.left = tempX;
        },
        onFailure: function()
        {
            alert('Unable to connect to server. Please try again later.');
        }
    });
}

function hidediv(div,secs)
{
   setTimeout("document.getElementById('" + div + "').style.display = 'none';", secs);
}