function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari, IE7+ xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer 6 try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { // Internet Explorer 5 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function getFocus(elem) { if ((elem.value=="") || (elem.className=="comments")) { elem.className = "editcomment"; elem.value = ""; } } function releaseFocus(elem) { if ((elem.value=="") || (elem.value=="Schreibe einen Kommentar...")) { elem.className = "comments"; elem.value = "Schreibe einen Kommentar..."; } } function delEntry(id) { var xmlHttp=null; if (confirm("Eintrag entfernen?")) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } xmlHttp.open("POST","fnc/comment_dbfs.php?action=del&id=" + id,false); xmlHttp.send(null); } } function getComments(raceId,showAll,commentId) { var xmlHttp=null; if (!raceId) raceId="0"; if (showAll || showAll == "0") {showAll = "&showAllComments=" + showAll;} else {showAll = "";} if (commentId) {commentId = "&showFullComment=" + commentId;} else {commentId = "";} function stateChanged() { if (xmlHttp.readyState==4) { var xmldata = xmlHttp.responseText; if (xmldata) { document.getElementById("cDiv" + raceId).innerHTML = xmldata; } } } xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } //alert("fnc/comments.php?raceid=" + raceId + showAll + commentId); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET","fnc/comments.php?raceid=" + raceId + showAll + commentId,true); xmlHttp.send(null); } function setComment(raceid) { var xmlHttp=null; if (!raceid) raceid=0; if (document.getElementById("tcomment" + raceid).className != "comments") { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } xmlHttp.open("POST","fnc/comment_dbfs.php?action=ins&text=" + encodeURI(document.getElementById("tcomment" + raceid).value) + "&raceid=" + raceid,false); xmlHttp.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); xmlHttp.overrideMimeType("UTF-8"); xmlHttp.send(null); } } function showFullComment(raceId, commentId) { getComments(raceId, "", commentId); }