function focus() {
for (a=0;a<document.links.length;)
document.links[a].onfocus=document.links[a++].blur;
}

function se(a,b) {
	window.location.href = 'mailto:'+a+'@'+b+'.pl';
}


function flip(rid) {
	current=(document.getElementById(rid).style.display == 'none') ? 'block' : 'none';
	document.getElementById(rid).style.display = current;
}

function set(rid,mode) {
 if (document.getElementById(rid)) {
      current=(mode == 1) ? 'block' : 'none';
      document.getElementById(rid).style.display = current;
 }
}

function opensmallwindow(w,h) {
 smallwindow = window.open("", "smallwindow", "width="+w+", height="+h+", toolbar=no, scrollbars=yes");
 x = (screen.Width/2)-(w/2);
 y = (screen.Height/2)-(h/2);
 smallwindow.moveTo(x,y);
 smallwindow.focus();
}

function opensmallwindow1(w,h) {
 smallwindow = window.open("", "smallwindow", "width="+w+", height="+h+", toolbar=no, scrollbars=no");
 x = (screen.Width/2)-(w/2);
 y = (screen.Height/2)-(h/2);
 smallwindow.moveTo(x,y);
 smallwindow.focus();
}

function validateform() {
 for(var i=0; i<fields.length; i++) {
  if (document.fo.elements[fields[i]].value == '' || document.fo.elements[fields[i]].value == 0) {
   alert(fields_info[i]);
   document.fo.elements[fields[i]].focus();
   return false;
  }
 }
 if (validateemail(document.fo.elements['Email'].value)) {
  return true;
 } else {
  return false;
 } 
}

function validateemail(t) {
  maska = /^[0-9a-z_.-]+@([0-9a-z-]+.)+[a-z]{2,4}$/;
  if (maska.test(t)==false) { 
    alert("Podaj poprawny adres e-mail");
    document.fo.elements['Email'].focus();
    return false;
  }
  return true;
}
