{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
{% import "macro_functions.phtml" as mf %}
{% block meta_title %}{{ product.title }}{% endblock %}

{% block content_before %}
{% include "partial_steps.phtml" with {'selected': 2} %}
{% endblock %}

{% block content %}

{% set periods = guest.system_periods %}
{% set pricing = product.pricing %}

<form method="post" action="" class="api_form" data-api-url="guest/cart/add_item" data-api-redirect="{{ 'cart'|link }}">
    <div class="h-block">
        <div class="h-block-header">
            <div class="icon"><span class="number">2</span></div>
            <h2>{% trans 'Configure' %}</h2>
            <p>{% trans 'The product/service you have chosen has the following configuration options for you to choose from.' %}</p>
        </div>
        <div class="block">
            <div class="grid_8 alpha">
                <div class="box">
                    <div class="block">
                        <h1>{{ product.title }}</h1>
                        {{ product.description|bbmd }}
                    </div>
                    {% if product.form_id and guest.extension_is_on({"mod":"formbuilder"}) %}
                        {% include 'mod_formbuilder_build.phtml' with product %}
                    {% endif %}
                </div>
            </div>
            <div class="grid_4 omega">
                {% include 'partial_pricing.phtml' with {'product': product} %}
            </div>
            <div class="clear"></div>
        </div>
    </div>
    {% include 'partial_addons.phtml' with {'product': product} %}
    <input type="hidden" name="id" value="{{ product.id }}" />
</form>
{% endblock %}

{% block sidebar2 %}
    {% include 'partial_currency.phtml' %}
{% endblock %}

{% block js %}
<script type="text/javascript">
$(function() {

    if($(".addons").length && $(".addons").is(':hidden')) {
        $('#order-button').one('click', function(){
            $(this).hide();
            $('.addons').slideDown('fast');
            return false;
        });
    }

    $('#period-selector').change(function(){
        $('.period').hide();
        $('.period.' + $(this).val()).show();
    }).trigger('change');

    $('.addon-period-selector').change(function(){
        var r = $(this).attr('rel');
        $('#' + r + ' span').hide();
        $('#' + r + ' span.' + $(this).val()).fadeIn();
    }).trigger('change');
});
</script>
{% endblock %}