//declare new user information
var myUsername;
var myCareer;
var mySalary;
var myGender;
var index;
var indexFound=false;

//default users
var bill_gates = {"username":"bill_gates","gender":"male","salary":11500000000, "details":"Co-Founder at Microsoft"};
var marissa_mayer = {"username":"marissa_mayer","gender":"female","salary":36000000,"details":"CEO at Yahoo"};
var mark_zuckerberg = {"username":"mark_zuckerberg","gender":"male","salary":1, "details":"CEO and Co-Founder at Facebook. Computer Programmer, Internet Entrepreneur."};

//existing array of occupations and members
var users = [bill_gates, marissa_mayer, mark_zuckerberg];

function newUser(){
  window.alert("starting newUser");
  myUsername = document.getElementById("username").value;
  mySalary = document.getElementById("salary").value;
  // validateField(myUsername);
  // validateField(mySalary);

  // if (validateField(myUsername) == true || validateField(mySalary) == true) {
  var user = {"username":myUsername,"gender":myGender,"salary":mySalary}; //,"details":details
  addUser(user);


  // var isFemale = document.getElementById("optionFemale").value;
  // if (isFemale == true){
  //   myGender = "female";
  // }else{
  //   myGender = "male";
  // }
  //details = document.getElementById("");

}

// function validateField(field) {
//   if (field == "") {
//     alert("All fields must be filled out");
//     return false;
//   }
// }

function addUser(user){
  //find index
  window.alert("starting addUser");
  for (i=0; i<users.length; i++){
    if (indexFound==false){
      if (users[i].salary>user.salary){
        index=i+1;
        indexFound=true;
      }
    }
  }
  if (indexFound==false){
    index=users.length;
    indexFound=true;
  }
  //add user to user array
  users.splice(index,0,user);
  sendAlert();
}

function sendAlert(){
  var string = "";
  for (i=0;i<users.length;i++){
    string+=users[i].username+" - ";
  }
  window.alert(string);
}

@@ -107,22 +107,16 @@
 dexFound
-=false
 ;%0A%0A//def
@@ -651,16 +651,18 @@
 er()%7B%0A  
+//
 window.a
@@ -687,16 +687,36 @@
 User%22);%0A
+  indexFound=false;%0A
   myUser
@@ -1473,16 +1473,18 @@
 index%0A  
+//
 window.a
@@ -1608,16 +1608,49 @@
 r.salary
+ && users%5Bi+1%5D.salary%3Cuser.salary
 )%7B%0A     

Fix NewUser