// System Class
var System = {
 
    setup_blank: function() {
      var username = user;

	var bList = $('buddylist');
	bList.innerHTML = '<div align="center"><img src="'+HOME_URL+'/images/graphics/icon_ziczac.png" style="border:0;margin-top:100px" ><br><span style="color:#430000">Bạn chưa có bạn bè nào hết! Hãy kết bạn đi nhé!</span></div>';

	Event.observe(document, 'focus', function() { blinkerOn(false); });
	Event.observe(window, 'focus', function() { blinkerOn(false); });
	
	Event.observe(document, 'blur', function() { blinkerOn(true); });
	Event.observe(window, 'blur', function() { blinkerOn(true); });
	
	Event.observe(document, 'keypress', function(e) {
										  var evt = e || window.event;
										  if(Windows.focusedWindow.getId().indexOf('_im') != -1 && IM.sendBoxWithFocus == null) {
											 var sB = $(Windows.focusedWindow.getId() + '_sendBox');
											 sB.focus(); sB.value += String.fromCharCode(evt.charCode);
										  }
									   });

	Event.stopObserving(window, 'resize', recenterModal);
	},


	logout: function(strMsg)
	{
		if(user == '')
		{
			return;
		}
		
		if(strMsg=='')
		{
			strMsg = Languages.get('signOff');	
		}
		
		xajax_quickLogout();
		objJS.dnn();
		clearTimeout(pingTimer);
	   
		defaultTitle = parent.document.title = parent.document.title.replace(': ' + init_displayname, '');
		user = '';
		init_displayname = '';
		
		if(typeof(Status) != 'undefined') {
			Status.state = 0;
			Status.awayMessage = '';
		}
		Element.stopObserving(window, 'resize', recenterModal);
		
		if(typeof(Buddylist) != 'undefined') Buddylist.destroy();
		
		for(var name in IM.windows) {
			if(typeof(IM.windows[name].getId) != 'undefined' && typeof($(IM.windows[name].getId())) != 'undefined') {
				try {
					if(IM.windows[name].detached)
						IM.windows[name].popup.close();
					else
						IM.windows[name].destroy();
				} catch(e) { }
			}
		}
		  
		for(var name in Chatroom.windows) {
		if(typeof(Chatroom.windows[name].getId) != 'undefined' && typeof($(Chatroom.windows[name].getId())) != 'undefined') {
			try {
				Chatroom.windows[name].destroy();
			} catch(e) { }
			}
		}
	
		Dialog.alert('<span class="dialog_long_label">' + strMsg + '</span>',
				   { windowParameters: {className:'alert', width:alertWidth, height: 85}, 
					 okLabel: Languages.get('reconnect'),
					 ok:function(win) {
						try {
						   window.location.href=HOME_URL;
						} catch(e) { }
					 }
				   }
		);
		$('signintomore').style.display='none';

	}
};