/**
 * ape8 - a simple, yet powerful framework/cms without a database.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @package ape8
 * @version 0.1
 * 
 * @copyright Copyright &copy; 2007, marius groeneveld <marius@ape8.net>
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 * @link http://ape8.net project website
 */

	function submit_content_texteditor_form (action) {
		document.content_texteditor_form.action.value = action;
		document.content_texteditor_form.submit();
	}

	function validateAndSubmitForm (formName) {
		var returnMessage = '';
		var evalString = 'var formObject = document.'+formName+';';
		eval(evalString);

		switch (formName) {
			case 'standard_form_contact':
				if(formObject.contact_name.value.length < 3) {
					returnMessage += 'Bitte geben Sie Ihren Namen an.\n';
				}
				if(formObject.contact_telefon.value.length < 7) {
					returnMessage += 'Bitte geben Sie eine Telefonnummer an.\n';
				}
				if(formObject.contact_message.value.length < 5) {
					returnMessage += 'Bitte geben Sie eine Nachricht an.\n';
				}

				if(returnMessage != ''){
					alert(returnMessage);
				} else{
					formObject.action.value = 'contact.submit';
					formObject.submit();	
				}
			break;
		}
		
	}