(function() {
if (typeof delicious == 'undefined') {
		delicious = {};
	}
	var src2 = 'http://badges.del.icio.us/feeds/json/url/data?url=';

	if ( delicious.url ) {
		src2 += delicious.url;
		myURL = delicious.url;
	} else {
		src2 += location.href;
		myURL = location.href;
	}
	src2 += "&amp;callback=displayURL";
	if ( delicious.title ) {
		myTitle = delicious.title;
	} else {
		myTitle =  document.title;
	} 
	var myText = '';
	if ( delicious.customText ) {
	myText = delicious.customText;
	} 
	if ( delicious.pageId ) {
		myId = 'delicious' + delicious.pageId;
	} else {
		myId =  'deliciousCount';
	} 
var src = 'http://delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(myURL) + "&title=" + encodeURIComponent(myTitle);  ;
	 var html = '';
if (myText == ''){
	html += '<div style="background:#999999;width:55px;height:45px;padding:1px 1px;"><center><span style= "font-family:Arial;font-weight:bold;font-size:18px;color:#FFFFFF;" id="' + myId +'">0</span><div style= "font-family:Arial;font-size:12px;color:#FFFFFF;">saves</div></center></div>';
    html += '<div style="background:#3333CC;width:55px;padding:1px 1px;"><center><a href="http://delicious.com/save" title="Save on Delicious" onclick="window.open(\'' + src + '\', \'delicious\',\'toolbar=no,width=550,height=550\'); return false;"><span style= "font-family:Arial;font-weight:bold;font-size:12px;color:#FFFFFF;">Delicious</span></a></center></div>'
}
else
{
	    html += '<a href="http://delicious.com/save" title="Save on Delicious" onclick="window.open(\'' + src + '\', \'delicious\',\'toolbar=no,width=550,height=550\'); return false;">' + myText +'</a>&nbsp;('
		html += '<span id="' + myId +'">0</span>&nbsp;saves)';
}

	
    
	html += '<script>function displayURL(data) {if (data == "") return; var urlinfo = data[0]; if (!urlinfo.total_posts) return;document.getElementById(\'' + myId+ '\').innerHTML = urlinfo.total_posts;}</script>'
	//src2 = 'http://badges.del.icio.us/feeds/json/url/data?url=http://www.google.com/&callback=displayURL';
    html += '<script src = "' + src2 +'"></script>'; 
	//html += '<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));</script><script type="text/javascript">try {var pageTracker = _gat._getTracker("UA-12037055-1");pageTracker._trackPageview();} catch(err) {}</script>';
   	document.write(html);
	
})();
