/**
 * Code by Sarte
 * www.ssmss.de
 * www.rezesarios.de
 * last edit 2009-06-3
 */

var ajax=createXmlHttpRequestObject();var showErrors=true;function buchinit(){var form=document.getElementById('s_g_e');var name=form.getElementsByTagName('input')[0];var page=form.getElementsByTagName('input')[1];var text=form.getElementsByTagName('textarea')[0];name.value='';page.value='http://';text.value='';CreateToolTip();}var mouseX,mouseY;var tempvisible=0.1;function CreateToolTip(){var root=document.getElementsByTagName('body')[0];var tooltip=document.createElement('div');tooltip.id='tooltip';root.appendChild(tooltip);}function ToolTip(e){var tooltip=document.getElementById('tooltip');getMouseXY(e);tooltip.style.top=(mouseY+10)+'px';tooltip.style.left=(mouseX+10)+'px';tooltip.style.opacity=tempvisible;tooltip.style.MozOpacity=tempvisible;tooltip.style.display='block';Erscheinenlassen();}function UnToolTip(){var tooltip=document.getElementById('tooltip');tooltip.style.display='none';tempvisible=0.1;}function getMouseXY(e){if(window.ActiveXObject){mouseX=window.event.x+document.body.scrollLeft;mouseY=window.event.y+document.body.scrollTop;}else{mouseX=e.pageX;mouseY=e.pageY;}}function Erscheinenlassen(){if(tempvisible<1.1){document.getElementById('tooltip').style.MozOpacity=tempvisible;document.getElementById('tooltip').style.opacity=tempvisible;tempvisible=tempvisible+0.1;setTimeout("Erscheinenlassen()",30);}}function aktualisieren(limit){var tempcache='';if(xmlHttp){var buchloader=document.createElement('img');buchloader.src='../images/buchloader.gif';buchloader.alt='';buchloader.id='s_g_loader';var uldiv=document.getElementById('s_g_bb');uldiv.innerHTML='';uldiv.appendChild(buchloader);tempcache='limit='+limit;try
{if((xmlHttp.readyState==4||xmlHttp.readyState==0)){xmlHttp.open("POST","aktualisieren.php",false);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(tempcache);handleRequestofAktuell();}}catch(e){displayError(e.toString());}}}function handleRequestofAktuell(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){try
{readRequestofAktuell();}catch(e){displayError(e.toString());}}else
{displayError(xmlHttp.statusText);}}}function readRequestofAktuell(){var response=xmlHttp.responseText;var uldiv=document.getElementById('s_g_bb');uldiv.innerHTML='';uldiv.innerHTML=response;}function Eintragsenden(){var tempcache='';if(xmlHttp){var eintragbutton=document.getElementById('eintragbutton');var loader=document.getElementById('loader');eintragbutton.className="hideE";loader.className="showE";document.getElementById('bild1').className='error hideE';document.getElementById('bild3').className='error hideE';document.getElementById('s_g_l').style.marginRight='17px';var form=document.getElementById('s_g_e');var name=form.getElementsByTagName('input')[0];var page=form.getElementsByTagName('input')[1];var text=form.getElementsByTagName('textarea')[0];var username=encode(name.value);var webpage=encode(page.value);var text=encode(text.value);if(username.length>=9){document.getElementById('bild1').className='error';document.getElementById('s_g_l').style.marginRight='1px';document.getElementById('tooltip').innerHTML="Ihr Name ist zu lang";eintragbutton.className="showE";loader.className="hideE";return false;}tempcache="username="+username+"&webpage="+webpage+"&request="+text;try
{if((xmlHttp.readyState==4||xmlHttp.readyState==0)){xmlHttp.open("POST","eintragen.php",true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.onreadystatechange=handleRequestofEintrag;xmlHttp.send(tempcache);}}catch(e){displayError(e.toString());}}}function handleRequestofEintrag(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){try
{readRequestofEintrag();}catch(e){displayError(e.toString());}}else
{displayError(xmlHttp.statusText);}}}function readRequestofEintrag(){var response=xmlHttp.responseText;var eintragbutton=document.getElementById('eintragbutton');var loader=document.getElementById('loader');if(response.indexOf('Namen')>=0){document.getElementById('bild1').className='error';document.getElementById('s_g_l').style.marginRight='1px';document.getElementById('tooltip').innerHTML="Bitte geben Sie Ihren Namen an";eintragbutton.className="showE";}if(response.indexOf('nichts')>=0){document.getElementById('bild3').className='error ShowE';document.getElementById('tooltip').innerHTML="Sie haben nichts eingegeben.";eintragbutton.className="showE";}if(response.indexOf('Eintrag')>=0){document.getElementById('bild3').className='error ShowE';document.getElementById('tooltip').innerHTML="Sie können nur einen Eintrag pro Tag machen.";eintragbutton.className="showE";}if(response.indexOf('Erfolgreich')>=0){document.getElementById('bild3').src='../images/correct.png';document.getElementById('bild3').className='error ShowE';document.getElementById('tooltip').innerHTML="Vielen Dank. Sie haben sich erfolgreich eingetragen.";aktualisieren(10);}loader.className="hideE";}function createAjax(){var ajax;try
{ajax=new XMLHttpRequest();}catch(e){var XmlHttpVersions=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var i=0;i<XmlHttpVersions.length&&!ajax;i++){try
{ajax=new ActiveXObject(XmlHttpVersions[i]);}catch(e){}}}if(!ajax)displayError("Error creating the XMLHttpRequest object.");else
return ajax;}function encode(uri){if(encodeURIComponent){return encodeURIComponent(uri);}if(escape){return escape(uri);}}