
	
	var ratingsText = new Array();
	ratingsText[0] = 'Stalled Out';
	ratingsText[1] = 'Slow Going';
	ratingsText[2] = 'Speed Bumps';
	ratingsText[3] = 'Speed Limit';
	ratingsText[4] = 'Fast & Furious';
	ratingsText[5] = 'High Speed Pursuit!';
	
	RatingsModule = function( id ) {
		this.active = true;
		this.article_id = id ;
		GetEl( 'ratings_div' ).style.display = 'block';
	};
	
		
	RatingsModule.prototype.hover = function( v ) {
		if (this.active == true) { 
			var pointer = GetEl( 'ratings_pointer' );
			pointer.src = '/static/images/ratings/speedo-' + v + '.gif';
			//document.getElementById( 'ratings_text' ).innerHTML = ratingsText[v];
		}
	};

	RatingsModule.prototype.vote = function( v ) {
		if (this.active == true) { 
			var post = 'article_id='+this.article_id+'&vote='+v;
			var url = '/ajax/vote';
			var request =  YAHOO.util.Connect.asyncRequest('POST', url, { success: this.handleVote, argument: [this, v] }, post ); 
		}
	};
	
	RatingsModule.prototype.handleVote = function( req ) {
		var obj = req.argument[0];
		var v = req.argument[1];
		var response = req.responseText;
		//if (response['status'] == 'ok') { 
			var total = response['total'] = 2;
			var avg = response['average'] = v;
			if (total == 1) {
				GetEl( 'ratings_plur' ).style.display = 'none';
			} else {
				GetEl( 'ratings_plur' ).style.display = 'inline';
			}
			GetEl( 'ratings_total' ).innerHTML = total;
			GetEl( 'ratings_avg' ).innerHTML = avg;
			obj.active = false;
		//}
	};
	
	
	