/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/

var j = jQuery.noConflict();


function WindowOnload() {
    var prev=window.onload(function()
		{
			// Safely inject CSS3 and give the search results a shadow
			var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
				'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
				'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
			j("#suggestions").css(cssObj);
			
			// Fade out the suggestions box when not active
			 j("input").blur(function(){
				j('#suggestions').fadeOut();
			 });
		});
    window.onload=function(){ if(prev)prev(); f(); }
  }





function lookup(inputString, cont) {
	if(inputString.length <= 0) {
		j('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		j.post("autocomplete_rpc.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
			//alert(data);
			j('#suggestions').fadeIn(); // Show the suggestions box
			j('#suggestions').html(data); // Fill the suggestions box
		});
	}
}

function feadeOutSuggestion()
{
	j('#suggestions').fadeOut();
}

function clickCall(val,val1,val2)
{
	document.getElementById('inputString').value = val;
	
	if(val1 != 'undefined' && document.getElementById('inputString-id'))
	document.getElementById('inputString-id').value = val1;
	
	if(val2 != 'undefined' && document.getElementById('inputString-unit'))
	document.getElementById('inputString-unit').innerHTML = val2;
	
	feadeOutSuggestion();
}
