Problem in Z-Positioning in Windows Component DHTMLX

Hi, I do have a problem when changing window to another window which BringToTop() method doesn’t work.

Here is the code i used but still it doesn’t work.

menu_1.attachEvent("onClick", function(id, zoneId, cas)
		{
			var dhxWins = new dhtmlXWindows();
	if (id == "journalTrialBalance")
{
		document.location.href = "trial-balance.php";
		
}	
	
	if (id == "sales"){

		w1 = dhxWins.createWindow("w1", 28, 98, 300, 521);
		w1.setText("Sales Records");
	   	var grid_1 = w1.attachGrid();
		grid_1.attachEvent("onXLS",function(){
		w1.progressOn();
		})
		grid_1.setSkin("dhx_skyblue"); 	
		grid_1.setIconsPath('icons/');
		grid_1.setHeader(["Code","Product"]);
		grid_1.attachHeader("#text_search,#text_search");
		grid_1.setColTypes("ro,ro");
		grid_1.setColSorting('str,str');

		grid_1.setInitWidths('*,*');
		grid_1.enableSmartRendering(true);
		grid_1.load('database/sales.php');
		grid_1.attachEvent("onXLE",function(){
		w1.progressOff();
		})


		grid_1.init();

		dhxWins.window("w1").bringToTop();

}	

	if (id == "charge"){
			

		w2 = dhxWins.createWindow("w2", 330, 98, 1010, 521);
		w2.setText("Charge Records");

		var grid_2 = w2.attachGrid();	
		grid_2.attachEvent("onXLS",function(){
		w2.progressOn();
		})
		grid_2.setSkin("dhx_skyblue");
		grid_2.setIconsPath('icons/');
		grid_2.setHeader(["Barcode","Product Code","Description","Category","Subcategory","Brand","Model","Supplier","Date"]);
		grid_2.attachHeader("#text_search,#text_search,#text_search,#text_search,#text_search,#text_search,#text_search,#text_search,#text_search");
		grid_2.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro");
		grid_2.setColSorting('str,str,str,int,int,int,str,int,date');
		grid_2.setInitWidths('*,*,*,*,*,*,*,*,*');
		grid_2.enableSmartRendering(true);
		grid_2.load('database/spareparts.php');	
		grid_2.attachEvent("onXLE",function(){
		w2.progressOff();
		})
		w2.bringToTop();

		
		grid_2.init();
		dhxWins.window("w2").bringToTop();
}

Move line that creates new dhtmlXWindows object ouside of event handler, so it will be called only once.

var dhxWins = new dhtmlXWindows(); menu_1.attachEvent("onClick", function(id, zoneId, cas) {

snippet.dhtmlx.com/b3c37def8

Thanks stan!