//Passes focus to next date field after entry of checklen chars
function skipfield(checkobj, nextfield, checklen)
{
	if(checkobj.value.length >= checklen)
		nextfield.focus()
}

function PCaseMe(obj)
{
	var strValue = obj.value
	var strReturn= "";
	var iTemp = strValue.length;
	var UcaseNext = false;	

	if(iTemp>=1)
	{
		strReturn += strValue.charAt(0).toUpperCase();
	
		for(var iCount=1;iCount < iTemp;iCount++)
		{
			if(UcaseNext == true){
				strReturn += strValue.charAt(iCount).toUpperCase();
			}
			else{
				strReturn += strValue.charAt(iCount).toLowerCase();
			}

			var iChar = strValue.charCodeAt(iCount);
			if(iChar == 32 || iChar == 45 || iChar == 46){
				UcaseNext = true;
			}
			else{
				UcaseNext = false
			}

			if(iChar == 99 || iChar == 67){
				if(strValue.charCodeAt(iCount-1)==77 || strValue.charCodeAt(iCount-1)==109){
				UcaseNext = true;
				}
			}
		} //End For
		obj.value = strReturn;
	} //End if
}

function ValidateForm()
{
	var cerr = ''
	
	if(document.Form1.ddGender.selectedIndex == 0)
		cerr += 'Gender is required\n';

	if(document.Form1.txtday.value == '' || document.Form1.txtMonth.value == '' || document.Form1.txtYear.value == '')
		cerr += 'Date of birth is required\n';

	if(document.Form1.ddmaritalStatus.selectedIndex == 0)
		cerr += 'Marital status is required\n';

	if(document.Form1.ddlRelationship.selectedIndex == 0)
		cerr += 'Relationship to proposer is required\n';

	if(document.Form1.ddOccupation.selectedIndex == 0)
		cerr += 'Occupation is required\n';

	if(document.Form1.ddBusnessEmployer.selectedIndex == 0)
		cerr += 'Business of employer is required\n';

	if(document.Form1.ddEmployment.selectedIndex == 0)
		cerr += 'Employment status is required\n';

	if(document.Form1.txtPassDay.value == '' || document.Form1.txtPassMonth.value == '' || document.Form1.txtPassedYear.value == '')
		cerr += 'Licence date is required\n';

	if(document.Form1.ddIIness.selectedIndex == 0)
		cerr += 'Disability is required\n';

	if(cerr.length > 0)
	{
		alert(cerr);
		return false;
	}
	else
		return true;
}

