function check_empty(text){
	var value="";
	value = text;
	if(value == ""){return false;}
	if(value.match(/[^\s.+]/)){return true;}
	return true;
}

function check_email(this_handle)
{		
		if(!check_empty(this_handle)){ return false; }
		var form_value="";
		form_value = this_handle;
		
		if(form_value.match(/\w.+\@\w.+\.(\b[a-zA-Z]{2,4}\b)/)){ return true; }
		else { return false; }
}

function is_leapyear(j) {
		return ((j % 4 == 0) && ((j % 100!= 0) || (j % 400 == 0)));	
}
function check_date(this_handle)
	{
		var datestring=""; var text = ""; var numbers="";  
		var day =0; var month =0; var year =0; var currYear =0; 
		var currDate = new Date(); 
		var currYear = currDate.getFullYear();
		var dateNumber ="";
		datestring = this_handle;
		if (datestring.length < 8) {return true;}
		
		numbers = datestring.split("/");
		if (numbers.length != 3) {return true;}


		mtage = new Array (0,31,28,31,30,31,30,31,31,30,31,30,31);
		day   = numbers[0]*1;	
		month = numbers[1]*1;
		year  = numbers[2]*1;
		
		
		if (is_leapyear(year)){mtage[2] = 29};
		if (year  >= currYear || year  > 2020)			
		{return true;}
		if ((month < 1) || (month > 12))			
		{return true;}
		if ((day < 1) || (day > mtage[month]))	
		{return true;}

		if (day   < 10){day   = "0" + day   }		
		if (month < 10){month = "0" + month }

		this_handle = (day + "/" + month + "/" + year);

 	return false;
}

function check_one_selected(this_form) {
	var thisdoc = this_form;
	var thislength = thisdoc.length;
	var oneselected = 0
	for (i=0; i < thislength; i++) {
		if (thisdoc.elements[i].type == 'checkbox') {
			if (thisdoc.elements[i].checked == true) {
				oneselected = 1;
			}
		}
	}
	if (oneselected == 0) {
		return false;}
	else
		return true;
}

