win=null;

window.onerror = null; 

function msgw(t1,t2) {
   win=window.open("", "msg", "width=250,height=100");
   win.document.open("text/html");
   win.document.writeln("<head><title>Error</title></head>");
   win.document.writeln("<body><ul>");
   win.document.writeln(t1);
   win.document.writeln("<br>");
   win.document.writeln(t2);
   win.document.writeln("<br>");
   win.document.writeln("<center>");
   win.document.writeln("<form><input type=button value=o.k. onclick=self.window.close()></form>");
   win.document.writeln("</center>");
   win.document.writeln("</ul></body>");
   win.document.close();
   if(win.focus != null) win.focus();
}

function check_email(f)
{
 var em	= f.email.value;
 
 var res = false;

 {
  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
  res = (reg.test(em));
 }
  if (!res) {
      msgw('Please enter a valid email address','');
  }
  else {
      f.submit();
   }
 }

function check_data(f) {
var fn	= f.firstname.value;
var n	= f.name1.value;
var i	= f.institute.value;
var m	= f.mail.value;
var res = false;
// var a   = f.agree.checked;

reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');

res = (reg.test(m));

   if (fn=="" || n=="" || i=="" ||m=="") {
      msgw('Please fill in all data!','');
   }

   else if (!res) {
      msgw('Please enter a valid email address!','')
 }
   else if (!f.agree.checked)
  { msgw('Please give your agreement with copyright/citiation!','');
   }
//   else if (a!="yes")
//  { msgw('Please enter yes or no!','');
//   }
   
   else {
      f.submit();
   }
}

