function AjaxComment(form) { var url = 'http://weblog.ib.hu-berlin.de/wp-content/themes/unnamed-one-021beta/comments-ajax.php'; if (!$('commentlist')) { new Insertion.Before('pinglist', '
    '); }; new Ajax.Updater( { success: 'commentlist', failure: 'error' }, url, { asynchronous: true, evalScripts: true, insertion: Insertion.Bottom, onLoading: function() { $('commentload').show(); $('error').update(''); $('error').hide(); $('preview').hide(); Form.disable('commentform'); }, onComplete: function(request) { if (request.status == 200) { if ($('leavecomment')) { $('leavecomment').remove(); } new Effect.Appear($('commentlist').lastChild, { duration: 1.0, afterFinish: function() { new Effect.ScrollTo($('commentlist').lastChild); } } ); $('comments').innerHTML = parseInt($('comments').innerHTML) + 1; Field.clear('comment'); Form.disable('commentform'); setTimeout('Form.enable("commentform")',15000); } $('preview').hide(); $('commentload').hide(); }, onFailure: function() { $('error').show(); Form.enable('commentform'); }, parameters: Form.serialize(form) } ); } function AjaxPreview(commentform) { new Ajax.Updater ( 'preview', 'http://weblog.ib.hu-berlin.de/wp-content/themes/unnamed-one-021beta/comments-preview.php', { asynchronous:true, evalScripts:true, parameters:Form.serialize('commentform'), onLoading: function() { $('commentload').show(); $('preview').hide(); Form.disable('commentform'); }, onComplete: function(request) { Effect.Appear('preview'); Form.enable('commentform'); $('commentload').hide(); } } ); } function initComment() { if ( $('commentform') ) { $('commentform').onsubmit = function() { AjaxComment(this); return false; }; $('previewcomment').onclick = function() { AjaxPreview(this); return false; }; new Insertion.Before('commentform', '
    '); new Insertion.After('submit', ''); new Insertion.After('submit',''); $('commentload').hide(); $('preview').hide(); $('error').hide(); } } //Event.observe(window, 'load', initComment, false); FastInit.addOnLoad(initComment);