﻿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 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("Prosím, vyplňte svoje meno.");
	form.jmeno.focus();
	return false
	}
	else if (!isEmail(form.email.value)) {
		alert("Prosím, skotrolujte svoj email.");
		form.email.focus();
		return false
		}
		else if (isEmpty(form.vzkaz.value))  {
			alert("Prosím, vyplňte svoj odkaz.");
			form.vzkaz.focus();
			return false
			}
			else return true;

}