// *************************************
// * for back-end form validation only *
// *************************************

// ensure that date fields are not empty
function is_date(day, month, year, message)
{
	var error_msg = "";
	
	if (day == "" || month == "" || year == "")
	{
		error_msg = message;
	}
	
	return error_msg;
}

// ensure that compulsory fields are not empty
function is_empty(value, message)
{
	var error_msg = "";
	
	if (value == "")
	{
		error_msg = message;
	}
	
	return error_msg;
}

// ensure that the uploaded image is in .jpg format only
function is_jpg(value, length, position, message)
{
	var error_msg = "";
	
	if (value != "")
	{
		str_count = length - position;
		
		// value must be the same as length of ".jpg", which is 4
		if (str_count != 4)
		{
			error_msg = message;
		}
	}
	
	return error_msg;
}

// ensure that the uploaded video is in .wmv format only
function is_video(value, length, position, message)
{
	var error_msg = "";
	
	if (value != "")
	{
		str_count = length - position;
		
		// value must be the same as length of ".wmv", which is 4
		if (str_count != 4)
		{
			error_msg = message;
		}
	}
	
	return error_msg;
}