//
//     Addition of HBr to propene
//

// Define "Global" variables

   // maxStep = number of reaction steps
   // maxCurve = total number of curved arrows in ALL steps
   // Control whether to go to next step after finishing each arrow
var maxStep = 2
var maxCurve = 3
var Control = new Array(0,1,1)

   // Define position of reaction images
var imgMol = new Array(maxStep+2)
var imgX   = new Array(maxStep+2)
var imgY   = new Array(maxStep+2)

imgMol[0] = "Alkene1.gif"
imgMol[1] = "Alkene2.gif"
imgMol[2] = "Alkene3.gif"
imgMol[3] = "Alkene.gif"
imgX[0] = 195
imgY[0] =  73
imgX[1] = 209
imgY[1] =  82
imgX[2] = 125
imgY[2] =  82
imgX[3] = 486
imgY[3] = 256

   // Define correct location of lone pairs to "move"
   // Array elements [i][j]
   //      i = Index # of current curve
   //      j = left, right, top, and bottom coordinates
var GoodStart = new Array(maxCurve)
var GoodStop  = new Array(maxCurve)
GoodStart[0] = new Array( 40, 70, 15, 45)
GoodStop[0]  = new Array(137,143, 29, 40)
GoodStart[1] = new Array(145,165, 25, 40)
GoodStop[1]  = new Array(167,184, 24, 41)
GoodStart[2] = new Array(178,190, 28, 35)
GoodStop[2]  = new Array( 48, 58, 35, 48)

// ----- Error Message section -----
   // Create arrays to hold location of "bad" starting/stopping points
var BadStart = new Array(maxCurve)
var BadStop  = new Array(maxCurve)
var maxBadStart = new Array(5,1,4)
var maxBadStop  = new Array(1,1,1)
for (i=0; i<maxCurve; i++) {
   BadStart[i] = new Array(maxBadStart[i])
   BadStop[i]  = new Array(maxBadStop[i])
   }
   // Parameters = left, right, top, bottom, and error number
BadStart[0][0] = new Array(  0, 38,  0, 36, 1)
BadStart[0][1] = new Array(  0, 38, 38, 73, 2)
BadStart[0][2] = new Array( 70, 97,  0, 36, 2)
BadStart[0][3] = new Array( 70, 97, 38, 73, 2)
BadStart[0][4] = new Array(133,195, 19, 49, 3)
BadStart[1][0] = new Array(  0, 97,  0, 73, 4)
BadStart[2][0] = new Array(  0, 97,  0, 73, 5)
BadStart[2][1] = new Array(178,191, 49, 55, 6)
BadStart[2][2] = new Array(174,181, 36, 49, 6)
BadStart[2][3] = new Array(194,200, 36, 49, 6)
BadStop[0][0] = new Array(  0,  0,  0,  0, 0)  // (Placeholder)
BadStop[1][0] = new Array(  0,  0,  0,  0, 0)  // (Placeholder)
BadStop[2][0] = new Array(  0,  0,  0,  0, 0)  // (Placeholder)

   // Actual error messages
maxErr = 7
ErrMsg0 = " "
ErrMsg1 = "C-C bonds not usually broken in alkenes"
ErrMsg2 = "C-H bonds in alkenes not acidic enough to react"
ErrMsg3 = "H-Br does not act as Lewis base in this reaction"
ErrMsg4 = "Propene doesn't react any more in this step"
ErrMsg5 = "Propenyl carbocation doesn't act as Lewis base"
ErrMsg6 = "Correct. However, choose electron pair on 'top' to continue"


