        <div id="mymodal" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">TITRE</h4>
                    </div>

                    <div class="modal-body">
                        <iframe id="framemodal" frameborder=0 width="100%" height="600px"></iframe>
                    </div>
                </div>
            </div>
        </div>

        <div id="modalinfo" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="fa fa-info-circle"></i> INFORMATION</h4>
                    </div>

                    <div class="modal-body">
                        <div id="modalinfotext"></div>
                    </div>
                </div>
            </div>
        </div>
        

        {% block javascripts %}
            {% javascripts
                '@CadolesCoreBundle/Resources/public/js/jquery.min.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap.min.js'
                '@CadolesCoreBundle/Resources/public/js/metisMenu.min.js'
                '@CadolesCoreBundle/Resources/public/js/raphael-min.js'
                '@CadolesCoreBundle/Resources/public/js/morris.min.js'
                '@CadolesCoreBundle/Resources/public/js/excanvas.min.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.flot.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.flot.pie.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.flot.resize.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.flot.time.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.flot.tooltip.min.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.dataTables.min.js'
                '@CadolesCoreBundle/Resources/public/js/dataTables.bootstrap.min.js'
                '@CadolesCoreBundle/Resources/public/js/datatable-init.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-datepicker.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-datepicker.fr.min.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-datetimepicker.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-datetimepicker.fr.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-slider.js'
                '@CadolesCoreBundle/Resources/public/js/masonry.pkgd.js'
                '@CadolesCoreBundle/Resources/public/js/gridify-min.js'
                '@CadolesCoreBundle/Resources/public/js/jquery-ui.min.js'
                '@CadolesCoreBundle/Resources/public/js/tinycolor-0.9.15.min.js'
                '@CadolesCoreBundle/Resources/public/js/pick-a-color-1.2.3.min.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-switch.js'
                '@CadolesCoreBundle/Resources/public/js/dropzone.js'
            	'@CadolesCoreBundle/Resources/public/js/jquery.imgareaselect.min.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.fakecrop.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-iconpicker-fontawesome-4.2.0.min.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-iconpicker.min.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.iframe-auto-height.js'
                '@CadolesCoreBundle/Resources/public/js/jquery.browser.js'
                '@CadolesCoreBundle/Resources/public/js/select2.js'
                '@CadolesCoreBundle/Resources/public/js/select2-fr.js'
                '@CadolesCoreBundle/Resources/public/js/slick.js'
                '@CadolesCoreBundle/Resources/public/js/jsRapClock.js'
                '@CadolesCoreBundle/Resources/public/js/moment.min.js'
                '@CadolesCoreBundle/Resources/public/js/fullcalendar.min.js'
                '@CadolesCoreBundle/Resources/public/js/fullcalendar.lang.js'
                '@CadolesCoreBundle/Resources/public/js/bootstrap-tour.min.js'
                '@CadolesCoreBundle/Resources/public/js/sb-admin-2.js'
                
                '@Tetranz\Select2EntityBundle//Resources/public/js/select2entity.js'

            	'@CadolesCoreBundle/Resources/public/js/local.js'

                debug=false
            %}
                <script src="{{ asset_url }}"></script>
            {% endjavascripts %}
        {% endblock %}

        
        {% set theme = app.session.get('theme') %}
        {% if theme is not empty %}
            <script src="/{{ alias }}/bundles/cadolescore/themes/{{theme}}/local.js"></script>
        {% endif %}
        

        <script>

            function iformat(icon) {
                return $('<span><i class="' + icon.id + '"></i> ' + icon.text + '</span>');
            }
            $('.select2-icon').select2({
                width: "100%",
                placeholder: 'choisir un icône',
                allowClear: true,                
                templateSelection: iformat,
                templateResult: iformat,
                formatResult: iformat,
                allowHtml: true,
                escapeMarkup: function(m) {
                    return m;
                }
            })


            function seeUser(id) {
                {% if app.user %}
                    $("#mymodal").find(".modal-title").html("FICHE UTILISATEUR");
                    var url="{{ path('cadoles_core_user_view',{id:'xx'}) }}";
                    url=url.replace('xx',id);

                    $("#mymodal").find("#framemodal").attr("src",url);
                    $("#mymodal").modal().show();
                {% endif %}
            }   

            function inIframe () {
                try {
                    return window.self !== window.top;
                } catch (e) {
                    return true;
                }
            } 

            function showHome() {
                if($("#appmenu ul:first-child li.active").length)
                    $("#appmenu ul:first-child li.active a").click();
                else 
                    $(location).attr('href',"/{{ alias }}");
            }

            function switchHeader() {
                {% if app.user %}
                $.ajax({
                    method: "POST",
                    url: "{{ path('cadoles_core_user_preference') }}",
                    data: {
                        id:0,
                        key:'fgheader',
                        {% if fgheader %}
                        value: false
                        {% else %}
                        value: true
                        {% endif %}
                    },
                    success: function() {
                        location.reload();
                    }            
                });
                {% endif %}                
            }

            $(document).ready(function() {
                $(".js-datepicker").datepicker({
                    format: "dd/mm/yyyy",
                    language: "fr"
                });

                $('.select2simple').select2();

                $('.select2ajax').select2({
                    ajax: {
                        processResults: function (data) {
                            return {
                                results: data
                            };
                        }                    
                    }
                });

                $('.select2').each(function() {
                    if($(this).attr('data-init')) {
                        $(this).val(2);
                    }
                });

                // Dans une iframe on enlève des élèment
                if(inIframe()) {
                    $("nav").remove();
                    $("body").removeClass("body");
                    $("body").addClass("simple");
                    $("#page-wrapper").css("margin","0px");
                    $("#page-wrapper").css("border-left","none");
                }

                $(document).tooltip({
                    content: function () {
                        return $(this).prop('title');
                    }
                });                
            });

            // Cacher afficher le menu des widgets 
            $( ".widget").hover(function() {
                if($(this).children(".widgetmenu").length) {
                    var widthwidget=$(this).width();
                    var widthtitle=$(this).children(".widgetheader").children(".title").width();
                    var widthmenu=$(this).children(".widgetmenu").width();

                    if(widthtitle+widthmenu+10>widthwidget) $(this).children(".widgetheader").children(".title").hide();

                    $(this).children(".widgetmenu").show();
                }
            });

            $( ".widget" ).mouseleave(function() {
                $(this).children(".widgetmenu").hide();
                $(this).children(".widgetheader").children(".title").show();
            });

            $( ".grid-item-content").hover(function() {
                $(this).children(".item-heart").show();
                $(this).children(".item-delete").show();
                $(this).children(".item-restaure").show();
                $(this).children(".item-update").show();
                $(this).children(".item-preview").show();
            });

            $( ".grid-item-content" ).mouseleave(function() {
                $(this).children(".item-heart").hide();
                $(this).children(".item-delete").hide();
                $(this).children(".item-restaure").hide();
                $(this).children(".item-update").hide();
                $(this).children(".item-preview").hide();
            });

            $(".navbar-toggle").mouseup(function() {
                setTimeout(function() {
                    resizeFrame();
                }, 50);                
                
            });
        </script>
