
function radioChecked(id)
{
 	var r = eval("document.forms.question."+id)
 	var i=0;
 	var result = false;
 	
 	if (typeof r.length == 'undefined')
 	{
	 	/* only 1 radio button, needs to be processed differently */
	 	r = document.getElementById(id);
	 	if (r.checked)
	 		return true;
	 		
	 	// nothing selected	
	 	return false;
 	}
 	
	for (i=0; i<r.length; i++) 
	{
		if (r[i].checked) 
		{
			result = true;
		}
	}
	
	return result;	
}

function bothRadioEmpty(yesRadio, noRadio)
{
	var obj1 = document.getElementById(yesRadio);
	var obj2 = document.getElementById(noRadio);	
		
	if ((!obj1.checked) && (!obj2.checked))
			return true;

	return false;
}

function isEmpty(id)
{
	var obj = document.getElementById(id);
	
	if (obj.value.length<=0)
		return true;
		
	return false;
}


function validEmail(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    return false;
		 }

 		 return true;					
}




function validationError(errorList)
{
 	/* check if we have any errors to show */
 	if (errorList=="")
 		return;
 		 		
	alert("Sorry, but you seem to have missed something.\nThis is required in order to proceed further:\n\n"+errorList);
}
