diff --git a/openbis/resource/examples/crud-demo/1/as/webapps/crud-demo/html/index.html b/openbis/resource/examples/crud-demo/1/as/webapps/crud-demo/html/index.html
index b8458ba9983ef61195490cf13f6f90432e366d42..3033a4b037822a10553970898b8b15dbfa1c3fdb 100644
--- a/openbis/resource/examples/crud-demo/1/as/webapps/crud-demo/html/index.html
+++ b/openbis/resource/examples/crud-demo/1/as/webapps/crud-demo/html/index.html
@@ -19,7 +19,7 @@
 <script>
 
 $(document).ready(function() {
-  configureLoginPage(openbisServer, enterApp);
+	new openbisLoginPage(openbisServer, enterApp).configure();
 });
 
 </script>
diff --git a/openbis/resource/examples/service-demo/1/as/webapps/aggregation/html/index.html b/openbis/resource/examples/service-demo/1/as/webapps/aggregation/html/index.html
index 9cd55737284125cd24f03dc353c8e9fd13a137f8..c3246590234dcf8d1c0a879f66520cfbc1b39637 100644
--- a/openbis/resource/examples/service-demo/1/as/webapps/aggregation/html/index.html
+++ b/openbis/resource/examples/service-demo/1/as/webapps/aggregation/html/index.html
@@ -19,7 +19,7 @@
 <script>
 
 $(document).ready(function() {
-  configureLoginPage(openbisServer, enterApp);
+  new openbisLoginPage(openbisServer, enterApp).configure();
 });
 
 </script>
diff --git a/openbis/resource/examples/service-demo/1/as/webapps/ingestion/html/index.html b/openbis/resource/examples/service-demo/1/as/webapps/ingestion/html/index.html
index 9cd55737284125cd24f03dc353c8e9fd13a137f8..c3246590234dcf8d1c0a879f66520cfbc1b39637 100644
--- a/openbis/resource/examples/service-demo/1/as/webapps/ingestion/html/index.html
+++ b/openbis/resource/examples/service-demo/1/as/webapps/ingestion/html/index.html
@@ -19,7 +19,7 @@
 <script>
 
 $(document).ready(function() {
-  configureLoginPage(openbisServer, enterApp);
+  new openbisLoginPage(openbisServer, enterApp).configure();
 });
 
 </script>
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js/openbis-login.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js/openbis-login.js
index 939cfc84b3db6c2a6ca962940722ae93b48eac27..7d1ece5965cac06666f12b6e03d20871bc65fb36 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js/openbis-login.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js/openbis-login.js
@@ -40,6 +40,8 @@ function openbisLoginPage(openbis, onLogin)
 }
 
 openbisLoginPage.prototype.configure = function(){
+	var loginPage = this;
+	
 	$('#main').hide();
 	
 	var username = $("#username").value;
@@ -50,7 +52,7 @@ openbisLoginPage.prototype.configure = function(){
 	}
 	
 	$('#logout-button').click(function() { 
-		openbis.logout(function(data) { 
+		loginPage.openbis.logout(function(data) { 
 			$("#login-form-div").show();
 			$("#main").hide();
 			$("#username").focus();
@@ -58,10 +60,10 @@ openbisLoginPage.prototype.configure = function(){
 	});
 	
 	$('#login-form').submit(function() {
-		 openbis.login( $.trim($('#username').val()), $.trim($('#password').val()), function(data) { onLogin(data) })
+		 loginPage.openbis.login( $.trim($('#username').val()), $.trim($('#password').val()), function(data) { loginPage.onLogin(data) })
 	});
 	
-	openbis.ifRestoredSessionActive(function(data) { onLogin(data) });
+	loginPage.openbis.ifRestoredSessionActive(function(data) { loginPage.onLogin(data) });
 	
 		// Make the ENTER key the default button
 	$("login-form input").keypress(function (e) {
diff --git a/openbis/sourceTest/javascript/simpleapp/openbis-simple-app.html b/openbis/sourceTest/javascript/simpleapp/openbis-simple-app.html
index 8621fe0dd3fbd18131c7fe1bd6a5e50e7df3e258..4d2ef44a50b60a299ab9cd88c8b39859315f72de 100644
--- a/openbis/sourceTest/javascript/simpleapp/openbis-simple-app.html
+++ b/openbis/sourceTest/javascript/simpleapp/openbis-simple-app.html
@@ -154,7 +154,7 @@ function enterApp(data)
 
 
 $(document).ready(function() {
-  configureLoginPage(openbisServer, enterApp);
+  new openbisLoginPage(openbisServer, enterApp).configure();
 });
 
 </script>