// Share JavaScript Document

var Share = {
	active: 'FALSE'
}

function share() {
	var display = '';	
	display += '<div id="share-container"><a href="javascript:void(0);" onclick="showShareMenu(this);">Share +</a></div>';		
	document.write(display);
}

function showShareMenu(link){
	if (Share.active == 'FALSE') {
		var menu = document.createElement('div');
		menu.setAttribute('id','ShareMenu');
		var contents = '<a class="close" href="javascript:closeShareMenu();">x</a><strong>SHARE</strong><div class="share_links">';
		contents += '<img src="http://static.delicious.com/img/delicious.small.gif" height="14" width="14" alt="" /><a href="http://delicious.com/save" onclick="window.open(\'http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=\'+encodeURIComponent(location.href)+\'&amp;title=\'+encodeURIComponent(document.title), \'delicious\',\'toolbar=no,scrollbars=1,width=550,height=550\'); return false;"> del.ici.ous</a><br/>';
		contents += '<script>function fbs_click() {u=location.href;t=document.title;window.open(\'http://www.facebook.com/sharer.php?u=\'+encodeURIComponent(u)+\'&amp;t=\'+encodeURIComponent(t),\'sharer\',\'toolbar=0,scrollbars=1,status=0,width=626,height=436\');return false;}</script><img src="http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif" height="14" width="14" alt="" /> <a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">facebook</a><br/>';
		contents += '<script>function digg_click() {window.open(\'http://digg.com/submit?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&topic=design&media=news\',\'digg\',\'toolbar=0,scrollbars=1,status=0,width=626,height=436\');return false;}</script><img src="http://digg.com/img/badges/16x16-digg-guy.gif" height="14" width="14" alt="" /> <a href="http://digg.com/submit" onclick="return digg_click()" target="_blank" class="digg_share_link">digg</a><br/>';
		contents += '<script>function su_click() {window.open(\'http://www.stumbleupon.com/submit?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title),\'stumbleupon\',\'toolbar=0,scrollbars=1,status=0,width=626,height=436\');return false;}</script><img src="http://cdn.stumble-upon.com/images/16x16_su_3d.gif" height="14" width="14" alt="" /> <a href="http://www.stumbleupon.com/submit" onclick="return su_click()" target="_blank" class="digg_share_link">stumbleupon</a><br/>';
		contents += '</div>';
		menu.innerHTML = contents;
		link.parentNode.appendChild(menu);	
		Share.active = 'TRUE';
	}
	return true;
}

function closeShareMenu(){
	var menu = document.getElementById('ShareMenu');
	menu.parentNode.removeChild(menu);
	Share.active = 'FALSE';
	void(0);
}