﻿isIE = (document.all && !window.opera) ? true:false;

window.onload = init;

function init() {
	makeAbbr();  
	if (top.length != self.length) top.location.href = self.location.href; 	
}

function isEmpty(e) {   
    return ((e == null) || (e.length == 0));
}

function isEmptyy(e) {   
    return ((e == null) || (e.length < 4) || (e.length > 12));
}

function isEmail(mail) {
    re = /^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,7}$/;
    return mail.search(re) == 0;
}


function makeAbbr() {
    var oldBodyText, newBodyText, reg
    if (isIE) {
      oldBodyText = document.body.innerHTML;
      reg = /<ABBR([^>]*)>([^<]*)<\/ABBR>/g;
      newBodyText = oldBodyText.replace(reg,'<ABBR $1><SPAN class=\"abbr\" $1>$2</SPAN></ABBR>');
      document.body.innerHTML = newBodyText;
    }
 }

function checkForm(form) {
if (isEmpty(form.jmeno.value)) {
	alert("Please insert your name.");
	form.jmeno.focus();
	return false
	}
	
	else if (!isEmail(form.email.value)) {
		alert("Please enter a valid email address");
		form.email.focus();
		return false
		}
		
	else if (isEmpty(form.jmeeeen.value)) {
	alert("I don't know what is this title");
	form.jmeeeen.focus();
	return false
	}
		
	else if (isEmpty(form.jmen.value)) {
	alert("Please write your message!");
	form.jmen.focus();
	return false
	}
			
			else return true;

}