
//setup variables

var ulClass = "ULshare";        //css class for the container list
var liClass = "LIshare";        //css class for the list item
var iconPath = "images/icons/"; //path to the icon images
var showIconTitle = false;       //set to false to hide the text description

//set to false to hide sharing site
var Reddit = true;
var Facebook = true;
var StumbleUpon = true;
var Digg = true;
var Delicious = true;
var Fark = true;
var Twitter = true;

//grab the current url
var url = window.location;

//share parameters are set here. do not change these
function ShareSite(name, imageFile, submitUrl,title) {
  this.name = name;
  this.imageFile = imageFile;
  this.submitUrl = submitUrl;
  this.title = title;

  this.draw = drawShare;
}

function drawShare() {
  document.write('<li class="' + liClass + '">');
  document.write('<a href="' + this.submitUrl + '" target="_blank" rel="nofollow">');
  document.write('<img src="' + iconPath + this.imageFile + '" border="0" alt="' + this.name + '" title="' + this.title + '"/>');
  if (showIconTitle) {
    document.write(this.name);
  }
  document.write('</a>');
  document.write('</li>');
}

var sReddit = new ShareSite("Reddit","Reddit.gif","http://reddit.com/submit?url=" + url,"Post this to Reddit");
var sFacebook = new ShareSite("Facebook","Facebook.gif","http://www.facebook.com/share.php?u=" + url,"Share this on Facebook");
var sStumbleUpon = new ShareSite("StumbleUpon","StumbleUpon.gif","http://www.stumbleupon.com/submit?url=" + url,"Stumble It!");
var sDigg = new ShareSite("Digg","Digg.gif","http://digg.com/submit?phase=2&url=" + url,"Digg This!");
var sDelicious = new ShareSite("Del.icio.us","Delicious.gif","http://del.icio.us/post?url=" + url,"Post this to Delicious");
var sFark = new ShareSite("Fark","Fark.gif","http://cgi.fark.com/cgi/fark/farkit.pl?u=" + url,"Fark it!");
var sTwitter = new ShareSite("Twitter","Twitter.gif","http://twitter.com/home?status=Currently reading " + url,"Tweet This");

//call this function from the page where you want to create the icons

function drawShareIcons() {
  document.write('<ul class="' + ulClass + '">');
  
  if (Reddit) {
    sReddit.draw();
  }
  if (Facebook) {
    sFacebook.draw();
  }
  if (StumbleUpon) {
    sStumbleUpon.draw();
  }
  if (Digg) {
    sDigg.draw();
  }
  if (Delicious) {
    sDelicious.draw();
  }
  if (Fark) {
    sFark.draw();
  }
  if (Twitter) {
    sTwitter.draw();
  }

  document.write('</ul>');
}

