If the usernames and passwords are stored in a database, why not have an additional field called something like 'access_level', which can be set to 1 or 2. If the user has access level 1, they go to the public members page, if they have level 2, they go to the private page. If you do it in javascript, it will be very hard to stop people viewing the JS code, and hacking the private members site.