function doRate(widget, value) {
	return dojo.xhrGet( {
        url: '/kos/wnetz/?' +
	        	'art=Rating.rate' + 
	        	'&rWidgetId=' + widget.id + 
	        	'&value='+ value, 
        handleAs: "text",

        timeout: 5000, // Time in milliseconds

        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { // 
		dojo.query("#result_" + widget.id)[0].innerHTML = response;		
          return response; // 
        },

        // The ERROR function will be called in an error case.
        error: function(response, ioArgs) { // 
          console.error("HTTP status code: ", ioArgs.xhr.status); // 
          return response; // 
          }
   });
}
	
	
function rate(evt){ 
	//dojo.addClass(dojo.query("[widgetId=" + this.id + "]")[0], "disabled");
	//dojo.addClass(dojo.query("[widgetId=" + this.id + "]")[0], "test");

	if (this.disabled == false) {
		//alert("klick " + evt.target.value + "/" + this.id);
		//this.setAttribute('disabled', true);
		//this.onChange();
		var myerg = doRate(this, evt.target.value);
		
	} else {
		//alert("Du hast schon abgestimmt!");
		//dojo.stopEvent(evt);
	}
}

function conAll(widget) {
	dojo.connect(widget, "onStarClick", rate);
}

dojo.addOnLoad(function(){   
    dijit.registry.byClass("dojox.form.Rating").forEach(conAll);
});
