function loadValues(target,url,vars){
	var target = $(target);
	var first = target.options[0];
					while (target.firstChild) {
						target.removeChild(target.firstChild);
					}

					target.options.add(first);
	new Ajax.Request(url,{		
		parameters:vars,
		target:target,
		evalJSON:'force',
		method:'post',
		onComplete : function(event){			
			var target = $(event.request.options.target);
			if (target){
				var items = [];
				if (event.responseJSON) items =  event.responseJSON;			
					
					var sizeItems =items.size();
					for (var i=0;i<sizeItems;i++){
						var option = new Element('option',{value:items[i].id,text:items[i].name})
						option.text = items[i].name;
						target.options.add(option);
						
					}
					target.onchange();
			}
			
		}
	})
}

function inputsToUrl(form){
	//var params = form.serialize();
	
	var params = form.getElements();
	var url = '';
	for (var i = 0;i<params.size();i++){
		var param = params[i];
		if (param.value){
			url+=param.name+'_'+param.value+'/';
		}
	}
	//url = params.gsub(["&"],["/"]).gsub(["="],["_"]);
	
	if (form.action[form.action.length-1]!='/') form.action+='/';
	window.location = form.action+url+'';
	return false;
}