Iterative tree algorithms

This commit takes all of the recursive algorithms in Pouch.merge and Pouch.js that implement tree merging and traversal, and implements them in an iterative form.  This seems to do a lot to help with stack errors on mobile devices.

I can't get the saucelabs tester to work, but I've tested on Safari, Chrome, FF, and iOS 6 Mobile Safari.