$(document).ready(function() {
       $("#dateInterval").change(function(){
           var selectedValue = $(this).find(":selected").val();
           if(selectedValue != "empty"){
               console.log("the value you selected: " + selectedValue);
               var parts = selectedValue.split("#");
               var startDate = parts[0];
               var endDate = parts[1];
               console.log("startDate: " +  startDate);
               console.log("endDate: " + endDate);
               $("#from").val(startDate);
               $("#to").val(endDate);
           }
           else{
                $("#from").val("");
               $("#to").val("");
           }
       });
});

$.extend({
  getUrlVars: function(){
    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;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});
