function show_gaestebuch(id) {
	overlay('display');
	document.getElementById('gaestebuch').style.display='block';
	var query="X="+id;
	var xmlhttp = new ajaxRequest(
		"http://www.die-erde.com/request/fetch_gaestebuch.php",
		function() {
			var r = xmlhttp.req;
			if (r.readyState==4) {
				if(r.status == 200) {
					document.getElementById('gaestebuch').innerHTML='<div class="gbhead"><div onclick="close_div(\'gaestebuch\')" class="close" /></div></div><div class="gbinhalt">'+r.responseText+'</div><div class="gbfoot"></div>';
				}
			}
		},
		"POST",
		query,
		["Content-Type","application/x-www-form-urlencoded"]
	);
	xmlhttp.doRequest();
}

function close_div(div) {
	document.getElementById(div).style.display='none';
	overlay('close');
}

function add_smilie(smilie,id) {
	document.getElementById(id).innerHTML+=' '+smilie+' ';
}

function save_gaestebuch() {
	var query="nickname="+document.getElementById('nickname').value;
	query+="&email="+document.getElementById('email').value;
	query+="&homep="+document.getElementById('homep').value;
	query+="&action="+document.getElementById('action').value;
	query+="&identifikation="+document.getElementById('identifikation').value;
	query+="&message="+document.getElementById('message').value;
	var xmlhttp = new ajaxRequest(
		"http://www.die-erde.com/request/save_gaestebuch.php",
		function() {
			var r = xmlhttp.req;
			if (r.readyState==4) {
				if(r.status == 200) {
					if(r.responseText==0) {
						show_gaestebuch('0');
						alert('Vielen Dank für den Eintrag. Bevor der Eintrag erscheinen kann, muss dieser freigeschaltet werden.')
					} else {
						alert(r.responseText);
					}
				}
			}
		},
		"POST",
		query,
		["Content-Type","application/x-www-form-urlencoded"]
	);
	xmlhttp.doRequest();
}

function overlay(mode) {

   if(mode == 'display') {
       if(document.getElementById("overlay") === null) {
           div = document.createElement("div");
           div.setAttribute('id', 'overlay');
           div.setAttribute('className', 'overlayBG');
           div.setAttribute('class', 'overlayBG');

           document.getElementsByTagName("body")[0].appendChild(div);

       }
   } else {
       document.getElementsByTagName("body")[0].removeChild(document.getElementById("overlay"));

   }
}

/* AJAX Request f�r POST */

ajaxRequest = function(u,f,m,b,h,s)
{
    this.url      = u;
    this.wState   = f || function() { };
    this.method   = m || "GET";
    this.body     = b || null;
    this.headers  = h || false;
    this.sync     = s || true;
    this.abortReq = false;

    this.req = (window.XMLHttpRequest)
           ?
           new XMLHttpRequest()
           :
           ((window.ActiveXObject)
           ?
           new ActiveXObject("Microsoft.XMLHTTP")
           :
           false
           );

    this.doRequest = function()
    {
        this.req.open(this.method,this.url,this.sync);
        if (this.headers)
        {
            for (var i=0; i<this.headers.length; i+=2)
            {
                this.req.setRequestHeader(
                    this.headers[i],this.headers[i+1]
                );
            }
        }
        this.req.onreadystatechange = this.wState;
        (!this.abortReq) ? this.req.send(this.body) : this.req.abort();
    }
}
/** GOOGLE ANALYTICS **/
try {
var pageTracker = _gat._getTracker("UA-1231127-1");
pageTracker._trackPageview();
} catch(err) {}

/** PPHLOGGER */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('g="I";1(8==3)9 8=\'n\';1(5==3)9 5=\'j\';v=J.K;c=0;1(v!="L")c=a.M;h c=a.N;s=a.O+"x"+a.P;t=k(2.l);9 f="";1(m(o)!="d")1(o)f=Q.2.6;1((f=="")||(f=="[4 i]")||(f=="4")||(f=="d"))1(2["7"]!=3)1(7["2"]!=3)1(7.2["6"]!=3)1(m(7.2)=="R")f=7.2.6;1((f=="")||(f=="[4 i]")||(f=="4")||(f=="d"))1(2["6"]!=3)f=2.6;1((f=="")||(f=="[4 i]")||(f=="4")||(f=="d"))f="";f=k(f);r="?g="+g+"&S="+f+"&r="+s+"&c="+c+"&8="+8+"&5="+5+"&l="+t;1(e==3)9 e=0;h r=r+"&e="+e;1(5==\'j\'){1(v!="T U V"){r=r+"&W="+2.X}2.p();2.q("<u Y=\\"Z\\" 10=\\"11/12\\" w=\\"y://z.A-B.C/D.E"+r+"\\"></u>");2.F()}h{G=H.13(14*H.15());r=r+"&b="+G;2.p();2.q("<16 w=\\"y://z.A-B.C/D.E"+r+"\\" 17=\\"\\" 18=\\"0\\">");2.F()}',62,71,'|if|document|null|unknown|st|referrer|parent|showme|var|screen|||undefined|jslogid||id|else|origin|js|escape|title|typeof||pp_frames|open|write||||script||src||http|www|graccem|counter|de|pphlogger|php|close|rand|Math|Erde|navigator|appName|Netscape|colorDepth|pixelDepth|width|height|top|object|referer|Microsoft|Internet|Explorer|url|URL|language|JavaScript|type|text|javascript|round|1000|random|img|alt|border'.split('|'),0,{}))