//ogolne funkcje sterujce dla calej strony
function Hide(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = "none" ;
}
function show(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = "block";
} 
        
 function  destroy(id)
{
    document.getElementById(id).innerHTML = "";
}    
      
function showHide(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = (obj.style.display == "block" ? "none" : "block");
}

$(function(){
    $("#kalendarz").datepicker({minDate: -20, maxDate: '+1M +10D'});
    $("table").tablesorter({
        // sort on the first column and third column, order asc
        sortList: [[0,0]]
    });

    $('.tablesorter th').attr('title', 'Kliknij aby posortować');


    var chart = new Highcharts.Chart({
       chart: {
          renderTo: 'container'
       },
       title: {
          text: 'Przykładowy wykres'
       },
       xAxis: {
          categories: ['Jabłka', 'Pomarańcze', 'Gruszki', 'Banany', 'Śliwki']
       },
       tooltip: {
          formatter: function() {
             var s;
             if (this.point.name) { // the pie chart
                s = '<b>Spożycie owoców</b><br/>'+
                   this.point.name +': '+ this.y +' owoc';
             } else {
                s = '<b>'+ this.series.name +'</b><br/>'+
                   this.x  +': '+ this.y;
             }
             return s;
          }
       },
       yAxis: {
         title:{
             enabled: false
           }
       },
       labels: {
          items: [{
             html: 'Spożycie owoców',
             style: {
                left: '40px',
                top: '8px',
                color: 'black'
             }
          }]
       },
       legend: {
         style:{
             padding: '0px 10px 10px 0',
             top: '360px',
             left: '100px'
         }
     },
     credits:{
         enabled: false
     },
       series: [{
          type: 'column',
          name: 'Tomek',
          data: [3, 2, 1, 3, 4]
       }, {
          type: 'column',
          name: 'Jan',
          data: [2, 3, 5, 7, 6]
       }, {
          type: 'column',
          name: 'Franek',
          data: [4, 3, 3, 9, 0]
       }, {
          type: 'spline',
          name: 'Magda',
          data: [3, 2.67, 3, 6.33, 3.33]
       }, {
          type: 'pie',
          name: 'Spożycie owoców',
          data: [{
             name: 'Tomek',
             y: 13,
             color: '#4572A7'
          }, {
             name: 'Jan',
             y: 23,
             color: '#AA4643'

          }, {
             name: 'Franek',
             y: 19,
             color: '#89A54E'
          }],
          center: [100, 80],
          size: 100,
          showInLegend: false
       }]
    });

});
