Index: branches/5.2.x/core/admin_templates/head.tpl
===================================================================
--- branches/5.2.x/core/admin_templates/head.tpl	(revision 16470)
+++ branches/5.2.x/core/admin_templates/head.tpl	(revision 16471)
@@ -1,125 +1,128 @@
 <inp2:m_Set skip_last_template="1"/>
 <inp2:m_include t="incs/header" nobody="yes"/>
 
 <inp2:m_NoDebug/>
 <inp2:m_Set skip_last_template="1"/>
 
 <script type="text/javascript">
 	$popup_manager = new AjaxPopupManager('<inp2:m_Link template="index" no_amp="1" js_escape="1"/>');
 	grid_widths_cache = new Array();
 </script>
 
 <inp2:m_DefineElement name="root_node"><inp2:m_param name="section_url"/></inp2:m_DefineElement>
 
 <body style="overflow: hidden; background-color: white;">
 	<style type="text/css">
 		div.layout {
 			position: absolute;
 		}
 	</style>
 
 	<div id="site_logo">
 		<table class="head-table" style="width: 100%;" cellpadding="0" cellspacing="0">
 			<td style="height: 95px; text-align: left;">
 				<div class="layout" style="top: 0px; left: 0px; vertical-align: top;">
 					<a href="<inp2:adm_PrintSection render_as='root_node' section_name='in-portal:browse_site' html_escape='1'/>" target="main">
 						<img src="<inp2:adm_AdminSkin type='logo'/>" alt="" border="0"/>
 					</a>
 				</div>
 
 				<div class="layout" style="top: 5px; right: 8px;">
 					<inp2:m_if check="lang.enabled_IsMultiLanguage">
 						<select name="language" onchange="change_language();" style="color: white; background-color: transparent; border-width: 0px;">
 							<inp2:m_DefineElement name="lang_elem">
 								<option style="background-color: #1DAAF2;" value="<inp2:Field name="LanguageId"/>" <inp2:m_if check="SelectedLanguage">selected="selected"</inp2:m_if> ><inp2:Field name="LocalName"/></option>
 							</inp2:m_DefineElement>
 							<inp2:lang.enabled_PrintList render_as="lang_elem"/>
 						</select>
 					</inp2:m_if>
 
 					<inp2:m_if check="lang.current_Field" name="UserDocsUrl">
 						<a href="<inp2:lang.current_Field name='UserDocsUrl' js_escape='1'/>" id="help_link" target="_blank">
 							<img src="<inp2:m_TemplatesBase/>/img/top_frame/help_icon.gif" width="15" height="15" border="0"/><br />
 						</a>
 					</inp2:m_if>
 				</div>
 
 				<div class="layout" style="bottom:35px; right:8px; font-size:30px;">
 					<!--##<a href="http://www.intechnic.com" target="_new">
 						<img src="<inp2:adm_ModulePath module="core"/>img/logo_intechnic.gif" alt="" width="115" height="49" alt="Intechnic Corporation" border="0"/>
 					</a>##-->
 
 					<inp2:m_if check="adm_AdminSkin" type="DisplaySiteNameInHeader">
 						<a href="<inp2:adm_PrintSection render_as='root_node' section_name='in-portal:browse_site' html_escape='1'/>" target="main">
 							<inp2:m_GetConfig var="Site_Name"/>
 						</a>
 					</inp2:m_if>
 				</div>
 			</td>
 		</table>
 	</div>
 
 	<div style="background: url(<inp2:m_TemplatesBase/>/img/top_frame/toolbar_background.gif) repeat-x top left;">
 		<div style="<inp2:m_if check='adm_AdminSkin' type='LogoBottom'>background: url(<inp2:adm_AdminSkin type='LogoBottom'/>) no-repeat bottom left; </inp2:m_if>text-align: left;">
 			<table cellpadding="0" cellspacing="0" style="width: 100%;">
 				<tr>
 					<td style="vertical-align: bottom; height: 22px; font-size: 9px; width: <inp2:adm_MenuFrameWidth/>px;">
 						<inp2:m_if check="m_RecallEquals" name="ShowAdminMenu" value="0" persistent="1">
 							<a id="menu_toggle_link" href="#"><img src="img/list_arrow_desc.gif" id="menu_toggle_img" width="15" height="15" alt=""/><span id="menu_toggle_text"><inp2:m_Phrase name="la_ToolTip_HideMenu"/></span></a>
 						<inp2:m_else/>
 							<a id="menu_toggle_link" href="#"><img src="img/list_arrow_desc.gif" id="menu_toggle_img" width="15" height="15" alt=""/><span id="menu_toggle_text"><inp2:m_Phrase name="la_ToolTip_ShowMenu"/></span></a>
 						</inp2:m_if>
 					</td>
 					<td>
 						<div id="extra_toolbar" style="height: 22px;"></div>
 
 						<inp2:m_Include template="themes/extra_toolbar"/>
 					</td>
 					<td class="kx-block-header" align="right" nowrap valign="middle">
 						<table cellpadding="0" cellspacing="0" border="0" >
 						<tr>
 							<td class="kx-block-header" style="background-image: none;">
 								<inp2:m_phrase name="la_Logged_in_as"/> <strong><a href="javascript:change_password();" class="kx-header-link"><inp2:u.current_LoginName/></strong></a>
 								|
 								<a href="<inp2:m_t t='index' u_event='OnLogout' pass='m,u'/>" target="_parent" class="kx-header-link"><strong><inp2:m_Phrase label="la_Logout"/></strong></a>
 							</td>
 							<td>
 								<a href="<inp2:m_t t='index' u_event='OnLogout' pass='m,u'/>" target="_parent"><img src="<inp2:adm_ModulePath module='core'/>img/x.gif" alt="" width="15" height="15" /></a>
 							</td>
 						</tr>
 						</table>
 					</td>
 				</tr>
 
 			</table>
 		</div>
 	</div>
 
 <inp2:m_include t="incs/footer"/>
 
 <script type="text/javascript" src="js/frame_resizer.js"></script>
 <script type="text/javascript">
 	var $skip_refresh = true;
 
 	function change_language() {
 		// when changing language submit is made to frameset, not the current frame
 		var $kf = document.getElementById($form_name);
 		$kf.target = 'main_frame';
 
 		submit_event('lang', 'OnChangeLanguage', 'index');
 	}
 
 	function change_password() {
-		getFrame('main').set_hidden_field('u_id', <inp2:m_get name="u.current_id" no_html_escape="1" js_escape="1"/>);
+		var $user_id = Number('<inp2:m_get name="u.current_id" no_html_escape="1" js_escape="1"/>');
 
-		<inp2:m_if check="m_GetEquals" name="u.current_id" value="-1">
-			open_popup('u', '', 'users/root_edit_password');
-		<inp2:m_else/>
-			open_popup('u', '', 'users/user_edit_password');
-		</inp2:m_if>
+		if ( $modal_windows ) {
+			getFrame('main').set_hidden_field('u_id', $user_id);
+		}
+		else {
+			set_hidden_field('u_id', $user_id);
+		}
+
+		open_popup('u', '', '<inp2:m_if check="m_GetEquals" name="u.current_id" value="-1">users/root_edit_password<inp2:m_else/>users/user_edit_password</inp2:m_if>');
 	}
 
 	$FrameResizer = new FrameResizer('<inp2:m_Phrase name="la_ToolTip_ShowMenu" js_escape="1"/>', '<inp2:m_Phrase name="la_ToolTip_HideMenu" js_escape="1"/>', window.parent, '<inp2:m_Link pass="m,adm" adm_event="OnSaveSetting" var_name="#NAME#" var_value="#VALUE#" no_amp="1" js_escape="1"/>', <inp2:adm_MenuFrameWidth/>);
 	$FrameResizer.InitControls($FrameResizer);
 	$FrameResizer.SetStatus(<inp2:m_if check="m_RecallEquals" name="ShowAdminMenu" value="0" persistent="1">0<inp2:m_else/>1</inp2:m_if>);
 </script>