function doplus(setuserrating) {		
	if (!document.rating.userrating.value) { 
		document.rating.userrating.value=setuserrating; 
	}
	if (document.rating.userrating.value < 10) { 		
		var tempuserrating = document.rating.userrating.value;
		tempuserrating = Math.round(tempuserrating*100)/100;		
		tempuserrating = tempuserrating + 0.1; 
		tempuserrating = Math.round(tempuserrating*100)/100;		
		slider.setValue(tempuserrating);		
		document.rating.userrating.value = tempuserrating;
	} 
}

function dominus(setuserrating) {		
	if (!document.rating.userrating.value) { 
		document.rating.userrating.value=setuserrating; 
	}
	if (document.rating.userrating.value > 1) { 		
		var tempuserrating = document.rating.userrating.value;
		tempuserrating = Math.round(tempuserrating*100)/100;		
		tempuserrating = tempuserrating - 0.1; 
		tempuserrating = Math.round(tempuserrating*100)/100;		
		slider.setValue(tempuserrating);		
		document.rating.userrating.value = tempuserrating;
	} 
}

function Slider(t, s, h) {          
    this.track = document.getElementById(t);
    this.slider = document.getElementById(s);
    this.handle = document.getElementById(h);
    this.track.onmousedown = this.onmousedown;    
    this.track.slider = this;    
    this.track.onselectstart = this.slider.onselectstart =	
    this.handle.onselectstart = function() { return false };    
    this.style = this.slider.style;
}

Slider.prototype.startDrag = function(e) {
    Slider.currentInstance = this;
    if (!e) e = window.event;
    if (!this.handleWidth) {
	    this.handleWidth = this.handle.offsetWidth;
	    this.initialWidth = this.slider.offsetWidth;
	    this.width = this.initialWidth;
	    this.maxWidth = this.track.offsetWidth;
    }
    this.screenX = e.screenX;
    var el = e.target || e.srcElement;
    if (el != this.handle) {
        var x = e.offsetX? e.offsetX : e.layerX;
        x += Math.round(this.handleWidth / 2);
        this.moveTo(x);
    }
    this.initialWidth = this.width;
}

Slider.prototype.onmousedown = function(e) {
    var s = this.slider;
    s.startDrag(e);    
    if (document.addEventListener) {
        document.addEventListener("mousemove", s.onmousemove, true);
        document.addEventListener("mouseup", s.onmouseup, true);
    }
    else if (document.attachEvent) {
        document.attachEvent("onmousemove", s.onmousemove);
        document.attachEvent("onmouseup", s.onmouseup);
        document.attachEvent("onlosecapture", s.onmouseup);
    }    
}

Slider.prototype.onmouseup = function(e) {
    var s = Slider.currentInstance;
    s.initialWidth = s.width;    
    if (document.removeEventListener) {
        document.removeEventListener("mousemove", s.onmousemove, true);
        document.removeEventListener("mouseup", s.onmouseup, true);
    }
    else if (document.detachEvent) {
        document.detachEvent("onmousemove", s.onmousemove);
        document.detachEvent("onmouseup", s.onmouseup);
        document.detachEvent("onlosecapture", s.onmouseup);
    }
    
}

Slider.prototype.onmousemove = function(e) {
    if (!e) e = window.event;
    var s = Slider.currentInstance;
    var x = s.initialWidth + (e.screenX - s.screenX);
    s.moveTo(x);    
}

Slider.prototype.moveTo = function(x) {
    if (x < this.handleWidth) x = this.handleWidth;
    else if (x > this.maxWidth) x = this.maxWidth;
    this.width = x;
    this.style.width = '' + x + 'px';
    document.getElementById('ratingpoints').innerHTML = slider.getValue();
    document.getElementById('ratingtext').innerHTML =  textrating(slider.getValue());
    document.rating.userrating.value = slider.getValue();
}

Slider.prototype.moveBy = function(x) {
    this.moveTo(this.width + x);    
}

Slider.prototype.getValue = function() {  
    return Math.round(((Math.round((this.width-this.handleWidth) / (this.maxWidth-this.handleWidth)* 100) / 11.1)+1)*10)/10; 
}

Slider.prototype.setValue = function(x) {
  this.moveTo(Math.round(x * 18.4));
  document.getElementById('ratingpoints').innerHTML = x; 
  document.getElementById('ratingtext').innerHTML =  textrating(x)
}

var slider = new Slider('track', 'slider', 'handle');