function collectUserBoughtGifts(){
  var userGiftArr = [];
  var userPrivateGiftArr = [];
  for(var i = 0; i < userArr.length; i++) {
    userGiftArr = userArr[i].giftList;
    userPrivateGiftArr = userArr[i].privateList;

    if(userGiftArr == undefined){}
    else if (userGiftArr.length != undefined) {
      for (var a = 0; a < userGiftArr.length; a++) {
        if (userGiftArr[a].buyer == user.userName) {
          userBoughtGifts.push(userGiftArr[a]);
          userBoughtGiftsUsers.push(userArr[i].name);
        }
      }
    }

    if(userPrivateGiftArr == undefined){}
    else if (userPrivateGiftArr.length != undefined) {
      for (var b = 0; b < userPrivateGiftArr.length; b++) {
        if (userPrivateGiftArr[b].buyer == user.userName) {
          userBoughtGifts.push(userPrivateGiftArr[b]);
          userBoughtGiftsUsers.push(userArr[i].name + " (Private List)");
        }
      }
    }
  }
}
//be sent to the boughtGifts page if the "Bought Gifts" button is pressed.
be sent to the boughtGifts page if the "Bought Gifts" button is pressed.
be sent to the boughtGifts page if the " Bought Gifts " button is pressed .
function collectUserBoughtGifts(){
  var userGiftArr = [];
  var userPrivateGiftArr = [];
  for(var i = 0; i < userArr.length; i++) {
    userGiftArr = userArr[i].giftList;
    userPrivateGiftArr = userArr[i].privateList;
    if(userGiftArr == undefined){}
    else if (userGiftArr.length != undefined) {
      for (var a = 0; a < userGiftArr.length; a++) {
        if (userGiftArr[a].buyer == user.userName) {
          userBoughtGifts.push(userGiftArr[a]);
          userBoughtGiftsUsers.push(userArr[i].name);
        }
      }
    }
    if(userPrivateGiftArr == undefined){}
    else if (userPrivateGiftArr.length != undefined) {
      for (var b = 0; b < userPrivateGiftArr.length; b++) {
        if (userPrivateGiftArr[b].buyer == user.userName) {
          userBoughtGifts.push(userPrivateGiftArr[b]);
          userBoughtGiftsUsers.push(userArr[i].name + " (Private List)");
        }
      }
    }
  }
}
function collectUserBoughtGifts ( ) { var userGiftArr = [ ] ; var userPrivateGiftArr = [ ] ; for ( var i = 0 ; i < userArr . length ; i ++ ) { userGiftArr = userArr [ i ] . giftList ; userPrivateGiftArr = userArr [ i ] . privateList ; if ( userGiftArr == undefined ) { } else if ( userGiftArr . length != undefined ) { for ( var a = 0 ; a < userGiftArr . length ; a ++ ) { if ( userGiftArr [ a ] . buyer == user . userName ) { userBoughtGifts . push ( userGiftArr [ a ] ) ; userBoughtGiftsUsers . push ( userArr [ i ] . name ) ; } } } if ( userPrivateGiftArr == undefined ) { } else if ( userPrivateGiftArr . length != undefined ) { for ( var b = 0 ; b < userPrivateGiftArr . length ; b ++ ) { if ( userPrivateGiftArr [ b ] . buyer == user . userName ) { userBoughtGifts . push ( userPrivateGiftArr [ b ] ) ; userBoughtGiftsUsers . push ( userArr [ i ] . name + " (Private List)" ) ; } } } } }
be sent to the boughtGifts page if the "Bought Gifts" button is pressed.
be sent to the boughtGifts page if the " Bought Gifts " button is pressed .