var apps = {
	loading: function(is) {
		$('#loading').css('display', is ? 'block': 'none');
	},
	info: function(message, title, position) {
		toastr.info(message, title, {positionClass: 'toast-' + (position || 'top-center'), timeOut: 1000});
	},
	error: function(message, title, position) {
		toastr.error(message, title, {positionClass: 'toast-' + (position || 'top-center')});
	},	
	//============header info===============
	showCurentUserInfo: function() {
		$.getJSON('partnership/getCurrentUserInfo', function(data) {
			if(data.content) {
				$('#x-user-not-login').hide();
				var userInfo = $('#x-userInfo-body');
				userInfo.appendTpl('<div style="text-align:left"><ul><li style="list-style-type:none;">用户：#{fn:userName}</li><li style="list-style-type:none;">企业：#{fn:enName}</li></ul></div>', data.content, {
					userName: function(data) {
						return data.username;
					},
					enName: function(data) {
						return data.enName;
					},
					enBusCode: function(data) {
						return data.enBusCode;
					}
				});
			} 
		});
	},
	//============document ready===============
	init: function() {
		apps.showCurentUserInfo();
	}
};
$(document).ready(function() {
	apps.init();
});