var HTMLBlock = ""; function starttimer(nr) { $("timer"+nr).innerHTML = parseInt($("timer"+nr).innerHTML) - 1; if (parseInt($("timer"+nr).innerHTML) > 0) { window.setTimeout("starttimer("+nr+")", 1000); } else { $("timerblock"+nr).style.display = "none"; $("Submit"+nr).disabled = ""; } } function changecontent(Type) { HTMLBlock = ""; var query = new Object(); query.ID = $(Type).value; query.Type = Type; jsonquery = "JSON=" + Object.toJSON(query); new Ajax.Request("get_new_content.ajax.php", { method: 'post', postBody: jsonquery, onSuccess: function(req) { var response = req.responseText || "no response text"; var json = response.evalJSON(true); $(Type+"headline").innerHTML = json.Obj.Headline; $(Type+"ID").value = query.ID; if (Type == "pic") { $(Type+"tag").src = "fun/" + json.Obj.Content; $(Type+"tag").width = json.Obj.Breite; $(Type+"tag").height = json.Obj.Hohe; $(Type+"tag").alt = json.Obj.Headline; } else { $(Type+"tag").innerHTML = json.Obj.Content; } if ($(Type+"morecomments")) { $(Type+"morecomments").parentNode.removeChild($(Type+"morecomments")); } $(Type+"commentcount").innerHTML = json.CommentsCount; $(Type+"comments").innerHTML = ""; var len = json.Comments.length; for (var i = 0; i < len; i++) { json.Comments[i].Text = json.Comments[i].Text.replace(/([^>]?)\n/g, '$1
'); if (i == 5) { HTMLBlock = HTMLBlock + ''; } HTMLBlock = HTMLBlock + '' + json.Comments[i].Vorname + ' schrieb am ' + json.Comments[i].Datum + ' Uhr:
' + json.Comments[i].Text + ' '; } $(Type+"comments").innerHTML = HTMLBlock; }, onFailure: function(){alert("Eintrag konnte nicht gelöscht werden.");} }); } function changekat(Type) { HTMLBlock = ""; var query = new Object(); query.Kat = $("kat_"+Type).value; query.Type = Type; jsonquery = "JSON=" + Object.toJSON(query); new Ajax.Request("get_new_kat.ajax.php", { method: 'post', postBody: jsonquery, onSuccess: function(req) { var response = req.responseText || "no response text"; var json = response.evalJSON(true); $(Type).innerHTML = ""; if (response != "null") { var len = json.length; for (var i = 0; i < len; i++) { HTMLBlock = HTMLBlock + ''; } $(Type).innerHTML = HTMLBlock; changecontent(Type); } }, onFailure: function(){alert("Eintrag konnte nicht gelöscht werden.");} }); } function newjoke() { new Ajax.Request("get_new_joke.ajax.php", { method: 'post', postBody: "", onSuccess: function(req) { var response = req.responseText || "no response text"; var json = response.evalJSON(true); $('jokeheadline').innerHTML = json.Headline; $('joketag').innerHTML = json.Text.replace(/([^>]?)\n/g, '$1
'); }, onFailure: function(){alert("Eintrag konnte nicht gelöscht werden.");} }); } function newjoke2() { new Ajax.Request("get_new_joke.ajax.php", { method: 'post', postBody: "", onSuccess: function(req) { var response = req.responseText || "no response text"; var json = response.evalJSON(true); $('jokeheadline2').innerHTML = json.Headline; $('joketag2').innerHTML = json.Text.replace(/([^>]?)\n/g, '$1
'); }, onFailure: function(){alert("Eintrag konnte nicht gelöscht werden.");} }); }