<\/div>";
}
}
// Comments Preview Box
function commPrev() {
var komentarBox = document.getElementById('commentform');
/* checks if there is existence of form with an id "commentform" */
if (komentarBox) {
/* when "author" field looses focus */
document.getElementById('author').onblur = function() {
/* write in the "namePrev" content of the "author" field */
document.getElementById('namePrev').innerHTML = document.getElementById('author').value.replace(/(\n|\r)/g,'
').replace(/(
){2,}/gi,'<'+'\/p>
');
/* write uri into the href attribute of a link to "author's" web site */
document.getElementById('commPrev').getElementsByTagName('div')[0].getElementsByTagName('a')[0].setAttribute('href','http://'+document.getElementById('url').value.replace('http://',''));
/* write in the "messagePrev" content of the "comment" field */
document.getElementById('messagePrev').innerHTML = '
'+document.getElementById('comment').value.replace(/(\n|\r)/g,'
').replace(/(
){2,}/gi,'<'+'\/p>
')+'<'+'\/p>';
}
/* following are doing the same thing as above, but are triggered by "onkeyup" event */
document.getElementById('comment').onkeyup = function() {
document.getElementById('messagePrev').innerHTML = '
'+document.getElementById('comment').value.replace(/(\n|\r)/g,'
').replace(/(
){2,}/gi,'<'+'\/p>
')+'<'+'\/p>';
}
document.getElementById('author').onkeyup = function() {
document.getElementById('namePrev').innerHTML = document.getElementById('author').value.replace(/(\n|\r)/g,'
').replace(/(
){2,}/gi,'<'+'\/p>
');
}
document.getElementById('url').onkeyup = function() {
document.getElementById('commPrev').getElementsByTagName('div')[0].getElementsByTagName('a')[0].setAttribute('href','http://'+document.getElementById('url').value.replace('http://',''));
}
}
}
window.onload = function() {
writeTags();
commPrev();
}