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 + '