(function() {
	function  receiveMessage(event) {
		var data = event.data;
		var srcWin = event.source;
		var srcId = srcWin.frameElement.id;  //srcWin.name
		switch(data.cmd) {
			case 'show':
				QGWidget.show(srcId);
				break;
			case 'hide':
				QGWidget.hide(srcId);
				break;
			case 'move':
				QGWidget.show(srcId, data.x, data.y);
				break;
			case 'resize':
				QGWidget.show(srcId, data.width, data.height);
				break;
		}
	}
	window.Page = {
		init: function() {
			Communicator.send('get_vars', { keys: ['skin']}, 'common', 'Skin.onResponseSkin');
			Communicator.register('ChangeSkin', 'Skin.onChangeSkin');
			window.addEventListener("message", receiveMessage, false);
		}
	}
})();