var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
var reserved = "!*'();:@&=+$,/?%#[]";
var allowed = unreserved + reserved;
var hexchars = "0123456789ABCDEFabcdef";
function gethex(decimal) { return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);  }
function dourlencode(s){
	var decoded = s;
	var encoded = "";
	for(var i = 0; i < decoded.length; i++ ){
		var ch = decoded.charAt(i);
		if (unreserved.indexOf(ch) != -1) { encoded = encoded + ch; }
		else{
			var charcode = decoded.charCodeAt(i);
			if (charcode < 128){ encoded += gethex(charcode); }
			else if (charcode > 127 && charcode < 2048){ encoded += gethex((charcode >> 6) | 0xC0) + gethex((charcode & 0x3F) | 0x80); }
			else if (charcode > 2047 && charcode < 65536){ encoded += gethex((charcode >> 12) | 0xE0) + gethex(((charcode >> 6) & 0x3F) | 0x80) + gethex((charcode & 0x3F) | 0x80); }
			else if (charcode > 65535){
				encoded += gethex((charcode >> 18) | 0xF0) + gethex(((charcode >> 12) & 0x3F) | 0x80) +
				gethex(((charcode >> 6) & 0x3F) | 0x80) + gethex((charcode & 0x3F) | 0x80);
			}
		}
	}
	return encoded;
}

function clk(na){
	var img = new Image();
	img.src = '/img/web20clk.php?na='+dourlencode(na)+'&t='+(new Date()).getTime();
}

function closeLink(r){
	h = document.getElementById('itsalinksetter'+r);
	h.innerHTML = '';
}

function openLink(r){
	h = document.getElementById('itsalinksetter'+r);
	h.style.position = 'absolute';
	h.style.left = '0px';
	h.style.top = '0px';
	h.innerHTML = '<div style="width:300px; border:1px solid #BFBFBF; background-color:#FFFEE1; position:relative;"><table width="100%"><tr><td style="font-size:9pt;">URL:</td><td><input style="font-size:9pt;" type="Text" name="" value="'+location.href+'" onfocus="this.select()" style="width:200px;"></td></tr><tr><td style="font-size:9pt;">HTML-Code:</td><td><input style="font-size:9pt;" type="Text" name="" value="&lt;a href=&quot;'+location.href+'&quot;&gt;'+document.title+'&lt;/a&gt;" style="width:200px;" onfocus="this.select()"></td></tr><tr><td style="font-size:9pt;">BB-Code:</td><td><input style="font-size:9pt;" type="Text" name="" value="[url='+location.href+']'+document.title+'[/url]" style="width:200px;" onfocus="this.select()"></td></tr></table><div style="position:absolute; left:280px; top:5px;"><a href="#" onclick="closeLink('+r+')"><img src="/img/btn_del.gif" width="16" height="16" border="0" alt="X"></a></div></div>';
	return false;
}

function setbookmark(title,url){
	if (window.sidebar){ window.sidebar.addPanel(title, url, "");} //firefox
	else if(window.opera && window.print)
	{ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all){ window.external.AddFavorite(url, title); }// ie
}

var loc = dourlencode(location.href);
var tit = dourlencode(document.title);

r = Math.round(Math.random()*10000);

if (add){
	document.write('<div style="position:absolute;top:152px;left:595px;z-index:4;">');
}
else{
	document.write('<div style="position:absolute;top:53px;left:595px;z-index:4;">');	
}

document.write('<table>');
document.write('	<tr valign=top>');
document.write('		<td>');
document.write('			<a style="color:#D7EEAD;white-space: nowrap; font-size:8pt; z-index:0;" onclick="clk(\'linksetter\'); return openLink('+r+');" target="_blank" href="#">Link zu dieser<br> Seite setzen</a><span style="position:relative; z-index:0;"><span id="itsalinksetter'+r+'" style=" z-index:9999;"></span></span>');
document.write('		</td>');
document.write('		<td style="border-left:1px solid #80C646;">');
document.write('			<table border="0" cellspacing="0" cellpadding="0" style="margin-top:0px;">');
document.write('				<tr valign=top>');
document.write('					<td style="padding:0px 0 0 3px;font-size:9pt; white-space: nowrap;" align="left">');
document.write('<a style="margin:1px" onclick="clk(\'live.com\')" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=de-de&url='+loc+'&title='+tit+'&top=0"><img src="/img/btn_windowslive.gif" border="0" alt="zu Windows Live hinzuf&uuml;gen" title="zu Windows Live hinzuf&uuml;gen"></a>');
document.write('<a style="margin:1px" onclick="clk(\'twitter.com\')" target="_blank" href="http://twitthis.com/twit?url='+loc+'&title='+tit+'"><img src="/img/btn_twitter.gif" border="0" alt="zu Twitter hinzuf&uuml;gen" title="zu Twitter hinzuf&uuml;gen"></a>');
document.write('<a style="margin:1px" onclick="clk(\'webnews.de\')" target="_blank" href="http://www.webnews.de/einstellen?url='+loc+'&title='+tit+'"><img src="/img/btn_webnews.gif" border="0" alt="zu Webnews hinzuf&uuml;gen" title="zu Webnews hinzuf&uuml;gen"></a>');
document.write('<a style="margin:1px" onclick="clk(\'technorati.com\')" target="_blank" href="http://technorati.com/faves?add='+loc+'"><img src="/img/btn_technorati.gif" border="0" alt="zu Technorati hinzuf&uuml;gen" title="zu Technorati hinzuf&uuml;gen"></a>');
document.write('					</td>');
document.write('				</tr>');
document.write('				<tr valign=top>');
document.write('					<td style="padding:0px 0 0 3px;font-size:9pt; white-space: nowrap;" align="left">');
document.write('<a style="margin:1px;margin-bottom:0;" onclick="clk(\'blinklist\')" target="_blank" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+loc+'&Title='+tit+'"><img src="/img/btn_blinklist.gif" border="0" alt="zu Blinklist hinzuf&uuml;gen" title="zu Blinklist hinzuf&uuml;gen"></a>');
document.write('<a style="margin:1px;margin-bottom:0;" onclick="clk(\'del.icio.us\')" target="_blank" href="http://del.icio.us/post?url='+loc+'&title='+tit+'"><img src="/img/btn_delic.gif" border="0" alt="zu del.icio.us hinzuf&uuml;gen" title="zu del.icio.us hinzuf&uuml;gen"></a>');
document.write('<a style="margin:1px;margin-bottom:0;" onclick="clk(\'facebook.com\')" href="http://www.facebook.com/share.php?u='+loc+'" title="zu Facebook hinzuf&uuml;gen" target="_blank"><img src="/img/btn_facebook.gif" alt="zu Facebook hinzuf&uuml;gen" border="0" /></a>');
document.write('<a style="margin:1px;margin-bottom:0;" onclick="clk(\'favoriten.de\')" href="http://www.favoriten.de/url-hinzufuegen.html?bm_url='+loc+'&bm_title='+tit+'" title="zu Favoriten.de hinzuf&uuml;gen" target="_blank"><img src="/img/btn_favoriten_de.gif" alt="zu Favoriten.de hinzuf&uuml;gen" border="0" /></a>');
document.write('</td>');
document.write('				</tr>');
document.write('			</table>');
document.write('		</td>');
document.write('		<td style="border-left:1px solid #80C646;">');
document.write('			<table border="0" cellspacing="0" cellpadding="0" style="margin-top:0px;">');
document.write('				<tr valign=top>');
document.write('					<td style="padding:0px 0 0 3px;font-size:9pt; white-space: nowrap;" align="left">');
document.write('<a style="margin:1px" onclick="clk(\'IEHomepage\')" id="homepageid" style="behavior:url(#default#homepage);" href="javascript: document.all.homepageid.setHomePage(location)"><img src="/img/btn_startseite.gif" border="0" alt="als Startseite festlegen" title="als Startseite festlegen"></a>');
document.write('					</td>');
document.write('				</tr>');
document.write('				<tr valign=top>');
document.write('					<td style="padding:0px 0 0 3px;font-size:9pt; white-space: nowrap;" align="left">');
document.write('<a style="margin:1px;margin-bottom:0;" onclick="setbookmark(document.title,location.href); clk(\'IEFavourite\')" href="#"><img src="/img/btn_fav.gif" border="0" title="zu Favoriten hinzuf&uuml;gen" alt="zu Favoriten hinzuf&uuml;gen"></a>');
document.write('</td>');
document.write('				</tr>');
document.write('			</table>');
document.write('		</td>');
document.write('	</tr>');
document.write('</table>');
document.write('</div>'); 