var finisher = new Finisher();
var serial;

function Finisher() {
  this.showBadDataMsg = 
    function() { 
      var topView = document.getElementById("topView");  
      topView.innerHTML =
        'Sorry the data received from the server is corrupted. Please try again later.';
    }  
 
  this.showResponse = 
    function(serialStr) {
      serial = serialStr;
    
      var topView = document.getElementById("topView");  
      
      topView.innerHTML =
        '<div style="padding:25px;"><h2>Your design has been added to the archives!</h2> <br/><br/>' +
        'Press the show matches button to show the closest matches to your design.' +
     	'<br/>'+
	   	'<br/>'+
	    '<input type="submit" name="submit" onclick="makeAnotherDesignBtnClicked(this)" id="makeAnotherDesignBtn" value="Make Another Design"/>' +
	    '<br/>'+
      '<input type="submit" name="showMatchesBtn" onclick="showMatchesBtnClicked(this)" id="showMatchesBtn" value="Show closest matches"/>' +
	    '</div>';
    } 
}

function makeAnotherDesignBtnClicked() {
  showOrHideControls(true);
  showTopView2();
  
  for (var i = 0; i < LIGHTS; i++) {
    lightSelected[i] = true;
  }
  syncCheckBoxes();  
  
  marker.move(originLatitude, originLongitude);
  slider.setZ(StartSliderZ);
  
// select pyramid  
  var stylesCombo = document.getElementById('stylesCombo');
  stylesCombo.selectedIndex = 0;
  designMode = DesignMode.pyramid;
  
  syncBeams();

  var camModeCombo = document.getElementById('camModeCombo');
  camModeCombo.selectedIndex = 0;

  var navCombo = document.getElementById('navCombo');
  navCombo.selectedIndex = 1;
  
  navCamera.stop();
  navCamera.selectView(1);
}  

function showMatchesBtnClicked(sender) {
  window.open('http://www.vectorialvancouver.net/cgi-bin/matchsearch.cgi?SR=' + serial);
}