/* FitVids */
$(document).ready(function(){
  $("iframe").fitVids();
});

/* Authentic Jobs */    
$(function() {
  
  // Remove "uk." for listings from http://authenticjobs.com
  $.get("http://uk.authenticjobs.com/js/jobs_r_v2.js", function(data) {  
    
    var listings = "";    
    
    $.each(data.listings, function(index, listing) {

      // Tailor the markup being assembled here to suit your site requirements / semantic preferences
      listings += "<li><strong>" + listing.company + "</strong> needs a <a href='" + listing.url + "'>" + listing.title + "</a>";
      if (listing.location != "") {
        listings += " in " + listing.location;
      }
      listings += "</li>";
      
    });
    
    // Replace "ul.job-listing" with a selector for the container into which the listings will be inserted
    // Append will append the listings into the end of the container element.
    $("ul.job-listings").append(listings);
    
  }, "jsonp");
  
});
     
/* Gaug.es */   
var _gauges = _gauges || [];
(function() {
  var t   = document.createElement('script');
  t.type  = 'text/javascript';
  t.async = true;
  t.id    = 'gauges-tracker';
  t.setAttribute('data-site-id', '4e77630cf5a1f5088c000001');
  t.src = '//secure.gaug.es/track.js';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(t, s);
})();

/* iOS re-orientation fix */  
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
  var viewportmeta = document.querySelectorAll('meta[name="viewport"]')[0];
  if (viewportmeta) {
    viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
    document.body.addEventListener('gesturestart', function() {
    viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
  }, false);
 }
}
