/**
 * @version SVN: $Id: wizard2.js 416 2011-06-12 18:31:43Z elkuku $
 * @package    EasyCreator
 * @subpackage Javascript
 * @author     Nikolai Plath {@link http://www.nik-it.de}
 * @author     Created on 11-Oct-2009
 * @license    GNU/GPL, see JROOT/LICENSE.php
 */

function submitbutton(command)
{
    var form = document.adminForm;
    if (command == 'wizard3')
    {
        //--do some field validation
        valid = true;
        $('req_version').innerHTML = '';
        $('req_name').innerHTML = '';

        if($('req_list_postfix') != null)
        {
            $('req_list_postfix').innerHTML = '';
        }

        if(form.version.value == '')
        {
            $('req_version').innerHTML = '<div style="color: red;">' + jgettext('You must provide a version number') + '</div>';
            $('version').focus();
            var div = $('req_version').setStyles({
                display:'block',
                opacity: 0
            });
            new Fx.Tween($('req_version'), $extend({property: 'opacity'}), {duration: 1500} ).start(1);
            valid = false;
        }

        if(form.com_name.value == '')
        {
            $('req_name').innerHTML = '<div style="color: red;">' + jgettext('You must provide a name') + '</div>';
            $('com_name').focus();
            var div = $('req_name').setStyles({
                display:'block',
                opacity: 0
            });
            new Fx.Tween($('req_name'), $extend({property: 'opacity'}), {duration: 1500} ).start(1);
            valid = false;
        }

        if(form.list_postfix.value == '')
        {
            $('req_list_postfix').innerHTML = '<div style="color: red;">' + jgettext('You must provide a list postfix') + '</div>';
            $('list_postfix').focus();
            var div = $('req_list_postfix').setStyles({
                display:'block',
                opacity: 0
            });
            new Fx.Tween($('req_list_postfix'), $extend({property: 'opacity'}), {duration: 1500} ).start(1);
            valid = false;
        }

        if(valid)
        {
            $('wizard-loader').removeClass('icon-32-wizard');
            $('wizard-loader').addClass('ajax-loading-32');
            submitform(command);
        }
    }
    else
    {
        //--user selected 'back' or any other stuff
        $('wizard-loader').removeClass('icon-32-wizard');
        $('wizard-loader').addClass('ajax-loading-32');
        submitform(command);
    }
}//function
