$(document).ready(function() {
	var imgpath	= '/ajax/jquery/plugins/socialize/social_icons/'; // set this
	var sz		= 32; // icon size in pixels
    var url		= window.location.href;
    var host	= window.location.hostname;
    var title	= $('title').text();
    	title	= escape(title); // clean up unusual characters
    var twit 		= 'http://twitter.com/home?status='+title+'%20'+url,
		facebook 	= 'http://www.facebook.com/sharer.php?u='+url,
		digg 		= 'http://digg.com/submit?phase=2&url='+url+'&amp;title='+title,
		stumbleupon = 'http://stumbleupon.com/submit?url='+url+'&amp;title='+title,
		buzz 		= 'http://www.google.com/reader/link?url='+url+'&amp;title='+title+'&amp;srcURL='+host,
		delicious  	= 'http://del.icio.us/post?url='+url+'&amp;title='+title,
		linkedin	= 'http://www.linkedin.com/shareArticle?mini=true&url='+url+'&amp;title='+title+'&amp;source='+host,
		myspace		= 'http://www.myspace.com/Modules/PostTo/Pages/?t='+title+'&amp;c=&amp;u='+url+'&amp;l=',
		email		= 'mailto:?subject='+title+'&amp;body='+title+'%0d%0d'+url,
		yahoobuzz	= 'http://buzz.yahoo.com/submit?submitUrl='+url+'&amp;submitHeadline='+title,
		reddit		= 'http://reddit.com/submit?url='+url+'&amp;title='+title;
    var tbar = '<div id="socializethis">';
    //tbar += '<span><img src="'+imgpath+'minimize.png" width="16" height="16" border="0" title="minimize this dock" alt="minimize" id="minimize" /></span><br/>';
    tbar += '<a class="image" href="'+facebook+'" id="facebook" title="Share this page on Facebook" target="_share"><img src="'+imgpath+'facebook.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+myspace+'" id="myspace" title="Share this page on MySpace" target="_share"><img src="'+imgpath+'myspace.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+twit+'" id="twit" title="Share this page on Twitter" target="_share"><img src="'+imgpath+'twitter.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+linkedin+'" id="linkedin" title="Share this page on Linkedin" target="_share"><img src="'+imgpath+'linkedin.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+digg+'" id="digg" title="Share this page on Digg" target="_share"><img src="'+imgpath+'digg.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+stumbleupon+'" id="stumbleupon" title="Share this page on Stumbleupon" target="_share"><img src="'+imgpath+'stumbleupon.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+delicious+'" id="delicious" title="Share this page on Del.icio.us" target="_share"><img src="'+imgpath+'delicious.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    //tbar += '<a class="image" href="'+buzz+'" id="buzz" title="Share this page on Buzz" target="_share"><img src="'+imgpath+'google-buzz.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '<a class="image" href="'+email+'" id="email" title="Share this page via email" target="_share"><img src="'+imgpath+'email.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    //tbar += '<a class="image" href="'+reddit+'" id="reddit" title="Share this page on reddit" target="_share"><img src="'+imgpath+'reddit.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    //tbar += '<a class="image" href="'+yahoobuzz+'" id="YahooBuzz" title="Share this page on Yahoo Buzz" target="_share"><img src="'+imgpath+'yahoo-buzz.png"  alt="" width="'+sz+'" height="'+sz+'" border="0" /></a>';
    tbar += '</div>';
    	// Add 40 px (32 px PLUS 4 px) to the width for each icon (larger size)
    	// Add 32 px (24 px PLUS 4 px) to the width for each icon (smaller)
    $('body').append(tbar); // appends toolbar HTML to body
    $(window).load(function () { // only show bar after page and graphics are finished loading; fixed IE8 issues.	
   		$('#socializethis').css({'display':'block',left: '-28px','opacity': .6});
    });
    // Hover
    $('#socializethis').hover(
    	function(){ // enter
      		$(this).animate({left: '0', opacity: 1}, 250);
    	},
    	function(){ // leave
      		$(this).animate({left: '-28px', opacity: .6}, 500);
    	}
    );
	// qTip Code
	$('#socializethis a[title]').qtip({ 
		position: {
			at: "right center",
			my: "left center",
			viewport: $(window),
			adjust: {
         		x: 6
      		}
		},
		hide: {
			effect: true
		},
		show: {
			effect: true,
			delay: 300
		},
		style: {
			tip: true,
			classes: "ui-tooltip-share ui-tooltip-shadow ui-tooltip-rounded"
		}
	});
});
