added frame div structure and modified photo display algorithm