// Add/Edit category picker from dropdown menu
function copyOne(f, dt, st) {
	var d, s;
	for (d = 0; d < f.length; d++)
		if (f[d] && f[d].name == dt) break;
	for (s = 0; s < f.length; s++)
		if (f[s] && f[s].name == st) break;
	if (f[s] && f[d] && f[s].name && f[d].name) {
		//if (f[d].value == '')
		f[d].value = f[s].value;
	}
}

function Drop2Text(from,to,mommy) {
	var f = document.forms[mommy];
//	alert(from + " copies to " + to + " in form " + mommy);
	copyOne(f, to, from);
}

function verifyOne(f,nt,d)
{
	var n;
	for (n = 0; n < f.length; n++)
		if (f[n] && f[n].name == nt && f[n].value != d) return true;
	return false;
}

function verifyPW(f,check,pass)
{
	var pw, chk;
	for (pw = 0; pw < f.length; pw++)
		if (f[pw] && f[pw].name == pass) break;
	for (chk = 0; chk < f.length; chk++)
		if (f[chk] && f[chk].name == check) break;
	if (f[chk] && f[pw] && f[chk].name && f[pw].name) {
		if (f[pw].value == f[chk].value) return true;
	}
	return false;
}

function check_customer(customer,alias)
{
	var f = document.forms["signup"];
	if (!f[customer].checked && f[alias].checked) {
		alert('You must be an Internet Connection hosting customer in order for us to set up a media.yourdomainname.com alias.  If you are not an Internet Connection hosting customer, please contact your hosting provider.');
		return false;
	} else {
		return true;
	}
}

function verify_form()
{
	var f = document.forms["signup"];
	
	if (!verifyOne(f, "username", '')) {
		alert("You forgot to enter a Username.");
		return false;
	}
	if (!verifyOne(f, "password", '')) {
		alert("You forgot to enter a password.");
		return false;
	}
	if (!verifyPW(f, "chkpassword", "password")) {
		alert("Password error: Your passwords did not match.");
		return false;
	}
	if (!verifyOne(f, "website", '')) {
		alert("Please specify a domain name for the website your streaming media will be linked to.");
		return false;
	}
	if (!verifyOne(f, "email", '')) {
		alert("You forgot to supply an email address.");
		return false;
	}
	if (!verifyOne(f, "phone", '')) {
		alert("You forgot to supply a phone number.");
		return false;
	}
	if (!verifyOne(f, "address", '')) {
		alert("You forgot to supply at least 1 line of your address.");
		return false;
	}
	if (!verifyOne(f, "city", '')) {
		alert("You forgot to enter your city.");
		return false;
	}
	if (!verifyOne(f, "zip", '')) {
		alert("You forgot to enter your postal code.");
		return false;
	}
	if (!verifyOne(f, "paymentmethod", '')) {
		alert("You failed to supply a method of payment.  Streaming Media is not free.");
		return false;
	}
}

