<P> The episode was written by developer and executive producer of The Office Greg Daniels and Mindy Kaling, who plays Kelly Kapoor on the show . It was directed by Paul Feig, his 13th directing credit for the series . The episode was initially assigned to Mindy Kaling, but executive producer Greg Daniels said he was interested in contributing . The scene in which Jim cuts his tie off took seven takes and was written by Greg Daniels . In the original draft, the wedding was supposed to take place on the "Booze Cruise". The dance sequence during the wedding was choreographed by the same person who worked on "Cafe Disco" with all of the dancing pairs having 45 - minute practice sessions to get their moves down . John Krasinski and Jenna Fischer made a surprise trip to the Niagara Falls area with a small crew in order to film the scene with their actual wedding vows, and Krasinski was feeling ill during the filming but insisted they do multiple takes even as he was getting soaked with water . Brian Baumgartner's parents were on the Maid of the Mist boat where the marriage scene was filmed . They were visiting friends from Rochester, NY, and came into town to be extras . </P> <P> The dance down the church aisle to Chris Brown's "Forever" is based on the popular 2009 YouTube viral video, "JK Wedding Entrance Dance", in which a young couple (JK, standing for "Jill and Kevin") dance down the aisle to the song along with their wedding party . Pam mentions that the song was specifically put on a "Do Not Play List", but was choreographed by the wedding guests and office workers regardless . The song played during Andy's party is Kardinal Offishall's "Numba 1 (Tide is High)" featuring Rihanna . Dwight is shown wearing the Three Wolf Moon T - shirt, made famous by humorous reviews on Amazon, before going out to the hotel bar with Michael to pick up women, commenting that "it's suggestive to women, because of howling during sex ." </P> <P> In its original American broadcast, "Niagara" was viewed by an estimated 9.42 million households, with a 4.8 rating and a 12 share in the 18--49 demographic coming second in its timeslot after Grey's Anatomy . Greg Daniels and Mindy Kaling received a Primetime Emmy Award nomination for Outstanding Writing for a Comedy Series for their work on "Niagara" at the 62nd Primetime Emmy Awards, but lost to Modern Family's Steven Levitan and Christopher Lloyd for their work on the pilot episode . </P> <P> The episode received positive reviews from critics . The episode ranked 24th on BuddyTV's list of best 50 episodes of 2009 with them saying "It wasn't easy, but they did it all, creating a goofy, joyful, and special day for Jim and Pam that brought tears to our eyes ." Dan Phillip of IGN gave the episode an 8.3 saying calling it "Impressive" and "The episode certainly could have delivered more in terms of creativity and high comedy, but it still contained a great deal of entertainment ." Despite that, he said the episode failed in comparison to "Phyllis' Wedding". "Niagara" was voted the second highest rated out of 115 from the series, according to a poll at the fansite, OfficeTally . </P>

Which season do jim and pam get married