//regexp taken from www.fzbkk.com, checkform


/*labels = {
	t_authors: 'Authors',
	t_name: 'Name',
	t_surname: 'Surname',
	t_email: 'E-mail'
}*/


$(document).ready(function(){
        $("input[@type='submit']").click(function(){
          var result = true;
      	
          $("input.required").each(function(){
            if(this.value=='') {
                var msg=$('label[@for='+this.id+']').text().replace(/:/,'');
				alert(msg+' is a required field.');
              result = false;
            };                    
          });
          $("input.email").each(function(){
           if(this.value!='' && !this.value.match("^([\\w\\!\\#\\$\\%\\&\\*\\+\\-\\/\\=\\?\\^\\{\\}\\|\\~]+)((\\.){1}[\\w\\!\\#\\$\\%\\&\\*\\+\\-\\/\\=\\?\\^\\{\\}\\|\\~]+)*@[\\w\\!\\#\\$\\%\\&\\*\\+\\-\\/\\=\\?\\^\\{\\}\\|\\~]+((\\.){1}[\\w\\!\\#\\$\\%\\&\\*\\+\\-\\/\\=\\?\\^\\{\\}\\|\\~]+)+$") ) {
                var msg=$('label[@for='+this.id+']').text().replace(/:/,'');
				alert(msg+' must be in a valid format (e.g. somebody@somewhere.com)');
				result = false;
			}                    
          });
          
          return result
          
          
        });
      });

