// syntax: 
// launchWindow("url");
// launchWindow("url", width, height);

function launchWindow() {
	args = launchWindow.arguments;
	w = (args[1]) ? args[1] : 400;
	h = (args[2]) ? args[2] : 400;
	window.open(args[0], "picture", "width="+ w +",height="+ h +",menubar=no,scrollbars=no,resizable=yes,toolbar=no,status=no,location=no");
}

// launch (text) window with scrollbars
function launchTextWindow() {
	args = launchTextWindow.arguments;
	w = (args[1]) ? args[1] : 600;
	h = (args[2]) ? args[2] : 600;
	window.open(args[0], "textwin", "width="+ w +",height="+ h +",menubar=no,scrollbars=yes,resizable=yes,toolbar=no,status=yes,location=no");
}


function checkForm() {

	args = checkForm.arguments;
	
	errors = 0;
	message = "Errors!\n\n";
	for (i=0; i<args.length; i++) {
	
		if (document.mainForm.elements[args[i]].value == "") {
			message += "- Field '" +args[i].replace(/_/g, ' ')+ "' is missing\n";
			errors++;
		}
	}

	if (errors) {
		message += "\nPlease complete the missing fields.";
		alert(message);
		return false;
	} else {
		return true;
	}
	
}
