jQuery( document ).ready(function() {
  if (swfobject.hasFlashPlayerVersion("10.0.0")) {
    var flashvars = {};
    var params = {};
    // enable javascript interface
    flashvars.externalinterface="1";
    params.quality = "high";
    params.bgcolor = "";
    params.allowscriptaccess = "sameDomain";
    params.allowfullscreen = "true";
    var attributes = {};
    attributes.id = "flashpano";
    attributes.name = "flashpano";
    attributes.align = "middle";

    params.base="https://s3.eu-west-2.amazonaws.com/ga-transformation/images/images/";
    params.wmode = "transparent";
    pano=new pano2vrPlayer("tour",{ useFlash:true, flashPlayerId: 'flashpano', flashContainerId:'flashcontainer'});
    swfobject.embedSWF("https://s3.eu-west-2.amazonaws.com/aga-javascript/pano2vr_player.swf", "flashcontainer", "100%", "100%", "10.0.0", "", flashvars, params, attributes);

  } else
    // check for CSS3 3D transformations and WebGL
  if (ggHasHtml5Css3D() || ggHasWebGL()) {
    // create the panorama player with the container
    pano=new pano2vrPlayer("tour");
  }
  // add the skin object
  skin=new pano2vrSkin(pano, "https://s3.eu-west-2.amazonaws.com/ga-transformation/images/");
  // load the configuration
  window.addEventListener("load", function() {
    pano.readConfigUrlAsync("https://s3.eu-west-2.amazonaws.com/ga-transformation/index.xml",function() {  gyro=new pano2vrGyro(pano,"tour");});
  });

  document.querySelector('.back-button').addEventListener('click', function(){
    window.history.back();
  });
});
