﻿
DiggCounter =
{
	urlToSubmit : "",
	rootPath : "",

	Count : function(urlToSubmit, rootPath)
	{
	    this.urlToSubmit = urlToSubmit;
	    this.rootPath = rootPath;

		this.getDiggCount();
	},
	
	getDiggCount : function()
	{
		var inst = this;

		$.ajax({
			type: "GET",
			dataType: "text",
			url: this.rootPath + "diggcount.aspx?url=" + encodeURIComponent(this.urlToSubmit),
			success: inst.render
		});	
	},
	
	render : function(response)
	{
		if (response != "0"){
			$("span.digg-count").html("(" + response + ")");
			$("span.digg-count").show();
		}	
	}
}

