$(document).ready(function()
    {
        $('button').button();
        $('.faq').hide();
    });
function ct_contact()
{
var url ="";
    var error = false;
    $('#form_commandTaxi input').each(function()
    {
        $(this).removeClass('ui-state-error');
        url += '&'+$(this).attr('id')+'='+$(this).val();
        if ( ($(this).is('.indispensable')) && ($(this).val().length < 1) )
        {
            error = true;
            $(this).addClass('ui-state-error');
        }
    });
    $('#form_commandTaxi textarea').each(function()
    {
        $(this).removeClass('ui-state-error');
        url += '&'+$(this).attr('id')+'='+$(this).val();
        if ( ($(this).is('.indispensable')) && ($(this).val().length < 1) )
        {
            error = true;
            $(this).addClass('ui-state-error');
        }
    });
    if (error == false)
    {
        $.ajax({
            url: "pages/contactEnvoi.php?envoi=1"+url,
            success: function()
            {
                $( "#dialog").html('Votre demande a bien été envoyée. Nous vous répondrons au plus vite .');
                $( "#dialog" ).dialog({
                    modal: true,
                    resizable: false,
                    title:'Message envoyé',
                    buttons: {
                        Ok: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                });
            }
        });
    }
}
function ct_commandeTaxi()
{
    var url ="";
    var error = false;
    $('#form_commandTaxi input').each(function()
    {
        $(this).removeClass('ui-state-error');
        url += '&'+$(this).attr('id')+'='+$(this).val();
        if ( ($(this).is('.indispensable')) && ($(this).val().length < 1) )
        {
            error = true;
            $(this).addClass('ui-state-error');
        }
    });
    $('#form_commandTaxi textarea').each(function()
    {
        $(this).removeClass('ui-state-error');
        url += '&'+$(this).attr('id')+'='+$(this).val();
        if ( ($(this).is('.indispensable')) && ($(this).val().length < 1) )
        {
            error = true;
            $(this).addClass('ui-state-error');
        }
    });
    $('#form_commandTaxi select').each(function()
    {
        url += '&'+$(this).attr('id')+'='+$(this).val();
    });
    if ($('#animaux').is(':checked'))
    {
        url += '&animaux=oui';
    }
    else
    {
        url += '&animaux=non';
    }
    if (error == false)
    {
        $.ajax({
            url: "pages/commandeTaxiEnvoi.php?envoi=1"+url,
            success: function()
            {
                $( "#dialog").html('Votre demande a bien été envoyée. Nous vous répondrons au plus vite .');
                $( "#dialog" ).dialog({
                    modal: true,
                    resizable: false,
                    title:'Message envoyé',
                    buttons: {
                        Ok: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                });
            }
        });
    }
}
function menuFaq(num)
{
    $('.faq').hide();
    $('#faq_'+num).show();
}


