/* a DOM-compliant social bookmarking widget authored by Antonio Malcolm, copyleft 2009, all wrongs reserved, released under a GPLv3 license */

event.addEvent(window, 'load', shareIt);

function shareIt() {
	
	var imageDirectory = "/mochaCMS/images/socialBookmarks/"; /* change this to wherever you decide to store the icon images */
	
	var pageURL = location.href;  
	var encodedPageURL = escape(pageURL);
  	
  	var pageTitle = document.title;
	
	var digg = document.getElementById("digg");
	var propeller = document.getElementById("propeller");
	var stumbleupon = document.getElementById("stumbleupon");
	var delicious = document.getElementById("delicious");
	var technorati = document.getElementById("technorati");
	
	var diggImage = null;
	var propImage = null;
	var stumImage = null;
	var deImage = null;
	var techImage = null;
	
	var diggLink = document.createElement("a");
                      diggLink.setAttribute("href", "http://digg.com/submit?phase=2&url=" + encodedPageURL + "&title=" + pageTitle);
                      diggLink.setAttribute("target", "new");
                      diggImage = document.createElement("img");
                      diggImage.setAttribute("src", imageDirectory + "diggIcon.png");
                      diggLink.appendChild(diggImage);
                      digg.appendChild(diggLink);
                      
   var propLink = document.createElement("a");
                      propLink.setAttribute("href", "http://propeller.com/submit/?U=" + encodedPageURL + "/&T=" + pageTitle);
                      propLink.setAttribute("target", "new");
                      propImage = document.createElement("img");
                      propImage.setAttribute("src", imageDirectory + "propellerIcon.png");
                      propLink.appendChild(propImage);
                      propeller.appendChild(propLink); 
	
	var stumLink = document.createElement("a");
                      stumLink.setAttribute("href", "http://www.stumbleupon.com/submit?url=" + encodedPageURL + "&title=" + pageTitle);
                      stumLink.setAttribute("target", "new");
                      stumImage = document.createElement("img");
                      stumImage.setAttribute("src", imageDirectory + "stumbleIcon.png");
                      stumLink.appendChild(stumImage);
                      stumbleupon.appendChild(stumLink);
	
	var deLink = document.createElement("a");
                      deLink.setAttribute("href", "http://del.icio.us/post?url=" + encodedPageURL + "&title=" + pageTitle);
                      deLink.setAttribute("target", "new");
                      deImage = document.createElement("img");
                      deImage.setAttribute("src", imageDirectory + "deliciousIcon.png");
                      deLink.appendChild(deImage);
                      delicious.appendChild(deLink);
	
	var techLink = document.createElement("a");
                      techLink.setAttribute("href", "http://technorati.com/faves?add=" + encodedPageURL);
                      techLink.setAttribute("target", "new");
                      techImage = document.createElement("img");
                      techImage.setAttribute("src", imageDirectory + "technoratiIcon.png");
                      techLink.appendChild(techImage);
                      technorati.appendChild(techLink);
                      
}
