Index: branches/5.2.x/maintenance.tpl
===================================================================
--- branches/5.2.x/maintenance.tpl	(nonexistent)
+++ branches/5.2.x/maintenance.tpl	(revision 14931)
@@ -0,0 +1,159 @@
+<!--##
+<NAME>Maintenance Mode</NAME>
+<DESC></DESC>
+<SECTION>Pages</SECTION>
+##-->
+
+<inp2:m_DefineElement name="add_to_head">
+	<script type="text/javascript">
+		var a_parent = window.parent,
+			to_close = new Array (),
+			$modal_windows = <inp2:m_if check="adm_UsePopups" mode="modal">true<inp2:m_else/>false</inp2:m_if>;
+
+		function getFrame($name) {
+			var $main_window = window;
+
+			// 1. cycle through popups to get main window
+			try {
+				// will be error, when other site is opened in parent window
+				var $i = 0;
+				var $opener;
+
+				do {
+					if ( $i == 10 ) {
+						break;
+					}
+
+					// get popup opener
+					$opener = $main_window.opener;
+
+					if ( !$opener ) {
+						// when no opener found, then try parent window
+						$opener = $main_window.parent;
+					}
+
+					if ( $opener ) {
+						$main_window = $opener;
+					}
+
+					$i++;
+				} while ($opener);
+			}
+			catch (err) {
+				// catch Access/Permission Denied error
+				return window;
+			}
+
+			var $frameset = $main_window.parent.frames;
+			for ($i = 0; $i < $frameset.length; $i++) {
+				if ( $frameset[$i].name == $name ) {
+					return $frameset[$i];
+				}
+			}
+
+			return $main_window.parent;
+		}
+
+		function getWindowOpener($window) {
+			// use this instead of "window.opener"
+			if ( !$modal_windows ) {
+				return $window.opener;
+			}
+
+			if ( $window.name == 'main' || $window.name == 'main_frame' ) {
+				return null;
+			}
+
+			return getFrame('main').TB.findWindow($window.name, -1);
+		}
+
+		function redirect() {
+			var $main_frame = getFrame('main');
+			a_parent = window;
+
+			try {
+				var i = 0;
+				while (i < 10) {
+					i++;
+					var $opener = $main_frame.getWindowOpener(a_parent);
+
+					if ( $opener ) {
+						to_close.push(a_parent);
+						a_parent = $opener;
+						continue;
+					}
+
+					if ( a_parent.name == 'main_frame' ) {
+						break;
+					}
+
+					if ( a_parent.parent && a_parent.parent.name != a_parent.name ) {
+						a_parent = a_parent.parent;
+						continue;
+					}
+				}
+			}
+			catch (err) {
+				// another website is opened in parent window
+				alert('Error while trying to access window opener: [' + err.message + ']');
+				i = 10;
+			}
+
+			if ( i < 10 ) {
+				setTimeout(close_windows, 100);
+			}
+		}
+
+		function window_close($close_callback) {
+			// use this instead of "window.close();"
+			if ( !$modal_windows ) {
+				if ( $.isFunction($close_callback) ) {
+					// use close callback, because iframe will be removed later in this method
+					$close_callback();
+				}
+
+				window.close();
+				return;
+			}
+
+			if ( window.name == 'main' ) {
+				return;
+			}
+
+			if ( $close_callback !== undefined ) {
+				return getFrame('main').TB.remove(null, $close_callback);
+			}
+
+			return getFrame('main').TB.remove();
+		}
+
+		function close_windows() {
+			page = '<inp2:m_Link template="login" js_escape="1" no_amp="1" index_file="admin/index.php" __NO_REWRITE__="1" m_cat_id="0" m_wid=""/>';
+			a_parent.location.href = page;
+
+			for (var c = (to_close.length - 1); c >= 0; c--) {
+				window_close(to_close[c]);
+			}
+		}
+
+		if ( window.top.frames.length > 0 ) {
+			redirect();
+		}
+	</script>
+</inp2:m_DefineElement>
+
+<!--## DEFINE MAIN CONTENT ELEMENT ##-->
+<inp2:m_DefineElement name="content">
+
+	<inp2:m_RenderElement design="content_box">
+		<inp2:m_Capture to_var="header">
+			<inp2:st_PageInfo type="title"/>
+		</inp2:m_Capture>
+
+		<inp2:m_GetConfig name="MaintenanceMessageFront"/>
+	</inp2:m_RenderElement>
+
+</inp2:m_DefineElement>
+<!--## /DEFINE MAIN CONTENT ELEMENT ##-->
+
+<inp2:m_include template="designs/default_design.des" page_class="inner"/>
Index: branches/5.2.x/_install/english.lang
===================================================================
--- branches/5.2.x/_install/english.lang	(revision 14930)
+++ branches/5.2.x/_install/english.lang	(revision 14931)
@@ -1,23 +1,24 @@
 <LANGUAGES>
 	<LANGUAGE PackName="English" Encoding="base64"><DATEFORMAT>m/d/Y</DATEFORMAT><TIMEFORMAT>g:i A</TIMEFORMAT><INPUTDATEFORMAT>m/d/Y</INPUTDATEFORMAT><INPUTTIMEFORMAT>g:i:s A</INPUTTIMEFORMAT><DECIMAL>.</DECIMAL><THOUSANDS>,</THOUSANDS><CHARSET>utf-8</CHARSET><UNITSYSTEM>2</UNITSYSTEM>
 		<PHRASES>
 			<PHRASE Label="lu_AProblemInForm" Module="Core" Type="0">T25lIG9yIG1vcmUgZmllbGRzIG9uIHRoaXMgZm9ybSBoYXMgYW4gZXJyb3IuPGJyLz4NClBsZWFzZSByZXZpZXcgdGhlIGZpZWxkcyBtYXJrZWQgd2l0aCByZWQgY2FyZWZ1bGx5IGFuZCBzdWJtaXQgdGhlIGZvcm0gYWdhaW4u</PHRASE>
 			<PHRASE Label="lu_btn_Reset" Module="Core" Type="0">UmVzZXQ=</PHRASE>
 			<PHRASE Label="lu_btn_Send" Module="Core" Type="0">U2VuZA==</PHRASE>
 			<PHRASE Label="lu_fld_Captcha" Module="Core" Type="0">Q2FwdGNoYSBJbWFnZQ==</PHRASE>
 			<PHRASE Label="lu_fld_Company" Module="Core" Type="0">Q29tcGFueQ==</PHRASE>
 			<PHRASE Label="lu_fld_Email" Module="Core" Type="0">RS1tYWls</PHRASE>
 			<PHRASE Label="lu_fld_File" Module="Core" Type="0">RmlsZQ==</PHRASE>
 			<PHRASE Label="lu_fld_Message" Module="Core" Type="0">TWVzc2FnZQ==</PHRASE>
 			<PHRASE Label="lu_fld_Name" Module="Core" Type="0">TmFtZQ==</PHRASE>
 			<PHRASE Label="lu_fld_Phone" Module="Core" Type="0">UGhvbmU=</PHRASE>
 			<PHRASE Label="lu_fld_Subject" Module="Core" Type="0">U3ViamVjdA==</PHRASE>
 			<PHRASE Label="lu_rootcategory_name" Module="Core" Type="0">SG9tZQ==</PHRASE>
 			<PHRASE Label="lu_text_PromoHeader1" Module="Core" Type="0">TGFuZ3VhZ2Ugc2VsZWN0aW9uOg==</PHRASE>
 			<PHRASE Label="lu_text_PromoHeader2" Module="Core" Type="0">JnF1b3Q7SW4tUG9ydGFsIC0gU2V0dGluZyBFeGNlbGxlbmNlPGJyLz4NCmluIENvbnRlbnQgTWFuYWdlbWVudCZxdW90Ow==</PHRASE>
 			<PHRASE Label="lu_text_Thankyou" Module="Core" Type="0">VGhhbmsgeW91IGZvciBjb250YWN0aW5nIHdpdGggdXMh</PHRASE>
 			<PHRASE Label="lu_title_Address" Module="Core" Type="0">QWRkcmVzcw==</PHRASE>
+			<PHRASE Label="lu_title_MaintenanceMode" Module="Core" Type="0">TWFpbnRlbmFuY2UgTW9kZQ==</PHRASE>
 			<PHRASE Label="lu_title_RequestInformation" Module="Core" Type="0">SW5mb3JtYXRpb24gUmVxdWVzdCBGb3Jt</PHRASE>
 		</PHRASES>
 	</LANGUAGE>
 </LANGUAGES>
\ No newline at end of file
Index: branches/5.2.x/designs/default_design.des.tpl
===================================================================
--- branches/5.2.x/designs/default_design.des.tpl	(revision 14930)
+++ branches/5.2.x/designs/default_design.des.tpl	(revision 14931)
@@ -1,49 +1,52 @@
 <inp2:m_CheckSSL/><inp2:m_DefaultParam page_class=""/>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<inp2:lang.current_Field name="Locale" db="1"/>" lang="<inp2:lang.current_Field name="Locale" db="1"/>">
 	<head>
 		<title>
 			<inp2:st_PageInfo type="title"/> (<inp2:m_GetConfig name="Site_Name"/>)
 		</title>
 		<inp2:m_Include template="elements/html_head.elm" />
+
+		<inp2:m_DefineElement name="default_add_to_head"></inp2:m_DefineElement>
+		<inp2:m_RenderElement name="add_to_head" default_element="default_add_to_head"/>
 	</head>
 
 	<body>
 		<inp2:m_Include template="elements/content_boxes.elm" strip_nl="1"/> <!--## includes system elements ##-->
 
 		<inp2:st_EditPage mode="start"/><!--## System tag please do not remove ##-->
 
 			<div id="wrapper" class="<inp2:m_Param name='page_class'/>">
 
 				<!-- Basic Header -->
 				<inp2:m_Include template="elements/header.elm" />
 				<!-- /Basic Header -->
 
 				<!-- Navigation -->
 				<inp2:m_Include template="elements/navigation_menu.elm" />
 				<!-- /Navigation -->
 
 				<div id="content">
 
 					<inp2:m_RenderElement name="content"/>
 
 					<!--## defined in each data template or default one used ##-->
 					<inp2:m_RenderElement name="sidebar" default_element="default_sidebar" />
 
 					<div class="clear"></div>
 
 				</div><!-- #content -->
 
 			</div><!-- #wrapper -->
 
 			<!-- Footer -->
 			<inp2:m_Include template="elements/footer.elm" />
 			<!-- //Footer -->
 
 		<inp2:st_EditPage mode="end"/> <!--## /System tag please do not remove ##-->
 
 		<inp2:m_Include template="elements/tracking.elm" />
 	</body>
 </html>
\ No newline at end of file