function submitArticleRating(link, ratingValue) {

	// Remove "click" from article rating
	$("#star-rating a").each(function(index) {
		$(this).removeAttr('href').removeAttr('onclick');
	});

	// Make the stars static
	$("#one-star-id").css("z-index", "-100");
	$("#two-stars-id").css("z-index", "-100");
	$("#three-stars-id").css("z-index", "-100");
	$("#four-stars-id").css("z-index", "-100");
	$("#five-stars-id").css("z-index", "-100");

	// If cookie exists, then we exit the function
	var linkSplit = link.split("-");
	var articleRatingId = linkSplit[linkSplit.length - 1];	
	var articleRatingCookie = StorageSupport.getLocalStorage("articleRatingCookie");
	if(articleRatingCookie != "") {
		var articleRatingCookieSplit = articleRatingCookie.split(",");
		for(var i = 0; i < articleRatingCookieSplit.length; i++) {
			if(articleRatingId == articleRatingCookieSplit[i]) {
				// Exit Function
				return false;
			}
		}
	}
	
	// Update rating on server
	$.ajax({
		url : link,
		type : 'POST',
		data : "articleRating=" + ratingValue + "&ot=" + "ot.AjaxPageLayout"+ "&rand=" + (new Date().getTime()),
		dataType : "text",
		cache : false,
		success : function(data) {
			updatePageArticleRating(data, articleRatingId);
		}
	});
}

function updatePageArticleRating(data, articleRatingId) {

	// Update rating
	var jsonStr = $.trim(data);
	if (jsonStr != "") {
		
		var hour = 3600 * 1000;
		var now = new Date();
		now.setTime(now.getTime() + (hour * 24 * 30));
		
		// Evaluate JSON using browser's builtin JSON parser
		json = eval("(" + data + ")");

		if(json.currentRating != "") {
		
			// Update article rating
			var starRatingSpan = $("#star-rating-number");
			starRatingSpan.fadeTo("slow", 0, function() {
				starRatingSpan.text(json.currentRating);
				starRatingSpan.fadeTo("slow", 1);
			});
	
			// Update article raters
			var starRatersSpan = $("#star-raters-number");
			starRatersSpan.fadeTo("slow", 0, function() {
				starRatersSpan.text(json.totalRatings);
				starRatersSpan.fadeTo("slow", 1);
			});
	
			// Update Visible Stars
			$("#current-rating").delay(800).width(json.percentage + "%");
			
			// Set cookie
			var articleRatingCookie = StorageSupport.getLocalStorage("articleRatingCookie");
			if(articleRatingCookie == "") {
				articleRatingCookie = articleRatingId;
			} else {
				articleRatingCookie = articleRatingId + "," + articleRatingCookie;
				// This is keep within the 4KB cookie limit
				articleRatingCookie = articleRatingCookie.substring(0, 3950);
			}
			StorageSupport.setLocalStorage("articleRatingCookie", articleRatingCookie, 30);			
		}
	}
}
