var subWinFocus = {
	onLoad : function() {
		 /*
		  * Gère le placement du focus sur le bouton de fermeture sur les iframes et les tooltips.
		  * Gère également la fermeture sur Echap
		  */
	
		 // subWindow
		 scDynUiMgr.subWindow.addOnLoadListener(function(pFra) {
		 	var vCloseBtn = scPaLib.findNode("des:button.subWinClose", pFra.contentDocument);
		 	if (vCloseBtn) {
		 		vCloseBtn.focus();
		 		pFra.contentDocument.addEventListener('keypress', function(event) {
			 		if (event.keyCode == 27 /* Escape */) pFra.hideSubWindow();
			 	}, false);
			 	
			 	scPaLib.findNode("ide:focusOnCloseBtn", pFra.contentDocument).onfocus = function(){ vCloseBtn.focus(); }
			 	scPaLib.findNode("ide:focusOut", pFra.contentDocument).onclick = function() { pFra.fWin.fAnc.focus(); }
		 	}
		 });
	
		 scDynUiMgr.subWindow.addCloseListener(function(pId) {
		 	var vSubWin = scDynUiMgr.subWindow.fSubWins[pId];
		 	if (vSubWin && vSubWin.fAnc) vSubWin.fAnc.focus();
		 });
	
	
		 // tooltip
		 scTooltipMgr.addShowListener(function(pNode) {
		 	var vCloseBtn = scPaLib.findNode("des:a.tt_x", scTooltipMgr.fCurrTt);
		 	if (vCloseBtn) window.setTimeout(function(){vCloseBtn.focus();}, pNode.fOpt.DELAY + 10);
		 });
	
		 scTooltipMgr.addHideListener(function(pNode) {
		 	if (pNode) pNode.focus();
		 });
	
		 document.addEventListener('keypress', function(event) {
		 	if(event.keyCode == 27 /* Escape */ && scTooltipMgr.fCurrTt) scTooltipMgr.hideTooltip(true);
		 }, false);
	}
}
if (scOnLoads) scOnLoads[scOnLoads.length] = subWinFocus;
