Javascript update

Replacing top.location for document.location. Use top.location causes conflict with Canvas Apps and Page Apps on Facebook iframes. (the page facebook redirect, not CakePHP page)