// Incline Menu
function InclineMenu(hide75degrees){
  var inclineMenu = new createjs.Container();

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

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

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

  var inclineInstructionText = new createjs.Text("Select an Incline for the First Ladder", "30px sans-serif", "#444");
  inclineInstructionText.textAlign = "center";
  inclineInstructionText.y = 130;
  inclineMenu.addChild(inclineInstructionText);

  var fiftyDegreesButton = new createjs.Container();
  fiftyDegreesButton.x = -146;
  fiftyDegreesButton.y = 175;

  inclineMenu.addChild(fiftyDegreesButton);

  var fiftyDegreesButtonShape = new createjs.Shape();
  fiftyDegreesButtonShape.graphics.beginStroke("#e17a0f").drawRoundRect(-5,-5,300,185,5);
  fiftyDegreesButton.addChild(fiftyDegreesButtonShape);

  var fiftyDegreesButtonGraphic = new createjs.Bitmap("assets/50degicon.jpg");
  fiftyDegreesButton.addChild(fiftyDegreesButtonGraphic);

  var fiftyDegreesButtonHelper = new createjs.ButtonHelper(fiftyDegreesButton);
  fiftyDegreesButton.addEventListener("click", handleFiftyDegreesButtonClick);

  if (!hide75degrees){
    var seventyFiveDegreesButton = new createjs.Container();
    seventyFiveDegreesButton.x = -146;
    seventyFiveDegreesButton.y = 375;

    inclineMenu.addChild(seventyFiveDegreesButton);

    var seventyFiveDegreesButtonShape = new createjs.Shape();
    seventyFiveDegreesButtonShape.graphics.beginStroke("#e17a0f").drawRoundRect(-5,-5,300,185,5);
    seventyFiveDegreesButton.addChild(seventyFiveDegreesButtonShape);

    var seventyFiveDegreesButtonGraphic = new createjs.Bitmap("assets/75degicon.jpg");
    seventyFiveDegreesButton.addChild(seventyFiveDegreesButtonGraphic);

    var seventyFiveDegreesButtonHelper = new createjs.ButtonHelper(seventyFiveDegreesButton);
    seventyFiveDegreesButton.addEventListener("click", handleSeventyFiveDegreesButtonClick);
  }

  var ninetyDegreesButton = new createjs.Container();
  ninetyDegreesButton.x = -146;
  ninetyDegreesButton.y = 575;

  inclineMenu.addChild(ninetyDegreesButton);

  var ninetyDegreesButtonShape = new createjs.Shape();
  ninetyDegreesButtonShape.graphics.beginStroke("#e17a0f").drawRoundRect(-5,-5,300,185,5);
  ninetyDegreesButton.addChild(ninetyDegreesButtonShape);

  var ninetyDegreesButtonGraphic = new createjs.Bitmap("assets/90degicon.jpg");
  ninetyDegreesButton.addChild(ninetyDegreesButtonGraphic);

  var ninetyDegreesButtonHelper = new createjs.ButtonHelper(ninetyDegreesButton);
  ninetyDegreesButton.addEventListener("click", handleNinetyDegreesButtonClick);

  if(hide75degrees){
    fiftyDegreesButton.y = 200;
    ninetyDegreesButton.y = 400;
  }

  var backButton = new createjs.Container();
  backButton.x = -430;
  backButton.y = 50;

  inclineMenu.addChild(backButton);

  backButtonShape = new createjs.Shape();
  backButtonShape.graphics.beginFill("#494c53").beginStroke("#5f6064").drawRoundRect(0,0,60,40,5);
  backButton.addChild(backButtonShape);

  var backButtonText = new createjs.Text("Back", "16px sans-serif", "#fff");
  backButtonText.textAlign = "center";
  backButtonText.y = 10;
  backButtonText.x = 30;
  backButton.addChild(backButtonText);

  var backButtonHelper = new createjs.ButtonHelper(backButton);
  backButton.addEventListener("click", handleInclineBackButtonClick);

  return inclineMenu;
}

// Event Handlers
function handleInclineBackButtonClick(event){
  switch(system){
    case 1:
      showHeightMenu();
      break;
    case 2:
      showPlatformTypeMenu();
      break;
    case 3:
      showHeightMenu();
    default:
      break;
  }
}

function handleFiftyDegreesButtonClick(event){
  setIncline(50);
  showConfigurator();
}

function handleSeventyFiveDegreesButtonClick(event){
  setIncline(75);
  showConfigurator();
}

function handleNinetyDegreesButtonClick(event){
  setIncline(90);
  showConfigurator();
}