A simple javascript code for mask location