Updated code to ensure if pop up is already present the new one will refer to the width and height of the parent, instead of default. This prevents the new popup's dimensions overshooting that of it's parent