function RegisterLinkStat() {
	if(typeof(encodeURIComponent)=='function') {
		var links=document.getElementsByTagName('A');
		for(var i=0; i<links.length; i++) {
			var link=links[i];
			var href=link.href;
			if(href && href.length>0 && (href.substr(0,7)=='http://' || href.substr(0,8)=='https://') && ((href.substring(0,7+location.hostname.length)!='http://' + location.hostname && href.substring(0,8+location.hostname.length)!='https://' + location.hostname) || href.indexOf('/redir/')!==-1)) {
				//var ooc = link.onclick;
				link.onclick=function() {
					//if(typeof(ooc)=='function') ooc.call(link);
					if(this.href.substring(0,27)!='http://logs.soul-network.de') {
						this.oriRef=this.href;
						//this.href='http://logs.soul-network.de/dlcount.php?id=arneblog&url=' + encodeURIComponent(this.href);
					}
					if(pageTracker && pageTracker._trackPageview && typeof(pageTracker._trackPageview)=='function' && typeof(this.oriRef)=='string') {
						pageTracker._trackPageview('outgoing/' + this.oriRef);
					}
					
					return true;
				}
			}
		}
	}
}

function tooglevis(target, srcele, showText, hideText) {
	var ele=document.getElementById(target);
	if(ele.style.display=='none') {
		ele.style.display='';
		srcele.innerHTML=hideText;
	} else {
		ele.style.display='none';
		srcele.innerHTML=showText;
	}
}

function stayInformed() {
	var popup=document.getElementById('informed');
	var handle=popup.getElementsByTagName('h2')[0];
	
	if(popup.style.display=='block') {
		popup.style.display='none';
	} else {
		popup.style.display='block';	
		Drag.init(handle, popup);
	}
}

function getEmail() {
	var d="arne" + "brachhold" + '.de';
	var e="him" + 'se' + "lf";
	var at="@";

	document.write("<a href='mailto:" + e+at+d + "'>" + e+ at +d + "</a>");
}

function donateBox(showService) {
	var s = '<div style="margin-bottom:5px; padding-bottom:5px;">';
	s += '<div class="donateBox">';
	s += '<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	s += '<input type="hidden" name="cmd" value="_xclick">';
	s += '<input type="hidden" name="business" value="donate@arnebrachhold.de">';
	s += '<input type="hidden" name="item_name" value="Wordpress Plugins">';
	s += '<input type="hidden" name="currency_code" value="USD">';
	
	s += '<div class="donateLink donateLinkPayPal"><a href="http://www.arnebrachhold.de/redir/paypal/">Donate with PayPal</a></div>';
	s += '<div class="donateContent">Amount: <input type="text" name="amount" id="donateValue" class="donateBoxValue" />$ <input class="donateSubmit" type="submit" value="&gt;&gt;" /></div>';
	
	s += '</form>';
	s += '</div>';
	
	s += '<div class="donateBox">';
	s += '<div class="donateLink donateLinkAmazon"><a href="http://www.arnebrachhold.de/redir/amazon/">Amazon.de Wishlist</a></div>';
	s += '<div class="donateContent">Make me happy :)</div>';
	s += '</div>';
	
	if(showService && 1==2) {	

		s += '<div class="donateBox">';
		s += '<div class="donateLink donateLinkInstall"><a href="http://www.arnebrachhold.de/static/support-request/">Installation-Service</a></div>';
		s += '<div class="donateContent">Don\'t have time to install?</div>';
		s += '</div>';
	}
	
	s += '</div><div style="clear:both; height:5px;"></div>';
	document.write(s);
}


function subscribeStatus(status,message) {
		var text = $("subscribe_text");
		if(status == 0) {
			text.style.color="red";
		} else if(status == 1) {
			text.style.color="green";
		} else {
			text.style.color="black";
		}
		
		text.innerHTML = message;
}

function subscribe() {	
	$("subscribe_text").style.display='';
	subscribeStatus(-1,"Sending...");			
	var opt = {
		method: 'post',
		postBody: 'email=' + $('subscribe_email').value,
		onSuccess: function(t) {
			var status = 0;
			var message = "Request Error";
			if(t.responseXML) {
				var xml = t.responseXML;
				if(xml.firstChild) {
					var msg = xml.firstChild;
					if(msg.nodeName=="message") {
						var stat = msg.getAttribute("status");
						if(stat == "0" || stat == "1") {
							status = stat;
						}
						
						if(msg.firstChild) {
							message = msg.firstChild.nodeValue;
						}
						
					}
				}
			}
			subscribeStatus(status,message);

		},
		onFailure: function(t) {
			subscribeStatus(0,"Request Error");
		}
	}
	
	new Ajax.Request('/wp-content/subscribe/', opt);
}

function blueStat() {

}

function dlLink(lnk) {
	if(typeof(urchinTracker)=='function') urchinTracker(lnk);
	return true;
}

function displayAd(zoneid) {
   var m3_u = (location.protocol=='https:'?'https://stripe.soul-network.de/www/delivery/ajs.php':'http://stripe.soul-network.de/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=" + zoneid + "&amp;block=1&amp;blockcampaign=1");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");

}