﻿ValidationError = false;

function ValidationMessage(ControlToValidate, Message) {
	if (ValidationError) {
		alert(Message);
		if (ControlToValidate.type != "hidden") {
			ControlToValidate.focus();
		}
	}
}

function RequiredFieldValidator(ControlToValidate, ErrorMessage) {
	var InputValue;
	ControlToValidate = document.forms.aspnetForm[ControlToValidate];
	if (ControlToValidate.length && ControlToValidate[0].type == "radio") {
		for (i = 0; i < ControlToValidate.length; i++) {
			if (ControlToValidate[i].checked) {
				InputValue = ControlToValidate[i].value;
			}
		}
		ControlToValidate = ControlToValidate[0];
	}
	else if (ControlToValidate.type == "checkbox") {
		InputValue = ControlToValidate.checked;
	}
	else {
		InputValue = ControlToValidate.value;
	}
	if (!ValidationError && !InputValue) {
		ValidationError = true;
		ValidationMessage(ControlToValidate, ErrorMessage);
	}
}

function ShowMenu(Item) {
	GetElementById(Item).style.display = "block";
}

function HideMenu(Item) {
	GetElementById(Item).style.display = "none";
}
