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;
	}
  return true
}

function getMatches(search_term) 
{
    $.ajax({
		url: 'http://www.barcodesuperstore.co.uk/_resolvesearch.php?phrase='+search_term,
        method:'get',
		data: search_term,
		dataType: 'application/json;',
        parameters: 
		{
			action: 'prices',
			phrase: search_term
        },

        success: function(data, textStatus, jqXHR)
        {
			data = jQuery.parseJSON(data);
			document.getElementById('searchresults').innerHTML	= data[0].matches;
			getMouseXY();
			document.getElementById('searchresults').style.display = 'block';
			document.getElementById('searchresults').style.zIndex = '9999';
        },
        onFailure: function()
        {
            alert('Unable to connect to server. Please try again later.');
        }
		   });
}

function hidediv(div,secs)
{
   setTimeout("document.getElementById('" + div + "').style.display = 'none'; document.getElementById('" + div + "').style.zIndex = '-9999';", secs);
}
