(function (global) { var LoginViewModel, app = global.app = global.app || {}; LoginViewModel = kendo.data.ObservableObject.extend({ isLoggedIn: false, username: "", password: "", iabRef: null, onLogin: function () { var that = this, username = that.get("username").trim(), password = that.get("password").trim(); if (username === "" || password === "") { navigator.notification.alert("Both fields are required!", function () { }, "Login failed", 'OK'); return; } that.set("isLoggedIn", true); }, onLogout: function () { var that = this; that.clearForm(); that.set("isLoggedIn", false); }, clearForm: function () { var that = this; that.set("username", ""); that.set("password", ""); }, checkEnter: function (e) { var that = this; if (e.keyCode == 13) { $(e.target).blur(); that.onLogin(); } }, run: function() { var that = this; var win = window.open('http://telerik.com', '_blank'); that.set("iabRef", win); //alert(that.iabRef.executeScript); that.iabRef.executeScript({ code: "alert('hi');"}, function(values) { }); } }); app.loginService = { viewModel: new LoginViewModel() }; app.loginService.viewModel.run(); })(window);