function showFormExport()
{
    //$(".btn_show_export_form").bind("click",function()

    $(".btn_show_export_form").live('click', function()
    {

        debug('btn_show_export_form');

        var laenge = $('#positions li').length;
        var laenge_default = $('#positions li.default').length;

        if (laenge_default > 0)
        {
            $('#no_positions').fadeIn('slow').fadeOut(3000);

            return false;
        }

        $.fn.colorbox(
        {
            href: getAjaxUrl('get_form_export'),
            height: 380,
            width: 650,
            onComplete:function()
            {
                $('#colorbox').show();
                
                $('.export_medium').change(function()
                {
                    if ($(this).val() == 'email')
                    {
                        $('.export_email_input').show();
                    }
                    else
                    {
                        $('.export_email_input').hide();
                    }
                });
                setFormExport();
            }
        });

        return false;
    });
}

function setFormExport()
{
    var flag_export = true;
    /*$("input.submit_export_form").live('click', function()*/
    $(".submit_export_form").unbind('click').click(function()
    {
        var export_method = $('.export_method:checked').val();
        var export_medium = $('.export_medium:checked').val();
        if (export_medium == 'email')
        {
            var check = validateEmail('input.exportemail', '.email_error', $('input.exportemail').val());
            if (check != true)
            {
                flag_export = false;
            }
            else
            {
                flag_export = true;
            }
        }
        else
        {
            flag_export = true;
        }

        if (flag_export == true)
        {

            var fields = $('#exportMethodForm').serializeObject();
            var id_strings = {};
            $('#positions li').each(function(i)
            {
                id_strings[i] = {
                    'name': trim(strip_tags_with_content($(this).html())),
                    'value': $(this).attr('id')
                    };
            });
            fields['id_strings'] = id_strings;
            var json = getAjax('export_form', 'json', fields);

            $('#cboxLoadedContent .teaser-wide-top').html(json.html);
            $('#cboxLoadedContent .teaser-wide-inner').remove();
            $('#cboxLoadedContent .teaser-wide-bottom').remove();


            if (export_method == 'html' && export_medium == 'monitor')
            {
                showExportPopup();
                $.fn.colorbox.close();
            }
            else
            {
                if ($('a.popup').length != 0)
                {
                    window.open($('a.popup').attr('href'),'popup', '');
                }
            }
        }

        return false;
    });
}

function showExportPopup(html)
{

    var options = 'width=800,height=600,menubar=yes,resizable=yes,scrollbars=yes,location=yes,status=yes';
    var popup = window.open(getUrlPopup('test'), '',options);

/*
	options = 'width=800,height=600,menubar=yes,resizable=yes,scrollbars=yes,location=yes,status=yes';
	var popup = window.open('', '',options);
	popup.document.open();
	popup.document.write('<html><head><title>'+ $(document).find('title').html() +'</title></head>');
	popup.document.write('<body>');
	popup.document.write('<a href="print();">Diese Seite Drucken</a>');
	popup.document.write('<br /><br />');
	popup.document.write('<div>');
  popup.document.write(html);
	popup.document.write('</div>');
  popup.document.write('</body></html>');
*/
}
