// Social Bookmarks
jQuery.fn.soc_bkmk = function() {
	var img_dir = SBR_PACKAGE_TPL_URL + 'img/bookmarks/';
	var networks = [ ];
	networks.push( {title: 'Google', img: 'google.gif', url: 'http://www.google.com/bookmarks/mark?op=add&hl=en&bkmk=%URL%&annotation=&labels=&title=%TITLE%'});
	networks.push( {title: 'Digg', img: 'digg.gif', url: 'http://digg.com/submit?phase=2&url=%URL%&bodytext=&tags=&title=%TITLE%'});
	networks.push( {title: 'Linkarena', img: 'linkarena.gif', url: 'http://linkarena.com/bookmarks/addlink/?url=%URL%&title=%TITLE%&desc=&tags='});
	networks.push( {title: 'Del.icio.us', img: 'del.gif', url: 'http://del.icio.us/post?v=2&url=%URL%&notes=&tags=&title=%TITLE%'});
	networks.push( {title: 'Netvouz', img: 'netvouz.gif', url: 'http://www.netvouz.com/action/submitBookmark?url=%URL%&description=&tags=&title=%TITLE%&popup=yes'});
	networks.push( {title: 'Blinklist', img: 'blinklist.gif', url: 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Tag=&Url=%URL%&Title=%TITLE%'});
	networks.push( {title: 'Yahoo', img: 'yahoo.gif', url: 'http://myweb2.search.yahoo.com/myresults/bookmarklet?t=%TITLE%&d=&tag=&u=%URL%'});
	networks.push( {title: 'Smarking', img: 'smarking.gif', url: 'http://smarking.com/editbookmark/?url=%URL%&description=&tags='});
	networks.push( {title: 'Spurl', img: 'spurl.gif', url: 'http://www.spurl.net/spurl.php?v=3&tags=&title=%TITLE%&url=%URL%'});
	networks.push( {title: 'Blogmarks', img: 'blogmarks.gif', url: 'http://blogmarks.net/my/new.php?mini=1&simple=1&url=%URL%&content=&public-tags=&title=%TITLE%'});
	networks.push( {title: 'Newsvine', img: 'newsvine.gif', url: 'http://www.newsvine.com/_wine/save?popoff=1&u=%URL%&tags=&blurb=%TITLE%'});
	networks.push( {title: 'Slashdot', img: 'slashdot.gif', url: 'http://slashdot.org/bookmark.pl?url=%URL%&title=%TITLE%'});
	networks.push( {title: 'Simpy', img: 'simpy.gif', url: 'http://www.simpy.com/simpy/LinkAdd.do?title=%TITLE%&tags=&note=&href=%URL%'});
	networks.push( {title: 'Technorati', img: 'technorati.gif', url: 'http://technorati.com/faves?add=%URL%&tag='});

	var bkmk = $('<div/>').attr('id', 'bkmk_wrap');
	for (i = 0; i < networks.length; i++)
	{
		var a = $('<a/>').attr({href:'#', id: 'bkmk_'+i}).click(_go);
		var img = $('<img/>').attr({src: img_dir + networks[i]['img'], align: 'left'});
		a.append(img).append(networks[i]['title']);
		var item = $('<div/>').addClass('bkmk_item');
		item.append(a);
		bkmk.append(item);
		// positioning menu
		var pos = $(this).offset();
		pos['top'] += $(this).height();
		bkmk.css({top: pos['top'], left: pos['left']});
	}
	$('body').append(bkmk);

	// show bookmark menu
	$(this).click(function() {
		$('#bkmk_wrap').toggle();
		return false;
	});

	function _go()
	{
		var i = this.id.split('_')[1];
		var url = networks[i]['url'].replace(/%TITLE%/, encodeURIComponent(document.title));
		url = url.replace(/%URL%/, encodeURIComponent(location.href));
		location.href = url;
		return false;
	};
}

