function validate_null(field, alerttxt) { with (field){
if (value == null || value == "") { alert(alerttxt); return false; }
else { return true; }}}

function validate_email(field,alerttxt){with (field){
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;}
else {return true;}}}

function validate_letters(field,alerttxt){ with (field){
var alphaExp =  /^[a-zA-Zäåö_-]+$/;
if(field.value.match(alphaExp)){return true;}
else{alert(alerttxt); return false;}}}


function validate_form(thisform)
{
with (thisform)
{
if (validate_letters(author,"Name required!, only alphabets allowed.")==false) { author.focus(); ID = document.getElementById("author"); ID.style.border = '2px solid red'; return false; }
if (validate_email(email,"Invalid email address!, check it carefully.")==false) {email.focus(); ID = document.getElementById("email"); ID.style.border = '2px solid red'; return false;}
if (validate_null(comment, "Comment can't be empty.") == false) { comment.focus(); ID = document.getElementById("comment"); ID.style.border = '2px solid red'; return false; }
}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=0,width=700,height=500,left =600,top =0');");
}

