<!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL:  http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=410,height=528,left = 400,top = 10');");
}
// End -->

var javascript_version = 1.0;
javascript_version = 1.1;
var newwin;

function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',nt600);
	}
}

function require(names)
{
if (checkNames(names))
return true;
alert('Please fill in all the fields');
return false;
}

function checkNames(names)
{
var anArray = names.split(",");
for (var i = 0; i < anArray.length; i++)
{
if (!checkName(anArray[i]))
return false;
}
return true;
}

function checkName(name)
{
if (name.length == 0)
return true;
var inputs = document.forms[0].elements;
for (var i = 0; i < inputs.length; i++)
{
var anInput = inputs[i];
if ( (anInput != null) && (anInput.name == name) )
{
if (checkInput(anInput))
return true;
}
}
return false;
}

function checkInput(anInput)
{
var type = anInput.type;
if ( (type == "text") || (type == "textarea") )
return checkText(anInput);
if (type == "radio")
return checkRadio(anInput);
if ( (type == "select-one") || (type == "select-multiple") )
return checkSelect(anInput);
alert("Unsupported type for required input: " + type);
return false;
}

function checkText(anInput)
{
var aString = anInput.value;
if (aString == null)
return false;
return (aString.length > 0);
}

function checkRadio(anInput)
{
var aBoolean = anInput.checked;
if (aBoolean == null)
return false;
return aBoolean;
}

function checkSelect(anInput)
{
if (anInput.selectedIndex < 0)
return false;
var option = anInput.options[anInput.selectedIndex];
var aString = option.value;
if ( (aString != null) && (aString.length > 0) )
return true;
aString = option.text;
if ( (aString != null) && (aString.length > 0) )
return true;
return false;
}