function check()
{
var cansubmit=true;
if (
	(!IsNumeric(document.getElementById("yearofbirth").value)) ||
	(!IsNumeric(document.getElementById("monthofbirth").value)) ||
	(!IsNumeric(document.getElementById("dayofbirth").value))||
	(document.getElementById("monthofbirth").value>12)||
	(document.getElementById("dayofbirth").value>31)||
	(document.getElementById("monthofbirth").value<1)||
	(document.getElementById("dayofbirth").value<1)
	)
{
	cansubmit=false;
	alert("Please check your birthdate!");
}
if 
(document.getElementById("abstract").value.length>1200)
{
	
	alert("Abstract too long!");
	cansubmit=false;
}


 var node_list = document.getElementsByTagName('input');
 var hasnonansweredfield=false; 
 for (var i = 0; i < node_list.length; i++) {
     var node = node_list[i];
  
     if (node.getAttribute('type') == 'text') {
         if (node.value=="")
		 {
         hasnonansweredfield=true;
		 }
     }
 }

if ((document.getElementById("prtitle").value.length<1)||(document.getElementById("abstract").value.length<1))
{
hasnonansweredfield=true;
}

if (hasnonansweredfield||
document.getElementById("nationality").value==""||
document.getElementsByName("country").value==""||
document.getElementById("section").value==""||
getCheckedValue(document.getElementsByName("gender"))==""||
getCheckedValue(document.getElementsByName("excursion"))=="")
{
cansubmit=false;
alert("Please answer all questions!");
}



if (cansubmit)
	{
	document.form1.submit();
	}
}




function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   
   
   function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}






