function CheckInputs(Inputs, form)
{
	for (var Input in Inputs)
	{
		var pInput = eval("form." + Input);
		if(pInput.value.length <= 0)
		{
			alert(Inputs[Input]);
			pInput.focus();
			return false;
		}
	}
	
	return true;
}

function CheckSelects(Selects, form)
{
	for (var Select in Selects)
	{
		var pSelect = eval("form." + Select);
		if(pSelect.selectedIndex == 0)
		{
			alert(Selects[Select]);
			pSelect.focus();
			return false;
		}
	}
	
	return true;
}

function CheckRadios(Radios, form)
{
	for (var Radio in Radios)
	{
		var found = false;
		var pRadio = eval("form." + Radio);
		for(var i=0; i < pRadio.length; i++)
		{
			if(pRadio[i].checked)
			{
				found = true;
				break;
			}
		}
		
		if(!found)
		{
			alert(Radios[Radio]);
			pRadio[0].focus();
			return false;
		}
	}
	
	return true;
}

function TestFileType( fileName, fileTypes )
{
	if (!fileName) return true;
	var dots = fileName.value.split(".")
	
	//get the part AFTER the LAST period.
	var fileType = "." + dots[dots.length-1];

	var index = fileTypes.indexOf(fileType.toLowerCase());
	if(index < 0)
	{
		alert("Please only upload files that end in types: \n\n" + fileTypes + "\n\nPlease select a new file and try again.");
		return false;
	}
	
	return true;
}


