<!--
if (window != window.top) {top.location.href=location.href;}
if (document.URL.match(/p=|q=|u=/)) {top.location.href='http://shoutbox.widget.me';}
if (document.referrer.match(/gaestebuecher/)) {top.location.href='http://gaestebuecher.cc';}


if (typeof(navigator.language) != "undefined") {
lang=navigator.language;
} else if (typeof(navigator.browserLanguage) != "undefined") {
lang=navigator.browserLanguage;
} else {
lang='undefined';
}


function loaded() {
setInterval("loadStream();",10000);
contentStream=document.getElementById("content");
contentStream.onmouseover=function(){biggerContent();};

windowWidth();
loadStream();
pushID();

if (lang.match(/zh|zh-CN|zh-HK/)) {
document.getElementsByTagName('body')[0].style.display='none';
}
}


function windowWidth() {
if (document.body.clientWidth < 660) {
self.resizeTo('660',screen.availHeight);
}
}


function pushID() {
keiten=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
moeglich=keiten.length;
zufall_1_1=Math.random(); zufall_1_2=zufall_1_1*moeglich; zufall_1_3=Math.floor(zufall_1_2);
zufall_2_1=Math.random(); zufall_2_2=zufall_2_1*moeglich; zufall_2_3=Math.floor(zufall_2_2);
zufall_3_1=Math.random(); zufall_3_2=zufall_3_1*moeglich; zufall_3_3=Math.floor(zufall_3_2);
zufall_4_1=Math.random(); zufall_4_2=zufall_4_1*moeglich; zufall_4_3=Math.floor(zufall_4_2);
zufall_5_1=Math.random(); zufall_5_2=zufall_5_1*moeglich; zufall_5_3=Math.floor(zufall_5_2);
zufallsid=keiten[zufall_1_3]+keiten[zufall_2_3]+keiten[zufall_3_3]+keiten[zufall_4_3]+keiten[zufall_5_3];

boxContent=document.getElementById("codeBox");
boxContent.onmouseover=function(){this.focus();this.select();};
boxOriginal=boxContent.innerHTML;

searchText='YOURID';
replaceText=zufallsid;
getResults=goReplace(boxOriginal, searchText, replaceText);

searchText='<';
replaceText='&lt;';
getResults=goReplace(getResults, searchText, replaceText);

boxContent.innerHTML=getResults;
}


function goReplace(sourceText, searchText, replaceText){
if ((sourceText == null) || (searchText == null))   { return null; }
if ((sourceText.length == 0) || (searchText.length == 0))   { return sourceText; }
if ((replaceText == null) || (replaceText.length == 0)){ replaceText = ""; }

var LaengesearchText = searchText.length;
var LaengereplaceText = replaceText.length;
var Pos = sourceText.indexOf(searchText, 0);

while (Pos >= 0) {
sourceText = sourceText.substring(0, Pos) + replaceText + sourceText.substring(Pos + LaengesearchText);
Pos = sourceText.indexOf(searchText, Pos + LaengereplaceText);
}
return sourceText;
}


function loadStream() {
try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) { /* do nothing */ }

zid = Math.random();
zid *= 10000000000000;
zid = Math.ceil(zid);

sourcefile='user/latest_messages.html?zid='+zid;
xmlhttp.onreadystatechange = triggeredStream;
xmlhttp.open("GET", sourcefile);
xmlhttp.send(null);
}

function triggeredStream() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {

getResults='';
getContent=xmlhttp.responseText;
sortContent=getContent.split('\n');

for (var i = 0; i < sortContent.length; ++i) {
partContent=sortContent[i].split('|');

if (partContent[0]) {
if (partContent[3]) {
getVia='title="via '+partContent[3]+'"';
}else{
getVia='';
}

getResults=getResults+partContent[0]+': <a '+getVia+' href="javascript:getShoutbox(\''+partContent[1]+'\');">'+partContent[2]+'</a><br>';
}
}

contentStream.innerHTML=getResults;
}
}
}


function getShoutbox(getUid) {
open('open.html?uid='+getUid,'popup','scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=250,height=400');
}

function biggerContent() {
contentStream.style.height='200';
}
//-->
