// By publishing this widget code, you must agree to our Terms of Service (http://sustainlane.com/widgetTOS.jsp). 

if (sl_local_width == null || sl_local_width > 234 || sl_local_width < 125) {
	sl_local_width = 125;
}

document.write('<div style="width: '+sl_local_width+'px; overflow: hidden; border: 1px solid #ccc;">');
document.write('<fieldset style="border:0; margin:0; padding: 0;">');
document.write('<div style="font-family: verdana, arial, sans-serif; font-size: 11px; margin: 3px 3px 7px 3px;">Find local green businesses near you!</div>');
document.write('<div style="float: left;"><input type="text" onkeypress="return sl_local_simple_detectSubmit(event)" id="sl_local_simple_keyword" name="sl_local_simple_locationString" style="font-family: arial, sans-serif; font-size: 12px; width: 100px; border: 1px solid #999966; padding: 1px 3px 3px 3px; margin: 3px 15px 3px 7px;" onfocus="if(this.value == \'City, State or Zip\'){this.value=\'\'}" onblur="if (this.value==\'\') this.value=\'City, State or Zip\'; "/></div>');
document.write('<div style="margin: 3px 0 3px 7px;"><input type="button" style="margin-top: 2px;font-size: 11px;" id="sl_local_simple_searchButton" value="Search" onclick="sl_local_simple_search(); return false;"/></div>');
document.write('</fieldset>');
document.write('</div>');
document.write('<div style="text-align: right; font-size: 10px; font-family: verdana, arial, sans-serif; width: '+sl_local_width+'px;">Powered by <a href="http://www.sustainlane.com/?utm_campaign=localwidget&amp;utm_content=basic&amp;utm_medium=widget">SustainLane.com</a></div>');

document.getElementById("sl_local_simple_keyword").value = "City, State or Zip";

function sl_local_simple_search() {
	if (document.getElementById("sl_local_simple_keyword").value == "City, State or Zip") {
		document.getElementById("sl_local_simple_keyword").value = "";
	}
	var sl_local_simple_keyword = document.getElementById("sl_local_simple_keyword").value;
	sl_local_simple_keyword = encodeURIComponent(sl_local_simple_keyword);
	
	searchURL = "http://www.sustainlane.com/ext/sw.do?tab=local";
	searchURL += "&locationString="+sl_local_simple_keyword;
	searchURL += "&utm_campaign=localwidget&utm_content=basic&utm_medium=widget";
	
	window.location = searchURL;
}

function sl_local_simple_detectSubmit(e) {
	var keynum;
	var keychar;

	if(window.event) // IE 
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}
	
	keychar = String.fromCharCode(keynum)
	if (keychar == '\r' || keychar == '\n') {
		sl_local_simple_search();
		return false;
	}
	return true;
}