added mainOrigin variable for origin of parent document