<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HiCBrowser</title>
        <meta charset="utf-8">
        <link rel="icon" type="image/png" href="/static/img/logo.png" />
        <meta name="description" content="">
        <link rel="stylesheet" href="/static/css/screen.css">
        <link rel="stylesheet" href="/static/css/owl.carousel.min.css">
        <link rel="stylesheet" href="/static/css/owl.theme.default.min.css">

    </head>
<body class="theme-dark">
    <script type=text/javascript src="/static/js/jquery-1.11.3.min.js"></script>
    <script type=text/javascript src="/static/js/owl.carousel.js"></script>
    <form method="get" action="" style="float:left">
        <div id="container">
            <div id="sidebar">

                <!--h1 id="logo">
                    <div style="text-align:center"><img src="/static/img/logo.png"></div>
                    HiCBrowser
                </h1-->

                <p class="instructions text-center">
                    <small>Select the region that you want to see</small>
                </p>

                <!--div id="cleanup-mode" class="clearfix">
                    <div class="btn-group">
                        <button class="btn btn-default" type="button" data-mode="html">HTML</button>
                        <button class="btn btn-primary" type="button" data-mode="css">CSS</button>
                        <button class="btn btn-primary" type="button" data-mode="css">CSS</button>
                        <button class="btn btn-default" type="button" data-mode="javascript">JS</button>
                    </div>
                </div-->
               <div>
                    <label class="control-label" for="region">region to plot</label><br/>
                    <input type="text" name="region" value="{{region}}" size="30"/>
                </div>

                <!--div>
                    <label class="control-label" for="chromosome">Chromosome</label><br/>
                    <input type="text" name="chromosome" value="{{chromosome}}"/>
                </div>
                <div>
                    <label class="control-label" for="start">Start</label><br/>
                    <input type="text" name="start" value="{{start}}"/>
                </div>
                <div>
                    <label class="control-label" for="end">End</label><br/>
                    <input type="text" name="end" value="{{end}}"/>
                </div>


                <div class="form-group" id="clean">
                    <button class="btn btn-lg btn-block btn-primary" type="submit">View</button>
                </div-->

                <div><h4><a href="?region=chr2L:3000000-4000000">Example</a></h4></div>

            </div>

            <!-- MAIN PANEL -->
            <div id="browser">

                <div><a href="{{previous}}">previous</a> | <a href="{{next}}">next</a> | <a href="{{out}}">zoom out</a></div>
    <div class="owl-carousel owl-theme" sytle="width:80%">
        {{tracks|safe}}
    </div>

    <div class="">
        <a href class="previous">previous</a> |
        <a href class="next">next</a>

    </div>
            </div>
            <div id="footer">
                <div id="sponsor">
                    <a href="http://www.ie-freiburg.mpg.de" target="_blank">
                        <img src="/static/img/minerva.png" alt="Max Planck Society" width="20">
                    </a>
                    <br />
                    <a href="http://mpg.de/" target="_blank">
                        <img src="/static/img/ie_logo.png" alt="Max Planck Institute for Immunobiology and Epigenetics"></a>
                </div>
                Made by <a href="" target="_blank">Fidel Ramírez</a>
            </div>
            <div id="spinner"></div>
        </div>
    </form>
    <script>
    function getUrlVars()
    {
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for(var i = 0; i < hashes.length; i++)
        {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }
    $(document).ready(function() {

      var owl = $(".owl-theme"),
          i = 0,
          ii = 0,
          textholder,
          booleanValue = false;

      //init carousel
      owl.owlCarousel({
      items:3,
      margin: 0,
      startPosition: 'URLHash',
      loop:false,
      URLhashListener:true,
      animateIn:true,
      });

        $('.next').on("click", function(e){
        e.preventDefault();
        i += 1;
        var step = {{step}}
        var end = {{end}}
        var start = end - step
        end = end + step * i
        start = start + step * i
        var content = "{{content|safe}}";
        owl.trigger('add.owl.carousel', content);
        owl.trigger('next.owl.carousel');
      });


        $('.previous').on("click", function(e){
        e.preventDefault();
        ii += 1;
        var step = {{step}}
        var start = {{start}}
        var end = start + step
        end = end - step * ii
        start = start - step * ii
        var content = "{{content|safe}}";
        owl.trigger('add.owl.carousel', [content, 0]);
        owl.trigger('refresh.owl.carousel');
        owl.trigger('previous.owl.carousel');
      });

    })
    </script>

</body></html>
