		function dynsearch() {
		var sterm = document.getElementById('st_sterm').value;
		var num = document.getElementById('st_n').value;
		var ord = document.getElementById('st_o').value;
		var shop = document.getElementById('st_shop').value;
		var slimit = document.getElementById('st_limit').value;
		
			//we empty our results area
			jQuery("#actinetajaxresults").empty();
			//ajax spinner while we wait
			//jQuery("#actinetajaxresults").html("<img style=\"margin:20px;\" src='"+shop+"../actsql/res/ajax-loader.gif'>");
			jQuery("#st_sterm").css('background-image','url('+shop+'../actsql/res/ajax-loader.gif)');

			//ajax request for json from ActSQL API

jQuery.getJSON("../actsql/feed.php?jsoncallback=?",
  { q: sterm, n: num },
  function(data) {
 
			//empty the reuslts
			jQuery("#actinetajaxresults").html('');

			//create an ul to hold our li
			jQuery("<ul id='resultslist'></ul>").appendTo("#actinetajaxresults");			

			//do this for each result			
			jQuery.each(data, function(i,item){
			thisref = item.ref.replace(/[^a-zA-Z 0-9]+/g,'');
			
			if (item.price=='0') { thisprice = ""; } else { thisprice = "&pound;"+item.price; }
			slicename = item.title.slice(0,slimit)+'...';						

			//you can edit this part. in this example its a linked list with the price in bold.		    
		    jQuery("<li id='prodresult"+thisref+"' onclick=\"document.location='"+shop+item.url+"';\"><img width=\"50\" height\"50\" src=\""+shop+"../actsql/thumb.php?w=50&h=50&s=1&zc=3&src=../acatalog/"+item.image+"\" /><p>"+slicename+"<span>"+thisprice+"</span></p><div style=\"clear:both;\"></div></li>").appendTo("#resultslist");
 		      
		    });
		    
	            //jQuery("<div style=\"clear:both;\"></div>").appendTo("#actinetajaxresults");
            jQuery('#actinetajaxresults').css("z-index","9999");
            jQuery('#actinetajaxresults').slideDown();
			jQuery("#st_sterm").css('background-image','url('+shop+'../actsql/modules/ajaxsearch/zoom.png)');

  });

            

  		}

      jQuery(document).ready(function() {
      
		jQuery("#st_sterm")
		    .val(jQuery("#st_default").val())
		    .css("color", "#666")
		    .focus(function(){
		        jQuery(this).css("color", "black");
		        if (jQuery(this).val() == jQuery("#st_default").val()) {
		            jQuery(this).val("");
		        } else { jQuery("#actinetajaxresults").slideDown(); }
		        
		    })
		    .blur(function(){
		        jQuery(this).css("color", "#666");
		        if (jQuery(this).val() == "") {
		            jQuery(this).val(jQuery("#st_default").val());
		        }
		        jQuery("#actinetajaxresults").slideUp();
		    });      
      
      
        jQuery('#st_sterm').keyup(function() {
        if ( jQuery('#st_sterm').val().length >= 3) {
          if (window.nickTimeout) { window.clearTimeout(nickTimeout); } window.nickTimeout = window.setTimeout('dynsearch();', 500);
          } else { jQuery("#actinetajaxresults").slideUp(); jQuery("#actinetajaxresults").html(''); }
        });
        
        
      });


