/**
 * TP/Social Bookmarking
 */

function SB_rplc(s) {
	document.getElementById('socialBookmarker').innerHTML = '<b>' + s + '</b>';
}

function SB_open(srvc) {
	var cleanURL = SB_remSID(location.href);
	switch(srvc) {
		case 'IE': 	
			window.external.AddFavorite(cleanURL, document.title); break;
		case 'FF': 	
			window.sidebar.addPanel(document.title, cleanURL, '', false); break;
		case 'wong':	
			window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+encodeURIComponent(cleanURL)+'&bm_notice=&bm_description='+encodeURIComponent(document.title)+'&bm_tags='); break; 
		case 'google':	
			window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+encodeURIComponent(cleanURL)+'&annotation=&labels=&title='+encodeURIComponent(document.title)); break; 
		case 'yahoo':	
			window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&d=&tag=&u='+encodeURIComponent(cleanURL)); break; 
		case 'blinklist':	
			window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Tag=&Url='+encodeURIComponent(cleanURL)+'&Title='+encodeURIComponent(document.title)); break; 
		case 'webnews':	
			window.open('http://www.webnews.de/einstellen?url='+encodeURIComponent(cleanURL)+'&title='+encodeURIComponent(document.title)); break; 
		case 'icio':	
			window.open('http://www.icio.de/add.php?url='+encodeURIComponent(cleanURL)); break; 
		case 'del':	
			window.open('http://del.icio.us/post?v=2&url='+encodeURIComponent(cleanURL)+'&notes=&tags=&title='+encodeURIComponent(document.title)); break; 
		case 'oneview':	
			window.open('http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL='+encodeURIComponent(cleanURL)+'&title='+encodeURIComponent(document.title)); break; 
		case 'favit':	
			window.open('http://www.favit.de/submit.php?url='+(cleanURL)); break; 
		case 'linkarena':	
			window.open('http://linkarena.com/bookmarks/addlink/?url='+encodeURIComponent(cleanURL)+'&title='+encodeURIComponent(document.title)+'&desc=&tags='); break; 
		case 'yigg':	
			window.open('http://yigg.de/neu?exturl='+encodeURIComponent(cleanURL)); break; 
		case 'digg':	
			window.open('http://digg.com/submit?phase=2&url='+encodeURIComponent(cleanURL)+'&bodytext=&tags=&title='+encodeURIComponent(document.title)); break; 
		case 'alltagz':	
			window.open('http://www.alltagz.de/bookmarks/?action=add&popup=1&address='+encodeURIComponent(cleanURL)+'&title='+encodeURIComponent(document.title)+'&description='); break; 
		case 'facebook':	
			window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(cleanURL)+'&t='+encodeURIComponent(document.title)); break; 
		case 'twitter':	
			window.open('http://twitter.com/home?status='+encodeURIComponent(cleanURL)); break; 
		
	}
}

function SB_remSID(URL) {
	var retURL = '' + URL;
	retURL = retURL.replace(/&?SID=[0-9a-f]+/g, "");
	retURL = retURL.replace(/\?$/g, "");
	return retURL;
}

function SB_show(lang, imgURL) {
	
	document.write('<nobr>');
	
	switch (lang) {
		case 'fr': 	document.write('Bookmark cette page:'); break;
		case 'en': 	document.write('Bookmark this page:'); break;
		default:	document.write('Diese Seite bookmarken:'); 
	}
	
	document.write('&nbsp;<span id="socialBookmarker">&nbsp;&nbsp;&nbsp;</span></nobr><br />');
	document.write('<div style="border-top-style:solid; padding-top:3px; border-top-width: 1px; border-top-color: #2A4956; float: left;">');

	// client bookmark
	var ua=navigator.userAgent.toLowerCase();
	var isOpera=(ua.indexOf('opera')!=-1);
	var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    
	if (isOpera || isKonq || isSafari) {
		// not available
	}
	else if (document.all) {	// IE
		document.write('<a href="#" onclick="SB_open(\'IE\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/ie.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Internet Explorer" onmouseover="SB_rplc(\'Browser\');" onmouseout="SB_rplc(\'\');" /></a>');
	}
	else if (window.sidebar) {	// FF
		document.write('<a href="#" onclick="SB_open(\'FF\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/ff.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Firefox" onmouseover="SB_rplc(\'Browser\');" onmouseout="SB_rplc(\'\');" /></a>');
	}
	
	document.write('<a href="http://www.mister-wong.de/" onclick="SB_open(\'wong\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/wong.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Mr. Wong" onmouseover="SB_rplc(\'Mr. Wong\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.google.com/" onclick="SB_open(\'google\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/google.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Google" onmouseover="SB_rplc(\'Google\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.yahoo.com/" onclick="SB_open(\'yahoo\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/yahoo.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Yahoo" onmouseover="SB_rplc(\'Yahoo\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.blinklist.com/" onclick="SB_open(\'blinklist\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/blinklist.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Blinklist" onmouseover="SB_rplc(\'Blinklist\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.webnews.de/" onclick="SB_open(\'webnews\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/webnews.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Webnews" onmouseover="SB_rplc(\'Webnews\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.icio.de/" onclick="SB_open(\'icio\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/icio.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Icio" onmouseover="SB_rplc(\'Icio\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://del.icio.us/" onclick="SB_open(\'del\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/del.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Del.icio.us" onmouseover="SB_rplc(\'Del.icio.us\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.oneview.de/" onclick="SB_open(\'oneview\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/oneview.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Oneview" onmouseover="SB_rplc(\'Oneview\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.favit.de/" onclick="SB_open(\'favit\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/favit.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Favit" onmouseover="SB_rplc(\'Favit\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.linkarena.com/" onclick="SB_open(\'linkarena\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/linkarena.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Linkarena" onmouseover="SB_rplc(\'Linkarena\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://yigg.de/" onclick="SB_open(\'yigg\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/yigg.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Yigg" onmouseover="SB_rplc(\'Yigg\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://digg.com/" onclick="SB_open(\'digg\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/digg.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Digg" onmouseover="SB_rplc(\'Digg\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.alltagz.de/" onclick="SB_open(\'alltagz\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/alltagz.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Alltagz" onmouseover="SB_rplc(\'Alltagz\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://www.facebook.com/" onclick="SB_open(\'facebook\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/facebook.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Facebook" onmouseover="SB_rplc(\'Facebook\');" onmouseout="SB_rplc(\'\');" /></a>');
	document.write('<a href="http://twitter.com/" onclick="SB_open(\'twitter\'); return false;" style="text-decoration: none;"><img src="' + imgURL + '/twitter.gif" style="width:16px; height:16px; border: 0; margin: 3px;" alt="Twitter" onmouseover="SB_rplc(\'Twitter\');" onmouseout="SB_rplc(\'\');" /></a>');
}

