Improved iframe JavaScript