function school_info(frm)
{
	if (isEmpty(frm.SchoolName))
	{
		alert("Please enter your school name");
		frm.SchoolName.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolName))
	{
		alert("Please enter alphabetic only");
		frm.SchoolName.focus();
		return false;
	}*/

	if (isEmpty(frm.SchoolLocation))
	{
		alert("Please enter your school suburb");
		frm.SchoolLocation.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolLocation))
	{
		alert("Please enter alphabetic only");
		frm.SchoolLocation.focus();
		return false;
	}*/

	if (isEmpty(frm.YourName))
	{
		alert("Please enter your name");
		frm.YourName.focus();
		return false;
	}
	/*if (!isAlpha(frm.YourName))
	{
		alert("Please enter alphabetic only");
		frm.YourName.focus();
		return false;
	}*/
	
	if (isEmpty(frm.YourEmail))
	{
		alert("Please enter your email");
		frm.YourEmail.focus();
		return false;
	}
	if (!isEmail(frm.YourEmail))
	{
		alert("Please enter a valid email");
		frm.YourEmail.focus();
		return false;
	}

	if (isEmpty(frm.PhoneContact))
	{
		alert("Please enter your phone number");
		frm.PhoneContact.focus();
		return false;
	}
	if (!isNumeric(frm.PhoneContact))
	{
		alert("Please enter numeric only");
		frm.PhoneContact.focus();
		return false;
	}

	if (isEmpty(frm.SchoolAssociation))
	{
		alert("Please enter your association with the school");
		frm.SchoolAssociation.focus();
		return false;
	}

	if (!isChecked(frm.SchoolAboutThis))
	{
		alert("Please check any one");
		frm.SchoolAboutThis[0].focus();
		return false;
	}
	if (frm.SchoolAboutThis[9].checked)
	{
		if(isEmpty(frm.SchoolEventDet))
		{
			alert("Please specify the event");
			frm.SchoolEventDet.focus();
			return false;
		}
	}
	if (!frm.SchoolAboutThis[9].checked)
	{
		if(!isEmpty(frm.SchoolEventDet))
		{
			alert("Please select at an event");
			frm.SchoolAboutThis[9].focus();
			return false;
		}
	}
	return true;
}
//------------------------------------------------------------------------------
function students_info(frm)
{
	
	
	if (isEmpty(frm.InpStuSchoolName))
	{
		alert("Please enter your school name");
		frm.InpStuSchoolName.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolName))
	{
		alert("Please enter alphabetic only");
		frm.SchoolName.focus();
		return false;
	}*/

	if (isEmpty(frm.InpStuSchoolSuburb))
	{
		alert("Please enter your school suburb");
		frm.InpStuSchoolSuburb.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolLocation))
	{
		alert("Please enter alphabetic only");
		frm.SchoolLocation.focus();
		return false;
	}*/

	if (isEmpty(frm.InpStuYourName))
	{
		alert("Please enter your name");
		frm.InpStuYourName.focus();
		return false;
	}
	/*if (!isAlpha(frm.YourName))
	{
		alert("Please enter alphabetic only");
		frm.YourName.focus();
		return false;
	}*/
	
	if (isEmpty(frm.InpStuYourEmail))
	{
		alert("Please enter your email");
		frm.InpStuYourEmail.focus();
		return false;
	}
	if (!isEmail(frm.InpStuYourEmail))
	{
		alert("Please enter a valid email");
		frm.InpStuYourEmail.focus();
		return false;
	}

	if (isEmpty(frm.InpStuPhoneContact))
	{
		alert("Please enter your phone number");
		frm.InpStuPhoneContact.focus();
		return false;
	}
	if (!isNumeric(frm.InpStuPhoneContact))
	{
		alert("Please enter numeric only");
		frm.InpStuPhoneContact.focus();
		return false;
	}

	if (isEmpty(frm.InpStuSchoolAssociation))
	{
		alert("Please enter your association with the school");
		frm.InpStuSchoolAssociation.focus();
		return false;
	}

	if (!isChecked(frm.InpStudentsAboutThis))
	{
		alert("Please check any one");
		frm.InpStudentsAboutThis[0].focus();
		return false;
	}
	if (frm.InpStudentsAboutThis[9].checked)
	{
		if(isEmpty(frm.InpStuEventDet))
		{
			alert("Please specify the event");
			frm.InpStuEventDet.focus();
			return false;
		}
	}
	if (!frm.InpStudentsAboutThis[9].checked)
	{
		if(!isEmpty(frm.InpStuEventDet))
		{
			alert("Please select at an event");
			frm.InpStudentsAboutThis[9].focus();
			return false;
		}
	}

	return true;
}
//------------------------------------------------------------------------------
function parents_info(frm)
{
	if (isEmpty(frm.InpParSchoolName))
	{
		alert("Please enter your school name");
		frm.InpParSchoolName.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolName))
	{
		alert("Please enter alphabetic only");
		frm.SchoolName.focus();
		return false;
	}*/

	if (isEmpty(frm.InpParSchoolSuburb))
	{
		alert("Please enter your school suburb");
		frm.InpParSchoolSuburb.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolLocation))
	{
		alert("Please enter alphabetic only");
		frm.SchoolLocation.focus();
		return false;
	}*/

	if (isEmpty(frm.InpParYourName))
	{
		alert("Please enter your name");
		frm.InpParYourName.focus();
		return false;
	}
	/*if (!isAlpha(frm.YourName))
	{
		alert("Please enter alphabetic only");
		frm.YourName.focus();
		return false;
	}*/
	
	if (isEmpty(frm.InpParYourEmail))
	{
		alert("Please enter your email");
		frm.InpParYourEmail.focus();
		return false;
	}
	if (!isEmail(frm.InpParYourEmail))
	{
		alert("Please enter a valid email");
		frm.InpParYourEmail.focus();
		return false;
	}

	if (isEmpty(frm.InpParPhoneContact))
	{
		alert("Please enter your phone number");
		frm.InpParPhoneContact.focus();
		return false;
	}
	if (!isNumeric(frm.InpParPhoneContact))
	{
		alert("Please enter numeric only");
		frm.InpParPhoneContact.focus();
		return false;
	}

	if (isEmpty(frm.InpParSchoolAssociation))
	{
		alert("Please enter your association with the school");
		frm.InpParSchoolAssociation.focus();
		return false;
	}

	if (!isChecked(frm.InpParentsAboutThis))
	{
		alert("Please check any one");
		frm.InpParentsAboutThis[0].focus();
		return false;
	}
	if (frm.InpParentsAboutThis[9].checked)
	{
		if(isEmpty(frm.InpParentsEventDet))
		{
			alert("Please specify the event");
			frm.InpParentsEventDet.focus();
			return false;
		}
	}
	if (!frm.InpParentsAboutThis[9].checked)
	{
		if(!isEmpty(frm.InpParentsEventDet))
		{
			alert("Please select at an event");
			frm.InpParentsAboutThis[9].focus();
			return false;
		}
	}
	return true;
}
//------------------------------------------------------------------------------
function staff_info(frm)
{
	if (isEmpty(frm.InpStaffSchoolName))
	{
		alert("Please enter your school name");
		frm.InpStaffSchoolName.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolName))
	{
		alert("Please enter alphabetic only");
		frm.SchoolName.focus();
		return false;
	}*/

	if (isEmpty(frm.InpStaffSchoolAddress))
	{
		alert("Please enter your school address");
		frm.InpStaffSchoolAddress.focus();
		return false;
	}
	/*if (!isAlpha(frm.SchoolLocation))
	{
		alert("Please enter alphabetic only");
		frm.SchoolLocation.focus();
		return false;
	}*/

	if (isEmpty(frm.InpStaffWorkYourName))
	{
		alert("Please enter your name");
		frm.InpStaffWorkYourName.focus();
		return false;
	}
	/*if (!isAlpha(frm.YourName))
	{
		alert("Please enter alphabetic only");
		frm.YourName.focus();
		return false;
	}*/
	
	if (isEmpty(frm.InpStaffWorkYourEmail))
	{
		alert("Please enter your email");
		frm.InpStaffWorkYourEmail.focus();
		return false;
	}
	if (!isEmail(frm.InpStaffWorkYourEmail))
	{
		alert("Please enter a valid email");
		frm.InpStaffWorkYourEmail.focus();
		return false;
	}

	if (isEmpty(frm.InpStaffWorkPhoneContact))
	{
		alert("Please enter your phone number");
		frm.InpStaffWorkPhoneContact.focus();
		return false;
	}
	if (!isNumeric(frm.InpStaffWorkPhoneContact))
	{
		alert("Please enter numeric only");
		frm.InpStaffWorkPhoneContact.focus();
		return false;
	}

	if (isEmpty(frm.InpStaffWorkYourPosition))
	{
		alert("Please enter your position");
		frm.InpStaffWorkYourPosition.focus();
		return false;
	}
	
	if (!isChecked(frm.InpStaffAboutThis))
	{
		alert("Please check any one");
		frm.InpStaffAboutThis[0].focus();
		return false;
	}
	if (frm.InpStaffAboutThis[9].checked)
	{
		if(isEmpty(frm.InpStaffEventDet))
		{
			alert("Please specify the event");
			frm.InpStaffEventDet.focus();
			return false;
		}
	}
	if (!frm.InpStaffAboutThis[9].checked)
	{
		if(!isEmpty(frm.InpStaffEventDet))
		{
			alert("Please select at an event");
			frm.InpStaffAboutThis[9].focus();
			return false;
		}
	}
	return true;
}
//------------------------------------------------------------------------------
function company_info(frm)
{
	if (isEmpty(frm.CompanyName))
	{
		alert("Please enter your company name");
		frm.CompanyName.focus();
		return false;
	}
	/*if (!isAlpha(frm.CompanyName))
	{
		alert("Please enter alphabetic only");
		frm.CompanyName.focus();
		return false;
	}*/

	if (isEmpty(frm.CompanyAddress))
	{
		alert("Please enter your company address");
		frm.CompanyAddress.focus();
		return false;
	}
	/*if (!isAlpha(frm.CompanyAddress))
	{
		alert("Please enter alphabetic only");
		frm.CompanyAddress.focus();
		return false;
	}*/

	if (isEmpty(frm.WorkYourName))
	{
		alert("Please enter your name");
		frm.WorkYourName.focus();
		return false;
	}
	/*if (!isAlpha(frm.WorkYourName))
	{
		alert("Please enter alphabetic only");
		frm.WorkYourName.focus();
		return false;
	}*/
	
	if (isEmpty(frm.WorkYourEmail))
	{
		alert("Please enter your email");
		frm.WorkYourEmail.focus();
		return false;
	}
	if (!isEmail(frm.WorkYourEmail))
	{
		alert("Please enter a valid email");
		frm.WorkYourEmail.focus();
		return false;
	}

	if (isEmpty(frm.WorkPhoneContact))
	{
		alert("Please enter your phone number");
		frm.WorkPhoneContact.focus();
		return false;
	}
	if (!isNumeric(frm.WorkPhoneContact))
	{
		alert("Please enter numeric only");
		frm.WorkPhoneContact.focus();
		return false;
	}

	if (isEmpty(frm.WorkYourPosition))
	{
		alert("Please enter your position");
		frm.WorkYourPosition.focus();
		return false;
	}

	if (!isChecked(frm.WorkAboutThis))
	{
		alert("Please check any one");
		frm.WorkAboutThis[0].focus();
		return false;
	}
	if (frm.WorkAboutThis[9].checked)
	{
		if(isEmpty(frm.WorkEventDet))
		{
			alert("Please specify the event");
			frm.WorkEventDet.focus();
			return false;
		}
	}
	if (!frm.WorkAboutThis[9].checked)
	{
		if(!isEmpty(frm.WorkEventDet))
		{
			alert("Please select at an event");
			frm.WorkAboutThis[9].focus();
			return false;
		}
	}

	return true;
}
//------------------------------------------------------------------------------
function isChecked(eltObj)
{
	check = false;
	for (i=0; i<eltObj.length; i++)
	{
		if (eltObj[i].checked)
		{
			check = true;
		}
	}
	return check;
}
//------------------------------------------------------------------------------
function checkStu(eltObj,frm)
{

	if(eltObj.length > 0)
	{
		frm.InpStudentsAboutThis[9].checked = true;
	}
	else
		frm.InpStudentsAboutThis[9].checked = false;
}
//------------------------------------------------------------------------------
function checkPar(eltObj,frm)
{
	if(eltObj.length > 0)
		frm.InpParentsAboutThis[9].checked = true;
	else
		frm.InpParentsAboutThis[9].checked = false;
}
//------------------------------------------------------------------------------
function checkStaf(eltObj,frm)
{
	if(eltObj.length > 0)
		frm.InpStaffAboutThis[9].checked = true;
	else
		frm.InpStaffAboutThis[9].checked = false;
}
//------------------------------------------------------------------------------
function checkComp(eltObj,frm)
{
	if(eltObj.length > 0)
		frm.WorkAboutThis[9].checked = true;
	else
		frm.WorkAboutThis[9].checked = false;
}
//------------------------------------------------------------------------------
function isEmpty(eltObj)
{
	strValue	=	eltObj.value;
	if(strValue.length > 0)
	{
		return false;
    }
	return true;
}

//------------------------------------------------------------------------------
function isAlpha(eltObj)
{
	strValue	=	eltObj.value;
	pattern		=	'^[a-zA-Z \.]+$';
	var objRE	=	new RegExp( pattern );
	if(!objRE.test(strValue))
	{
		return false;
	}
	return true;
}

//------------------------------------------------------------------------------
function isAlphaNumeric(eltObj)
{
	strValue	=	eltObj.value;	
	pattern		=	'^[a-zA-Z0-9 ]+$';
	var objRE	=	new RegExp( pattern );
	if(!objRE.test(strValue))
	{
		return false;
	}
	return true;
}

//------------------------------------------------------------------------------
function isNumeric(eltObj)
{
	strValue	=	eltObj.value;
	var pattern		=	'^[0-9+-]+$';
	var objRE	=	new RegExp( pattern );
	if(!objRE.test(strValue))
	{
		return false;
	}
	return true;
}

//------------------------------------------------------------------------------
function isEmail(obj)
{	
	str = obj.value;
	//var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var filter = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	if (!filter.test(str))
	{
		return false;
	}
	return true;
}
function showCompanyEvent(frm)
{
	if(frm.WorkAboutThis[9].checked)
	{
		frm.WorkEventDet.style.display = "block";
		//document.getElementById("trCompEventRow").style.display = "table-row";
	}
	else
	{
		frm.WorkEventDet.style.display = "none";
		//document.getElementById("trCompEventRow").style.display = "none";
	}
}
function showParentEvent(frm)
{
	if(frm.InpParentsAboutThis[9].checked)
	{
		frm.InpParentsEventDet.style.display = "block";
		//document.getElementById("trParEventRow").style.display = "table-row";
	}
	else
	{
		frm.InpParentsEventDet.style.display = "none";
		//document.getElementById("trParEventRow").style.display = "none";
	}
}
function showStaffEvent(frm)
{
	if(frm.InpStaffAboutThis[9].checked)
	{
		//document.getElementById("trStafEventRow").style.display = "table-row";
		frm.InpStaffEventDet.style.display = "block";
	}
	else
	{
		//document.getElementById("trStafEventRow").style.display = "none";
		frm.InpStaffEventDet.style.display = "none";
	}
}
function showStudEvent(frm)
{
	//var boxObj1		= document.getElementById(trRow);
	if(frm.InpStudentsAboutThis[9].checked)
	{
		//boxObj1.style.display	= "";
		//document.getElementById('trStuEventRow').style.display='inline';
		//document.getElementById("trStuEventRow").style.display = "table-row";
  		frm.InpStuEventDet.style.display = "block";
		//document.getElementById(frm.InpStuEventDet).style.display = "block";
	}
	else
	{
		//boxObj1.style.display	= "none";
		//document.getElementById('frm.trStuEventRow').style.display='none';
		frm.InpStuEventDet.style.display = "none";
		//document.getElementById(frm.InpStuEventDet).style.display = "none";
	}
}
