function validateRegistrationForm ()
{
	msg = "";
	
	if (document.getElementById("NewUName").value == "")
	{
		msg += "- Name\n";
	}
	if (document.getElementById("NewPwd").value == "")
	{
		msg += "- Password\n";
	}
	if (document.getElementById("NewCompName").value == "")
	{
		msg += "- Company Name\n";
	}
	if (document.getElementById("Email").value == "")
	{
		msg += "- Email Address\n";
	}
	if (msg)
	{
		alert ("Please correct the following:\n\n" + msg);
	}
	else
	{
		document.forms[0].submit();
	}
}

function UploadWait ()
{
	setTimeout ("UploadWaitNow()", 1000);
}

function UploadWaitNow ()
{
	document.getElementById("frm1").style.display = "none";
	document.getElementById("frm1_loading").style.display = "block";
}

function UpdateFTPUser (id)
{
	window.location = "?action=update_user&id=" + id + "&username=" + document.getElementById(id + "_username").value + "&password=" + document.getElementById(id + "_password").value + "&company=" + document.getElementById(id + "_company").value + "&email=" + document.getElementById(id + "_email").value;
}

function CreateFTPUser (id)
{
	window.location = "?action=create_user&username=" + document.getElementById(id + "_username").value + "&password=" + document.getElementById(id + "_password").value + "&status=" + document.getElementById(id + "_status").value + "&perms=" + document.getElementById(id + "_perms").value + "&company=" + document.getElementById(id + "_company").value + "&email=" + document.getElementById(id + "_email").value;
}

function updateFTPStatus (id, option)
{
	var conf = false;
	if (option == 1)
	{
		conf = confirm ("Would you like to also send a welcome email with FTP information to the user as well?");
	}

	if (conf)
	{
		window.location = "?action=update_status&send_mail=1&id=" + id + "&option=" + option;
	}
	else
	{
		window.location = "?action=update_status&send_mail=0&id=" + id + "&option=" + option;
	}
}
