// Start Menu
function StartMenu() {
  var startMenu = new createjs.Container();

  var triarcLogo = new createjs.Bitmap("assets/TriArcLogo.jpg");
  triarcLogo.x = -390;
  triarcLogo.y = 720;
  startMenu.addChild(triarcLogo);

  if(VENDOR)
  {
    var graingerLogo = new createjs.Bitmap("assets/GraingerLogo.jpg");
    graingerLogo.x = 160;
    graingerLogo.y = 720;
    startMenu.addChild(graingerLogo);
  }

  var udesignLogo = new createjs.Bitmap("assets/UDesignLogo.jpg");
  udesignLogo.x = -178;
  udesignLogo.y = 30;
  startMenu.addChild(udesignLogo);

  var udesignLogoBorder = new createjs.Shape();
  udesignLogoBorder.graphics.beginStroke("#e17a0f").drawRoundRect(-184,20,368,110,5);
  startMenu.addChild(udesignLogoBorder);

  var startInstructionText = new createjs.Text("Click a Product to Begin", "30px sans-serif", "#404040");
  startInstructionText.textAlign = "center";
  startInstructionText.x = 0;
  startInstructionText.y = 160;
  startMenu.addChild(startInstructionText);

  var rooftopButton = new createjs.Container();
  rooftopButton.x = -325;
  rooftopButton.y = 475;
  startMenu.addChild(rooftopButton);

  var rooftopButtonBorder = new createjs.Shape();
  rooftopButtonBorder.graphics.beginStroke("#e17a0f").drawRoundRect(0,-180,200,210,5);
  rooftopButton.addChild(rooftopButtonBorder);

  var rooftopButtonImage = new createjs.Bitmap("assets/rooftopicon.jpg");
  rooftopButtonImage.y = -175;
  rooftopButtonImage.x = 22;
  rooftopButton.addChild(rooftopButtonImage);

  var rooftopButtonShape = new createjs.Shape();
  rooftopButtonShape.graphics.beginFill("#ff9e35").beginStroke("#e17a0f").drawRoundRect(0,0,200,40,5);
  rooftopButton.addChild(rooftopButtonShape);

  var rooftopButtonText = new createjs.Text("Rooftop Platform", "20px sans-serif", "#fff");
  rooftopButtonText.textAlign = "center";
  rooftopButtonText.y = 10;
  rooftopButtonText.x = 100;
  rooftopButton.addChild(rooftopButtonText);

  var rooftopButtonHelper = new createjs.ButtonHelper(rooftopButton);
  rooftopButton.addEventListener("click", handleRooftopButtonClick);


  var crossoverButton = new createjs.Container();
  crossoverButton.x = -100;
  crossoverButton.y = 475;
  startMenu.addChild(crossoverButton);

  var crossoverButtonBorder = new createjs.Shape();
  crossoverButtonBorder.graphics.beginStroke("#e17a0f").drawRoundRect(0,-180,200,220,5);
  crossoverButton.addChild(crossoverButtonBorder);

  var crossoverButtonImage = new createjs.Bitmap("assets/crossovericon.jpg");
  crossoverButtonImage.x = 10;
  crossoverButtonImage.y = -175;
  crossoverButton.addChild(crossoverButtonImage);

  var crossoverButtonShape = new createjs.Shape();
  crossoverButtonShape.graphics.beginFill("#ff9e35").beginStroke("#e17a0f").drawRoundRect(0,0,200,40,5);
  crossoverButton.addChild(crossoverButtonShape);

  var crossoverButtonText = new createjs.Text("Crossover Ladder", "20px sans-serif", "#fff");
  crossoverButtonText.textAlign = "center";
  crossoverButtonText.y = 10;
  crossoverButtonText.x = 100;
  crossoverButton.addChild(crossoverButtonText);

  var crossoverButtonHelper = new createjs.ButtonHelper(crossoverButton);
  crossoverButton.addEventListener("click", handleCrossoverButtonClick);

  var maxaccessButton = new createjs.Container();
  maxaccessButton.x = 125;
  maxaccessButton.y = 475;
  startMenu.addChild(maxaccessButton);

  var maxaccessButtonBorder = new createjs.Shape();
  maxaccessButtonBorder.graphics.beginStroke("#e17a0f").drawRoundRect(0,-180,200,220,5);
  maxaccessButton.addChild(maxaccessButtonBorder);

  var maxaccessButtonImage = new createjs.Bitmap("assets/maxaccessicon.JPG");
  maxaccessButtonImage.x = 10;
  maxaccessButtonImage.y = -175;
  maxaccessButton.addChild(maxaccessButtonImage);

  var maxaccessButtonShape = new createjs.Shape();
  maxaccessButtonShape.graphics.beginFill("#ff9e35").beginStroke("#e17a0f").drawRoundRect(0,0,200,40,5);
  maxaccessButton.addChild(maxaccessButtonShape);

  var maxaccessButtonText = new createjs.Text("Max-Access Ladder", "20px sans-serif", "#fff");
  maxaccessButtonText.textAlign = "center";
  maxaccessButtonText.y = 10;
  maxaccessButtonText.x = 100;
  maxaccessButton.addChild(maxaccessButtonText);

  var maxaccessButtonHelper = new createjs.ButtonHelper(maxaccessButton);
  maxaccessButton.addEventListener("click", handlemaxaccessButtonClick);

  return startMenu;
}

// Event Handlers
function handleRooftopButtonClick(event){
  setSystem(LadderType.Rooftop);
  showHeightMenu();
}

function handleCrossoverButtonClick(event){
  setSystem(LadderType.Crossover);
  showHeightMenu();
}

function handlemaxaccessButtonClick(event){
  setSystem(LadderType.MaxAccess);
  showHeightMenu();
}