it is not secure when using javascript to protect yr site. any users can view the source and look at the password.
a php version is more like it.(phpaccess is a good one using .htacess and .htpasswd)
unless u encrypt yr html code,even that can be easily decode using a program download from site
good luck