apiready = function() {
	var ctrl = {
		init : {},
		bind : {}
	}

	ctrl.init = function() {
		CommonModel.fitInStatusBar();
		// 控制菜单权限
		privilegeModule.getMenuList(function() {
				ctrl.initMenu();
		});
		ctrl.bind();
	}
	ctrl.initMenu = function() {
		if(!privilegeModule.hasMenu('巡检日志')){
			$('#inspect-log').css('display','none');
		}
		if(!privilegeModule.hasMenu('抢修日志')){
			$('#repair-log').css('display','none');
		}
		if(!privilegeModule.hasMenu('操作票')){
			$('#operate-ticket').css('display','none');
		}
		if(!privilegeModule.hasMenu('工作票')){
			$('#work-ticket').css('display','none');
		}
	}
	ctrl.bind = function() {
		//点击返回按钮
		$api.addEvt($api.dom("#back"), "touchend", function() {
			api.closeWin();
		})
		//用户点击了巡检日志(新版)按钮
		$api.addEvt($api.dom("#inspect-log-new"), "touchend", function() {

			api.openWin({
				name : 'inspect-log-new',
				url : './logQuery-main.html',
				pageParam : {
					page : 'inspect-new'
				}
			});
		});

		//用户点击了巡检日志(旧版)按钮
		$api.addEvt($api.dom("#inspect-log"), "touchend", function() {

			api.openWin({
				name : 'inspect-log',
				url : './logQuery-main.html',
				pageParam : {
					page : 'inspect'
				}
			});
		});

		//用户点击了抢修日志按钮
		$api.addEvt($api.dom("#repair-log"), "touchend", function() {
			api.openWin({
				name : 'repair-log',
				url : './logQuery-main.html',
				pageParam : {
					page : 'repair'
				}
			});
		});

		//用户点击了操作票按钮
		$api.addEvt($api.dom("#operate-ticket"), "touchend", function() {
			api.openWin({
				name : 'operate-ticket',
				url : './logQuery-main.html',
				pageParam : {
					page : 'operate'
				}
			});
		});

		//用户点击了工作票按钮
		$api.addEvt($api.dom("#work-ticket"), "touchend", function() {
			api.openWin({
				name : 'work-ticket',
				url : './logQuery-main.html',
				pageParam : {
					page : 'work'
				}
			});
		});

	}

	ctrl.init();
}
