/* main functions */

function checkForm_fast(form) {
	/* fields: account, h_prefix, h_extension, l_prefix, l_extension 
	 *
	 * XXX: this should be re-factored into an array and actions to 
	 * get rid of the repeated code.
	 */

	if (! checkForm('NotNull', form.name)) {
		checkFormWarn(form.name, "Please add your name");
		return false;
	}

	if (! checkForm('NotNull', form.phone)) {
		checkFormWarn(form.phone, "Please include your phone number");
		return false;
	}

	if (! checkForm('NotNull', form.email)) {
		checkFormWarn(form.email, "Please add your email address");
		return false;
	}

	return true;
}

function checkForm_falcon(form) {
	/* fields: account, h_prefix, h_extension, l_prefix, l_extension 
	 *
	 * XXX: this should be re-factored into an array and actions to 
	 * get rid of the repeated code.
     * if the existing = Yes then check the account #
	 */
/*	if ( form.existing[0].checked ) { 
	    if (! checkForm('Number', form.account)) {
		    checkFormWarn(form.account, "Account number should be a number");
		    return false;
	    }
   } */
   
   	if (! checkForm('NotNull', form.name)) {
		checkFormWarn(form.name, "Please add your name");
		return false;
	}

    if (! checkForm('NotNull', form.phone)) {
		checkFormWarn(form.phone, "Please add your phone number");
		return false;
	}

	if (! checkForm('NotNull', form.email)) {
		checkFormWarn(form.email, "Please add your email address");
		return false;
	}


    //inform the customer that this is for real
    var answer = confirm("Thank you for your interest in Fiber Optic Internet Service!  Please make sure that you filled out all of the required fields (name, phone number, email address).  Please click ok to continue or click cancel to go back.");
    if ( ! answer) {
       return false;
    } 

	// don't bother continuing to check if user didn't add anything
	if (form.l_prefix.value.length == 0) {
		return true;
	}

   //return true;

}

function checkForm(type, field) {
	switch (type) {
		case 'NotNull':
			if (field.value == "") {
				return false;
			}
			return true;
			break;

	}
}
				
function checkFormWarn(field, warning) {
	alert(warning);
	field.focus();
}

function popBox(URL) {
	window.open("http://www.paonline.com/" + URL, "help", "menubar=1,scrollbars=1,resizable=1,width=700,height=590");	
}
