ADDTHIS = function() { }

ADDTHIS.prototype.Init = function (url, title, desc){
	this.addthisurl 	   = 'http://www.addthis.com/bookmark.php';
	this.customurl  	   = url;
	this.customtitle 	   = title;
	this.customdescription = desc;

	this.ChangeTemplate('Check out {{title}} @ {{url}}');
	this.AddCustomConfig();
}

ADDTHIS.prototype.ChangeTemplate = function(message) {
	addthis_share = {
		templates: { twitter: message }
	}
}

ADDTHIS.prototype.AddCustomConfig = function() {
	addthis_config = {
		data_track_clickback: false,
		ui_email_note: 'Check this out'
	}
}

ADDTHIS.prototype.Create = function(classes) {
	if (arguments.length > 1) {
		var id = arguments[1];
		var t = document.getElementById('addthis_'+id);
	} else {
		var t = document.getElementById('addthis');
	}

	if (t) {
		var d = document.createElement('div');
		NG.addClass(d, 'addthis_toolbox');
		NG.addClass(d, 'addthis_default_style');
		NG.addClass(t, classes);
		var a = document.createElement('a');

		var custom = '';
		if (this.customurl != '') custom += ' addthis:url="'+this.customurl+'"';
		if (this.customtitle != '') custom += ' addthis:title="'+this.customtitle+'"';
		if (this.customdescription != '') custom += ' addthis:description="'+this.customdescription+'"';

		d.innerHTML ='<a href="'+this.addthisurl+'"'+custom+' class="addthis_button_compact">Share</a>'
					+'<span class="addthis_separator">|</span>'
					+'<a'+custom+' class="addthis_button_facebook"></a>'
					+'<a'+custom+' class="addthis_button_twitter"></a>'
					+'<a'+custom+' class="addthis_button_myspace"></a>'
					+'<a'+custom+' class="addthis_button_email"></a>'
					+'<a'+custom+' class="addthis_button_print"></a>';

		t.appendChild(d);
	}
}


