<!--
function cleanit(thefield) {
if (thefield.defaultValue==thefield.value) {
thefield.value='';
}
}


str=location.href;

function getvalue(strArg) {
var _url=str + "&";
var regex=new RegExp("(\\?|\\&)" + strArg + "=([^\\&\\?]*)\\&", "gi");
if (! regex.test(_url)) return "";
var arr=regex.exec(_url);
return (RegExp.$2);
}

uid=getvalue("uid");
rec=getvalue("rec");


iref=document.referrer;
if (iref.match(/widget.me/)) {
iref='';
}


loadingNow='';

function loadStream() {
if(loadingNow == 'i'){}else{

loadingNow='i';
loadingOpened();

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/'+uid+'.html?zid='+zid;

xmlhttp.onreadystatechange=triggeredStream;
xmlhttp.open("GET", sourcefile);
xmlhttp.send(null);
}
}


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

manageData();
document.getElementById("messages").innerHTML=getResults;
setTimeout("loadingClosed();",1000);
loadingNow='';
}
}
}


function manageData() {
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[4]) {
getVia=' <a href="http://'+partContent[4]+'" title="via '+partContent[4]+'" target="_top">#</a>';
}else{
getVia='';
}

if (partContent[1].match(/href/)) {
getRe='';
}else{
getRe='onmouseup="reply(event,\''+partContent[1]+'\');" ';
}

getResults=getResults+'<div class="message" '+getRe+' id="'+partContent[0]+'"><b>'+partContent[1]+'</b> '+partContent[2]+'</div><div class="details">'+partContent[3]+getVia+'</div>';
}
}
}


counterKey='0';
counterKey=parseInt(counterKey);
getResults='';

function pushPreview() {
inick=document.fsb.inick.value;
itext=document.fsb.itext.value;

if (inick && itext) {
getMyTime();
getPreview='<div class="message"><b>'+inick+'</b> '+itext+'</div><div class="details">'+idate+' '+itime+'</div>';
}else{
getPreview='';
}
document.getElementById("messages").innerHTML=getPreview+getResults;
counterKey=counterKey+1;
}


function getMyTime() {
var Jetzt=new Date();
var Tag=Jetzt.getDate();
var Monat=Jetzt.getMonth() + 1;
var Jahr=Jetzt.getYear();
var Stunden=Jetzt.getHours();
var Minuten=Jetzt.getMinutes();
var Sekunden=Jetzt.getSeconds();

var Tag_Null=((Tag < 10) ? "0" : "");
var Monat_Null=((Monat < 10) ? ".0" : ".");
var Stunden_Null=((Stunden < 10) ? "0" : "");
var Minuten_Null=((Minuten < 10) ? ":0" : ":");
var Sekunden_Null=((Sekunden < 10) ? ":0" : ":");
if (Jahr<2000) Jahr=Jahr+1900;

idate=Tag_Null + Tag  + Monat_Null + Monat + "." + Jahr;
itime=Stunden_Null + Stunden + Minuten_Null + Minuten + Sekunden_Null + Sekunden;
}


stopStream='';

function startLive() {
stopStream=setInterval("loadStream();",15*1000);
}


function loadStart() {
document.getElementById("name").onkeyup=function(){pushPreview();}
document.getElementById("message").onkeyup=function(){pushPreview();}
document.getElementById("shout").onmouseover=function(){onmouseAction();};
if(rec == 'i'){document.getElementById('fsb').style.display='none';}
stopLive=setTimeout("startLive();",5*1000);
setInterval("startCounter();",1000);

loadStream();
cookieRead();

if(cookieReaded == 'i'){
document.getElementById("fsb").onmouseover=function(){focusText();};
}
}


function onmouseAction() {
document.getElementById('name').style.display='block';
document.getElementById('url').style.display='block';
}


focusDone='';

function focusText() {
if(focusDone == 'i'){}else{
document.fsb.itext.value='';
document.fsb.itext.focus();
focusDone='i';
}
}


counterRead='0';
counterRead=parseInt(counterRead);

function startCounter() {
counterRead=counterRead+1;
}


function loadingOpened() {
document.fsb.shout.value='Refreshing';
}

function loadingClosed() {
document.fsb.shout.value='Refreshed';
setTimeout("document.fsb.shout.value='Shout';",1500);
}


workingNow='';

function sendMsg() {
if(workingNow == 'i'){}else{

workingNow='i';
document.getElementById('shout').disabled=true;
loadingOpened();

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

getMyTime();
itext=itext.replace(/&/g,' ');
itext=itext.replace(/;/g,':');

inick=inick.replace(/&/g,' ');
inick=inick.replace(/;/g,':');

sourcefile='default.pl?service=save&uid='+uid+'&idate='+idate+'&itime='+itime+'&istat='+counterRead+'|'+counterKey+'&inick='+inick+'&itext='+itext+'&iurl='+document.fsb.iurl.value+'&iref='+iref;
xmlhttp.onreadystatechange=finalMsg;
xmlhttp.open("GET", sourcefile);
xmlhttp.send(null);
}
}


preName='';
counterSend='0';
counterSend=parseInt(counterSend);

function finalMsg() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var ianswer=xmlhttp.responseText;
loadingClosed();
workingNow='';

counterKey='0';
counterKey=parseInt(counterKey);
setTimeout("document.getElementById('shout').disabled=false;",500);
document.fsb.iurl.value='http://';
focusDone='';
focusText();

if (ianswer == "0") {
if (counterSend > 2 && preName == inick) {
document.getElementById('name').style.display='none';
}

if (counterSend > 1 && preName == inick) {
document.getElementById('url').style.display='none';
}

if (preName == inick) {}else{
counterSend='1';
counterSend=parseInt(counterSend);
}

preName=inick;
counterSend=counterSend+1;
clearTimeout(stopLive);
clearInterval(stopStream);
startLive();
loadingNow='';
loadStream();
}

if (ianswer == "1") { alert("Sorry, no user id found"); }
if (ianswer == "2") { alert("Sorry, no correct name found"); }
if (ianswer == "3") { alert("Sorry, no correct message found"); }
if (ianswer == "4") { alert("Sorry, your Name too long"); }
if (ianswer == "5") { alert("Sorry, your Message too long"); }
if (ianswer == "6") { alert("Sorry, your Message already exist"); }
}
}
}


function clearText(formular) {
if (formular.inick.value == "") {
formular.inick.focus();
return (false);

}else if(formular.itext.value == "" || formular.itext.value == "Message"){
formular.itext.value='';
formular.itext.focus();
return (false);

}else{
cookieSave();
sendMsg(formular);
return (false);
}
}


function cookieSave() {
var a=new Date();
a=new Date(a.getTime() +1000*60*60*24*365);
if (inick == 'Guest' || inick == '') {}else{
document.cookie='|chat|'+inick+'|; expires='+a.toGMTString()+';'; 
}
}

cookieReaded='';

function cookieRead() {
if(cookieReaded == 'i'){}else{
if(document.cookie){
cookie_content_all=document.cookie;
cookie_content=cookie_content_all.split (';');

for (var i=0; i < cookie_content.length; ++i) {
cookie_content_line=cookie_content[i];
cookie_content_part=cookie_content_line.split ('|');
if (cookie_content_part[1] == 'chat') {
document.fsb.inick.value=cookie_content_part[2];
cookieReaded='i';
}
}

}
}
}


function reply(e,nick){
var rightclick;
if (!e) var e=window.event;
if (e.which) rightclick=(e.which == 3);
else if (e.button) rightclick=(e.button == 2);
if(!rightclick) return true;

var interupt=true;
document.oncontextmenu=function(){if(interupt){interupt=false;return false;};};
if (document.fsb.itext.value == "Message") { document.fsb.itext.value=''; focusDone='i'; }
document.fsb.itext.focus(); document.fsb.itext.value=document.fsb.itext.value+" @"+nick+" ";
}


function getArchive() {
open('default.pl?service=history&uid='+uid,'history','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=400,height=400');
}
//-->
