writeopen javascript stuff