var aja_sp_onload = window.onload;

window.onload = function() {
	if (typeof aja_sp_onload == 'function' && aja_sp_onload) {
		aja_sp_onload();
	}
	if (document.getElementById) {
		function getFormNode(theChildNode) {
			var theParentNode = theChildNode.parentNode;
			if ('form' == theParentNode.tagName.toLowerCase()) {
				return theParentNode;
			} else if (null == theParentNode) {
				return;
			} else {
				return getFormNode(theParentNode);
			}
		}
		var theTextNode = document.getElementById('s');
        
		if (theTextNode) {
            
			var theFormNode = getFormNode(theTextNode);
			if (theFormNode) {
                
				var theQueryStr;
				theTextNode.onchange = function() {
					theQueryStr = "http://anuncieweb.com.br";
                    
					if (theTextNode.value && (0 < theTextNode.value.length)) {                         
                         //theQueryStr += '/search/'+ theTextNode.value +'/';
                         theQueryStr += '/search/'+ encodeURIComponent(theTextNode.value).replace(/%20/g, '+') +'/';                                                
                    }
                    
					theFormNode.setAttribute('onsubmit', 'window.location.assign("'+ theQueryStr +'"); return false;');
				}
			}
		}
	}
}