function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldonload) {oldonload();} func();
		}
	}
}
function fn_Hover(ob, strKlasse, anaus) {
	if (ob) {if (anaus==true) {ob.className+=strKlasse;} else {ob.className=ob.className.replace(strKlasse,'');}}
}
function fnMyspace(enc_uri) {
	var my=document.getElementById('li_my');
	my.onclick = function() {
		if (document.getElementById('img_my') != null) {
		var s_img=document.createElement('img');
		s_img.setAttribute('src','images/privacy/myspace_20.png');
		s_img.setAttribute('width','20');
		s_img.setAttribute('height','20');
		s_img.setAttribute('alt','');
		var s_a = document.createElement('a');
		s_a.setAttribute('href', 'http://www.myspace.com/Modules/PostTo/Pages/?u='+enc_uri);
		s_a.setAttribute('target','_blank')
		s_a.setAttribute('onclick', 'javascript:window.open(\'http://www.myspace.com/Modules/PostTo/Pages/?u='+enc_uri+',ptm,height=450,width=550\').focus(); return false;');
		s_a.appendChild(s_img);
		my.replaceChild(s_a, my.firstChild);
		}
	}
}
function fnAddthis(uri, title, metadesc) {
	var ad=document.getElementById('li_ad');
	ad.onclick=function() {
	if (document.getElementById('img_ad') != null) {
		var s_img=document.createElement('img');
		s_img.src ='images/privacy/addthis_20.png';
		s_img.width ='20';
		s_img.height ='20';
		s_img.alt = 'Addthis';
		var s_a = document.createElement('a');
		if (document.all) {s_a.className = 'addthis_button';}
		else s_a.setAttribute('class', 'addthis_button');		
		s_a.href='http://www.addthis.com/bookmark.php?v=250&pubid=ra-4ede2a80081f2eae';
		s_a.target='_blank';
		s_a.appendChild(s_img);
		ad.replaceChild(s_a,ad.firstChild);
		
		var s=document.createElement('script');
		s.type='text/javascript';
		s.text='var addthis_config = {data_track_clickback:true, ui_hover_direction:0, ui_click:true, ui_use_embeddable_services_beta:false, services_compact: \'facebook, myspace, google, twitter, favorites, more\'}; ';
		s.text+='var addthis_share = {url: "'+uri+'", title: "'+title+'", description: "'+metadesc+'"};';
		ad.appendChild(s);
		var s1 = document.createElement('script');
		s1.type='text/javascript';
		s1.src='http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4ede2a80081f2eae&domready=1';
		ad.appendChild(s1);
		
		fn_Hover(ad, ' display', false)
		ad.onmouseover = null;
		ad.onmouseout = null;
		}
	}
	ad.onmouseover = function() {fn_Hover(ad, ' display', true);}
	ad.onmouseout = function() {fn_Hover(ad,' display', false);}
}
function fnGplus(uri) {
	var gplus=document.getElementById('li_gplus');
	gplus.onclick = function() {
	if (document.getElementById('img_gplus') != null) {
		gplus.removeChild(document.getElementById('img_gplus')); 
		var txt = document.createElement('div');
		if (document.all) {txt.className='g-plusone';}
		else txt.setAttribute('class','g-plusone');		
		txt.setAttribute('data-size','medium');
		txt.setAttribute('data-annotation','none');
		txt.setAttribute('data-href',uri);
		gplus.appendChild(txt);
		var s = document.createElement('script');
		s.type='text/javascript';
		s.text='window.___gcfg = {lang: \'de\' }; (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true; po.src = \'https://apis.google.com/js/plusone.js\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })();'
		document.body.appendChild(s);
		fn_Hover(gplus, ' display', false)
		gplus.onmouseover = null;
		gplus.onmouseout = null;
		}
	}
	gplus.onmouseover = function() {
		if (gplus.firstChild.nodeName.toUpperCase()==='IMG') gplus.className+=' display'; 
	}
	gplus.onmouseout = function() {
		if (gplus.firstChild.id != 'undefined') {gplus.className=gplus.className.replace(' display','');}
	}
}
function fnFacebook(enc_uri) {
	var fb=document.getElementById('li_fb');
	fb.onclick = function() {
		if (document.getElementById('img_fb') != null) {
			fb.removeChild(document.getElementById('img_fb')); 
			var fb_div = document.createElement('div');
			fb_div.id='fb-root';
			fb.appendChild(fb_div);
		
			window.fbAsyncInit = function () { FB.init({ appId: '209690155784745', status: true, cookie: true, xfbml: true }); }; (function () { var e = document.createElement('script'); e.type='text/javascript'; e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js'; e.async = 1; document.getElementById('fb-root').appendChild(e); } ());
			var fb_e = document.createElement('fb:like');
			fb_e.setAttribute('site',enc_uri);
			fb_e.setAttribute('width','80');
			fb_e.setAttribute('height','22');
			fb_e.setAttribute('send','false');
			fb_e.setAttribute('layout','button_count');
			fb_e.setAttribute('show_face','false');
			fb_e.setAttribute('action','recommend');
			fb_e.setAttribute('font','arial');
			fb.appendChild(fb_e);
			fn_Hover(fb, ' display', false)
			fb.onmouseover = null;
			fb.onmouseout = null;				
		}
	}
	fb.onmouseover = function() {fn_Hover(fb, ' display', true);}
	fb.onmouseout = function() {fn_Hover(fb,' display', false);}
}
function fnTwitter(enc_uri, title) {
	var stext=title;
	if (stext.length>120) {
		var lastWhitespaceIndex=stext.substring(0,length-1).lastIndexOf(' ');
		stext=stext.substring(0,lastWhitespaceIndex)+"\u2026";
	}
	stext=encodeURIComponent(stext);
	var tw_count_url=encodeURIComponent(document.location.protocol+"//"+document.location.host);
	var tw=document.getElementById('li_tw');	
	tw.onclick = function() {
		if (document.getElementById('img_tw') != null) {
			var tw_a = document.createElement('a');
			tw_a.href = 'https://twitter.com/share?via=JazzfreundeLA&lang=de&count=none&url='+enc_uri + '&counturl=' + tw_count_url + '&text=' + stext;
			tw_a.target = '_blank';
			if (document.all) {tw_a.className='tweetbutton';}
			else tw_a.setAttribute('class','tweetbutton');
			tw_a.appendChild(document.createTextNode('Tweet'));		
			tw.replaceChild(tw_a,tw.firstChild);
			fn_Hover(tw, ' display', false);
			tw.onmouseover = null;
			tw.onmouseout = null;
		}
	}
	tw.onmouseover = function() {fn_Hover(tw, ' display', true);}
	tw.onmouseout = function() {fn_Hover(tw, ' display', false);}	
}
function fnPrivacyinfo() {
	var ob=document.getElementById('li_info');
	if (ob) {
	ob.onmouseover = function() {fn_Hover(ob, ' display', true);}
	ob.onmouseout = function() {fn_Hover(ob, ' display', false);}
	}
}
