function dis_Hour(venue) {
    
  $.ajax({
      url: 'https://api.foursquare.com/v2/venues/' + venue.id + '/hours?client_id=SZIHYFHTJSL5ZSZEJLY0VFBPSR4N54WUDCZGKKNQWTSXUUBC&client_secret=INL4I1MPCAALYO5WLC0SQKH2HAKD3RI1X2IWEI3ZBY3QQQYX&v=20140806', 
      dataType: 'JSONP',
      success:  function (val){
        var times = [];
        //CHECK IF ANY RESPONSE IS AVALIABLE IF SO LOOP THROUGH JSON FILE   
          if(val.response.hours.timeframes) {
              for (h = 0; h < val.response.hours.timeframes.length; h++){
                  var length = val.response.hours.timeframes[h];
                  for (i = 0; i < length.days.length; i++){
                      var opening_times = length.open[0].start + ' ' + ' - ' + length.open[0].end;
                      times.push(opening_times);
                  }
              }
              
              var monday = 'Monday';
              var tuesday = 'Tueday';
              var wed = 'Wednesday';
              var thur = 'Thursday';
              var fri = 'Friday';
              var sat = 'Saturday';
              var sun = 'Sunday';
              
              if(!times[0]){
                  var mTime = 'Closed';
              }else{
                  var mTime = times[0];
              }
              
              if(!times[1]){
                  var tTime = 'Closed';
              }else{
                  var tTime = times[1];
              }
              
              if(!times[2]){
                  var wTime = 'Closed';
              }else{
                  var wTime = times[2];
              }
              
              if(!times[3]){
                  var thTime = 'Closed';
              }else{
                  var thTime = times[3];
              }
              
              if(!times[4]){
                  var fTime = 'Closed';
              }else{
                  var fTime = times[4];
              }
              
              if(!times[5]){
                  var sTime = 'Closed';
              }else{
                  var sTime = times[5];
              }
              
              if(!times[6]){
                  var sunTime = 'Closed';
              }else{
                  var sunTime = times[6];   
              }
              
              var htmlOpen = '';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + monday + '</p></div><div class="six columns"><p>' + mTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + tuesday + '</p></div><div class="six columns"><p>' + tTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + wed + '</p></div><div class="six columns"><p>' + wTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + thur + '</p></div><div class="six columns"><p>' + thTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + fri + '</p></div><div class="six columns"><p>' + fTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sat + '</p></div><div class="six columns"><p>' + sTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sun + '</p></div><div class="six columns"><p>' + sunTime + '</p></div></div>';
             document.getElementById('venue_day').innerHTML = htmlOpen;
              
          }
          else
          {
              times = 'No opening hours avaliable';
              document.getElementById('venue_day').innerHTML = '<div class="twelve columns"><div class="six columns"><p>' + times + '</p></div></div>';
          }      
      }
  });
}
//Gather the opening hours to display

Gather the opening hours to display
Gather the opening hours to display
function dis_Hour(venue) {
  $.ajax({
      url: 'https://api.foursquare.com/v2/venues/' + venue.id + '/hours?client_id=SZIHYFHTJSL5ZSZEJLY0VFBPSR4N54WUDCZGKKNQWTSXUUBC&client_secret=INL4I1MPCAALYO5WLC0SQKH2HAKD3RI1X2IWEI3ZBY3QQQYX&v=20140806', 
      dataType: 'JSONP',
      success:  function (val){
        var times = [];
          if(val.response.hours.timeframes) {
              for (h = 0; h < val.response.hours.timeframes.length; h++){
                  var length = val.response.hours.timeframes[h];
                  for (i = 0; i < length.days.length; i++){
                      var opening_times = length.open[0].start + ' ' + ' - ' + length.open[0].end;
                      times.push(opening_times);
                  }
              }
              var monday = 'Monday';
              var tuesday = 'Tueday';
              var wed = 'Wednesday';
              var thur = 'Thursday';
              var fri = 'Friday';
              var sat = 'Saturday';
              var sun = 'Sunday';
              if(!times[0]){
                  var mTime = 'Closed';
              }else{
                  var mTime = times[0];
              }
              if(!times[1]){
                  var tTime = 'Closed';
              }else{
                  var tTime = times[1];
              }
              if(!times[2]){
                  var wTime = 'Closed';
              }else{
                  var wTime = times[2];
              }
              if(!times[3]){
                  var thTime = 'Closed';
              }else{
                  var thTime = times[3];
              }
              if(!times[4]){
                  var fTime = 'Closed';
              }else{
                  var fTime = times[4];
              }
              if(!times[5]){
                  var sTime = 'Closed';
              }else{
                  var sTime = times[5];
              }
              if(!times[6]){
                  var sunTime = 'Closed';
              }else{
                  var sunTime = times[6];   
              }
              var htmlOpen = '';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + monday + '</p></div><div class="six columns"><p>' + mTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + tuesday + '</p></div><div class="six columns"><p>' + tTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + wed + '</p></div><div class="six columns"><p>' + wTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + thur + '</p></div><div class="six columns"><p>' + thTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + fri + '</p></div><div class="six columns"><p>' + fTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sat + '</p></div><div class="six columns"><p>' + sTime + '</p></div></div>';
              htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sun + '</p></div><div class="six columns"><p>' + sunTime + '</p></div></div>';
             document.getElementById('venue_day').innerHTML = htmlOpen;
          }
          else
          {
              times = 'No opening hours avaliable';
              document.getElementById('venue_day').innerHTML = '<div class="twelve columns"><div class="six columns"><p>' + times + '</p></div></div>';
          }      
      }
  });
}
function dis_Hour ( venue ) { $ . ajax ( { url : 'https://api.foursquare.com/v2/venues/' + venue . id + '/hours?client_id=SZIHYFHTJSL5ZSZEJLY0VFBPSR4N54WUDCZGKKNQWTSXUUBC&client_secret=INL4I1MPCAALYO5WLC0SQKH2HAKD3RI1X2IWEI3ZBY3QQQYX&v=20140806' , dataType : 'JSONP' , success : function ( val ) { var times = [ ] ; if ( val . response . hours . timeframes ) { for ( h = 0 ; h < val . response . hours . timeframes . length ; h ++ ) { var length = val . response . hours . timeframes [ h ] ; for ( i = 0 ; i < length . days . length ; i ++ ) { var opening_times = length . open [ 0 ] . start + ' ' + ' - ' + length . open [ 0 ] . end ; times . push ( opening_times ) ; } } var monday = 'Monday' ; var tuesday = 'Tueday' ; var wed = 'Wednesday' ; var thur = 'Thursday' ; var fri = 'Friday' ; var sat = 'Saturday' ; var sun = 'Sunday' ; if ( ! times [ 0 ] ) { var mTime = 'Closed' ; } else { var mTime = times [ 0 ] ; } if ( ! times [ 1 ] ) { var tTime = 'Closed' ; } else { var tTime = times [ 1 ] ; } if ( ! times [ 2 ] ) { var wTime = 'Closed' ; } else { var wTime = times [ 2 ] ; } if ( ! times [ 3 ] ) { var thTime = 'Closed' ; } else { var thTime = times [ 3 ] ; } if ( ! times [ 4 ] ) { var fTime = 'Closed' ; } else { var fTime = times [ 4 ] ; } if ( ! times [ 5 ] ) { var sTime = 'Closed' ; } else { var sTime = times [ 5 ] ; } if ( ! times [ 6 ] ) { var sunTime = 'Closed' ; } else { var sunTime = times [ 6 ] ; } var htmlOpen = '' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + monday + '</p></div><div class="six columns"><p>' + mTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + tuesday + '</p></div><div class="six columns"><p>' + tTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + wed + '</p></div><div class="six columns"><p>' + wTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + thur + '</p></div><div class="six columns"><p>' + thTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + fri + '</p></div><div class="six columns"><p>' + fTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sat + '</p></div><div class="six columns"><p>' + sTime + '</p></div></div>' ; htmlOpen += '<div class="twelve columns"><div class="six columns"><p>' + sun + '</p></div><div class="six columns"><p>' + sunTime + '</p></div></div>' ; document . getElementById ( 'venue_day' ) . innerHTML = htmlOpen ; } else { times = 'No opening hours avaliable' ; document . getElementById ( 'venue_day' ) . innerHTML = '<div class="twelve columns"><div class="six columns"><p>' + times + '</p></div></div>' ; } } } ) ; }
Gather the opening hours to display
Gather the opening hours to display
//CHECK IF ANY RESPONSE IS AVALIABLE IF SO LOOP THROUGH JSON FILE   
