function showReqTxt() {
	var spans = document.getElementsByTagName("*");
	for (var i=0;i<spans.length;i++) {
		if (spans[i].className.indexOf('fldrequired') > 0) {
			spans[i].style.borderColor = 'red';
		}
		//alert(spans[i].className +', '+spans[i].className.indexOf('fldrequired'));
	}
}

function checkFail() {
	alert('Please fill out all the required fields');
	showReqTxt();
}

function checkHowDidYouHear() {
		if ($g('howdidyouhear').value == 0) {
		 checkFail();
		 return false;
		}
		if ($g('howdidyouhear').value == 'Internet Search' && $g('searchdetails').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('howdidyouhear').value == 'Referral' && $g('referraldetails').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('howdidyouhear').value == 'Other' && $g('otherdetails').value == '') {
		 checkFail();
		 return false;
		}
		
		return true;
}

function checkBaseFields() {
		if ($g('firstname').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('lastname').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('birthdate').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		if ($g('address').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('city').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('state').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('zipcode').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('daytimecontactnumber').value == '') {
		 checkFail();
		 return false;
		}
		
		return true;
}

function bankruptcyForm() {
		checkBaseFields();
		
		if ($g('debt').value == '') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function tortForm() {
		
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function constructionForm() {
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function corporationsForm() {
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function criminalForm() {
		checkBaseFields();
		
		if ($g('charge').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofarrest').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		if ($g('nextcourtdate').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('employer').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('jobtitle').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('lengthofNVresidency').value == '') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function domesticForm() {
		checkBaseFields();
		
		if ($g('legalservicerequested').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofmarriage').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		if ($g('employer').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('lengthofNVresidency').value == '') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function employmentForm() {
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function accidentForm() {
		checkBaseFields();
		
		if ($g('dateofaccident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		if ($g('locationofaccident').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('descriptionofaccident').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('injuries').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('whocausedaccident').value == '') {
		 checkFail();
		 return false;
		}		
		
		checkHowDidYouHear();
		
		return true;
}

function probateForm() {
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function realestateForm() {
		checkBaseFields();
		
		if ($g('typeofclaim').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofincident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}

function workerscompForm() {
		checkBaseFields();
		
		if ($g('dateofaccident').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}
		if ($g('locationofaccident').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('descriptionofaccident').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('injuries').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('employer').value == '') {
		 checkFail();
		 return false;
		}
		if ($g('dateofemployernotification').value == 'MM/DD/YY') {
		 checkFail();
		 return false;
		}	
		
		checkHowDidYouHear();
		
		return true;
}

function generalForm() {
		checkBaseFields();
		
		if ($g('legalquestion').value == '') {
		 checkFail();
		 return false;
		}
		
		checkHowDidYouHear();
		
		return true;
}