function doGoal(that, pageview) {
    try {
	var pageTracker=_gat._getTracker("UA-11805448-1");
	pageTracker._trackPageview(pageview);
	setTimeout('document.location = "' + that.href + '"', 100)
	    }catch(err){}
}

function findValue(li) {
	if( li == null ) return alert("No match!");

	// if coming from an AJAX call, let's use the CityId as the value
	if( !!li.extra ) var sValue = li.extra[0];

	// otherwise, let's just display the value in the text box
	else var sValue = li.selectValue;

	//alert("The value you selected was: " + sValue);
}

function selectItem(li) {
	findValue(li);
}


//var $j = jQuery.noConflict();

$(document).ready(function(){
	
	$("#s").autocomplete( products, 


		{
			delay:10,
			matchContains:"word",
			minChars:0,
			scrollHeight: 270,
			scroll: false,
			matchSubset:1,
			selectFirst: false,
			onItemSelect:selectItem,
			onFindValue:findValue,
			autoFill: false,
			maxItemsToShow: 15,
		}
				  );

	if( $("#s").val() == ""){
	    $("#s").val(searchmsg);
	    $("#s").css("color", "#898989");
	}

	$("#s").blur(function(){
		
		if($(this).val() == "")
		    $(this).val(searchmsg);

		if( $(this).val() == searchmsg )
		    $(this).css("color", "#898989");
		else
		    $(this).css("color", "#000");
		
	    });
	
	$("#s").focus(function(){
		$(this).css("color", "#000");
		if($(this).val() == searchmsg)
		    $(this).val("");
	    });



	if( $("#emailsignup").val() == ""){
	    $("#emailsignup").val(emailsignupdefault);
	    $("#emailsignup").css("color", "#898989");
	}

	$("#emailsignup").blur(function(){
		
		if($(this).val() == "")
		    $(this).val(emailsignupdefault);

		if( $(this).val() == emailsignupdefault )
		    $(this).css("color", "#898989");
		else
		    $(this).css("color", "#000");
		
	    });
	
	$("#emailsignup").focus(function(){
		$(this).css("color", "#000");
		if($(this).val() == emailsignupdefault)
		    $(this).val("");
	    });



    });
