function $(e) {
	return (typeof e == 'string') ? document.getElementById(e) : e;
}

/*****************************************************
 * Social Bookmak Bar
 * 16x16 icons must be stored as '/images/socialize_MODE.gif'
 * 2007 Martin Wendt
 **/

// encoded URL (strip parameters)
var thisUrl   = encodeURIComponent ( location.href.split('?') [0] );
var thisTitle = encodeURIComponent (document.title);

var bmbDefaultHint = 'Boomark "' + document.title + '"'; 

var aUrl = new Array();

aUrl ['blinklist']  = { url:  'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=' + thisUrl + '&Title=' + thisTitle,
		                hint: 'Blink It' };
aUrl ['delicious']  = { url:  'http://del.icio.us/post?v=4&noui&jump=close' + '&url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Save this Page to del.icio.us' };
aUrl ['digg']       = { url:  'http://digg.com/submit?phase=2&topic=software' + '&url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Digg This' };
aUrl ['furl']       = { url:  'http://www.furl.net/storeIt.jsp?u=' + thisUrl + '&t=' + thisTitle + ' ',
		                hint: 'Furl It' };  
aUrl ['google']     = { url:  'http://www.google.com/bookmarks/mark?op=add&bkmk=' + thisUrl + '&title=' + thisTitle + ' ',
		                hint: 'Bookmark at Google' };
aUrl ['misterwong'] = { url:  'http://www.mister-wong.de/index.php?action=addurl&amp;bm_url=' + thisUrl + '&bm_description=' + thisTitle,
		                hint: 'Zu Mister Wong hinzuf&uuml;gen' };
aUrl ['newsvine']   = { url:  'http://www.newsvine.com/_tools/seed&amp;save?u=' + thisUrl + '&h=' + thisTitle,
		                hint: 'Add to NewsVine' };
aUrl ['reddit']     = { url:  'http://reddit.com/submit?url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Add to reddit' };
aUrl ['slashdot']   = { url:  'http://slashdot.org/bookmark.pl?url=' + thisUrl + '&title=' + thisTitle,
		                hint: 'Slashdot It!' };
aUrl ['technorati'] = { url:  'http://technorati.com/faves?add=' + thisUrl,
		                hint: 'Add to Technorati' };
aUrl ['yahoo']      = { url:  'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + thisUrl + '&t=' + thisTitle,
		                hint: 'Add to Yahoo My Web' };
aUrl ['spurl']      = { url:  'http://www.spurl.net/spurl.php?title=' + thisTitle + '&url=' + thisUrl,
		                hint: 'Add to Spurl' };

function writeBookmarkHtml (mode) {
	document.write ('<a href=' + aUrl[mode].url 
	+ ' title="' + aUrl[mode].hint + '"'
	+ ' onMouseOver="$(\'idBmbHint\').innerHTML=this.title"'
	+ ' onMouseOut="$(\'idBmbHint\').innerHTML=bmbDefaultHint"'
//	+ ' target="_blank">'
	+ '<img src="http://www.worldaccent.com/blog/socialcontent/socialize_' + mode + '.gif" width="16" height="16" border="0">'
	+ '</a>');
}
function insertSocialBookmarkBar() {
	document.write('<div class="socialBookmarkBar">');
	document.write('<span id="idBmbHint">' + bmbDefaultHint + '</span>');
	document.write('<span class="bmbLinks">');
/* this works, but we loose control about the icon order: 
	for (var u in aUrl) {
		writeBookmarkHtml (u);
	}
*/	
	writeBookmarkHtml ('delicious');
	writeBookmarkHtml ('digg');
	writeBookmarkHtml ('furl');
	writeBookmarkHtml ('google');
	writeBookmarkHtml ('misterwong');
	writeBookmarkHtml ('newsvine');
	writeBookmarkHtml ('reddit');
	writeBookmarkHtml ('slashdot');
	writeBookmarkHtml ('technorati');
	writeBookmarkHtml ('yahoo');
	writeBookmarkHtml ('blinklist');
	writeBookmarkHtml ('spurl');

	document.write('</span>');
	document.write('</div>');
}
