Index: template.php
===================================================================
--- template.php	(revision 2675)
+++ template.php	(working copy)
@@ -455,8 +455,7 @@
 					$mMN.
 					'\';}return false;';
 
-		$sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'">
-				<img'.t3lib_iconWorks::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut',1).'" alt="" /></a>';
+		$sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut',1).'" alt="" /></a>';
 		return $sIcon;
 	}
 
Index: alt_doc.php
===================================================================
--- alt_doc.php	(revision 2675)
+++ alt_doc.php	(working copy)
@@ -246,6 +246,7 @@
 		}
 	}
 
+
 	/**
 	 * Detects, if a save command has been triggered.
 	 *
@@ -256,6 +257,7 @@
 		return $out;
 	}
 
+
 	/**
 	 * Do processing of data, submitting it to TCEmain.
 	 *
@@ -286,13 +288,17 @@
 		}
 
 			// Setting internal vars:
-		if ($BE_USER->uc['neverHideAtCopy'])	{	$tce->neverHideAtCopy = 1;	}
+		if ($BE_USER->uc['neverHideAtCopy'])	{
+			$tce->neverHideAtCopy = 1;
+		}
 		$tce->debug=0;
 		$tce->disableRTE = $this->disableRTE;
 
 			// Loading TCEmain with data:
 		$tce->start($this->data,$this->cmd);
-		if (is_array($this->mirror))	{	$tce->setMirror($this->mirror);	}
+		if (is_array($this->mirror))	{
+			$tce->setMirror($this->mirror);
+		}
 
 			// If pages are being edited, we set an instruction about updating the page tree after this operation.
 		if (isset($this->data['pages']))	{
@@ -440,14 +446,15 @@
 		$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
 
 			// Create an instance of the document template object
-		$this->doc = t3lib_div::makeInstance('mediumDoc');
-		$this->doc->bodyTagMargins['x']=5;
-		$this->doc->bodyTagMargins['y']=5;
+		$this->doc = t3lib_div::makeInstance('template');
+		$this->doc->divClass = 'typo3-fullDoc';
 		$this->doc->backPath = $BACK_PATH;
 		$this->doc->docType = 'xhtml_trans';
+		$this->doc->inDocStylesArray[] = 'html { overflow: hidden; }';
 
 		$this->doc->form='<form action="'.htmlspecialchars($this->R_URI).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
 
+		$this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
 		$this->doc->JScode = $this->doc->wrapScriptTags('
 			function jumpToUrl(URL,formEl)	{	//
 				if (!TBE_EDITOR.isFormChanged())	{
@@ -457,6 +464,15 @@
 				}
 			}
 
+				// workaround since IE6 cannot deal with relative height for scrolling elements
+			function resizeDocBody()	{
+				$("typo3-docbody").style.height = (document.body.offsetHeight - parseInt($("typo3-docheader").getStyle("height")));
+			}
+			if (/MSIE 6/.test(navigator.userAgent)) {
+				Event.observe(window, "resize", resizeDocBody, false);
+				Event.observe(document, "load", resizeDocBody, false);
+			}
+
 				// Object: TS:
 			function typoSetup	()	{	//
 				this.uniqueID = "";
@@ -537,37 +553,26 @@
 			$editForm = $this->makeEditForm();
 
 			if ($editForm)	{
-				reset($this->elementsData);
-				$this->firstEl = current($this->elementsData);
+				$this->firstEl = reset($this->elementsData);
 
-					// language switch/selector for editing
-					// show only when a single record is edited - multiple records are too confusing
-				if (count($this->elementsData)==1) {
-					$languageSwitch = $this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']);
-				}
+					// Module configuration
+				$this->modTSconfig = ($this->viewId ? t3lib_BEfunc::getModTSconfig($this->viewId,'mod.xMOD_alt_doc') : array());
 
+				$this->content .= 
+					$this->tceforms->printNeededJSFunctions_top().
+					$this->compileHeader().'
+				<div id="typo3-docbody">'.
+					$this->compileForm($editForm).
+					$this->tceforms->printNeededJSFunctions().
+					$this->functionMenus().
 
-				if ($this->viewId)	{
-						// Module configuration:
-					$this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->viewId,'mod.xMOD_alt_doc');
-				} else $this->modTSconfig=array();
-
-				$panel = $this->makeButtonPanel();
-				$docSel = $this->makeDocSel();
-				$cMenu = $this->makeCmenu();
-
-				$formContent = $this->compileForm($panel,$docSel,$cMenu,$editForm,$languageSwitch);
-
-				$this->content.= $this->tceforms->printNeededJSFunctions_top().
-									$formContent.
-									$this->tceforms->printNeededJSFunctions();
-				$this->content.= $this->functionMenus();
-
 					// Add CSH:
-				$this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|',FALSE,'margin-top: 20px;');
+					t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'],'<br/>|',FALSE,'margin-top: 20px;').
+					'<br /><br />'.
+					$this->shortCutLink().
+					$this->openInNewWindowLink().'
+				</div>';
 
-				$this->content.= $this->shortCutLink();
-
 				$this->tceformMessages();
 			}
 		}
@@ -767,9 +772,7 @@
 									if ($lockInfo = t3lib_BEfunc::isRecordLocked($table,$rec['uid']))	{
 										$lockIcon = '
 
-											<!--
-											 	Warning box:
-											-->
+											<!-- Warning box: -->
 											<table border="0" cellpadding="0" cellspacing="0" class="warningbox">
 												<tr>
 													<td><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' alt="" /></td>
@@ -798,42 +801,55 @@
 		return $editForm;
 	}
 
+
 	/**
 	 * Create the panel of buttons for submitting the form or otherwise perform operations.
 	 *
 	 * @return	string		HTML code, comprised of images linked to various actions.
 	 */
 	function makeButtonPanel()	{
+		$btns = $this->getButtons();
+		unset($btns['shortcut']);
+		return implode('', $btns);
+	}
+
+
+	/**
+	 * Create the panel of buttons for submitting the form or otherwise perform operations.
+	 *
+	 * @return	array	all available buttons as an assoc. array
+	 */
+	function getButtons()	{
 		global $TCA,$LANG;
+		$buttons = array();
 
-		$panel='';
-
 			// Render SAVE type buttons:
 			// The action of each button is decided by its name attribute. (See doProcessData())
 		if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'])	{
 
 				// SAVE button:
-			$panel.= '<input type="image" class="c-inputButton" name="_savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" />';
+			$buttons['save'] = '<input type="image" class="c-inputButton" name="_savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" />';
 
 				// SAVE / VIEW button:
 			if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms')) {
-				$panel.= '<input type="image" class="c-inputButton" name="_savedokview"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedokshow.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" />';
+				$buttons['save_view'] = '<input type="image" class="c-inputButton" name="_savedokview"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedokshow.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" />';
 			}
 
 				// SAVE / NEW button:
 			if (count($this->elementsData)==1 && $this->getNewIconMode($this->firstEl['table'])) {
-				$panel.= '<input type="image" class="c-inputButton" name="_savedoknew"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedoknew.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveNewDoc',1).'" />';
+				$buttons['save_new'] = '<input type="image" class="c-inputButton" name="_savedoknew"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedoknew.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveNewDoc',1).'" />';
 			}
 
 				// SAVE / CLOSE
-			$panel.= '<input type="image" class="c-inputButton" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
+			$buttons['save_close'] = '<input type="image" class="c-inputButton" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
 		}
 
 			// CLOSE button:
-		$panel.= '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;">'.
+		$buttons['close'] = '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;">'.
 				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'.
 				'</a>';
 
+
 			// DELETE + UNDO buttons:
 		if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData)==1)	{
 			if ($this->firstEl['cmd']!='new' && t3lib_div::testInt($this->firstEl['uid']))	{
@@ -841,41 +857,39 @@
 					// Delete:
 				if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'],'disableDelete')) {
 					$aOnClick = 'return deleteRecord(\''.$this->firstEl['table'].'\',\''.$this->firstEl['uid'].'\',unescape(\''.rawurlencode($this->retUrl).'\'));';
-					$panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
+					$buttons['delete'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
 							'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->getLL('deleteItem',1).'" alt="" />'.
 							'</a>';
 				}
 
 					// Undo:
-				$undoButton = 0;
 				$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history').' AND recuid='.intval($this->firstEl['uid']), '', 'tstamp DESC', '1');
 				if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes))	{
-					$undoButton = 1;
-				}
-				if ($undoButton) {
 					$aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&revert=ALL_FIELDS&sumUp=-1&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
-					$panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
+					$buttons['undo'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
 							'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/undo.gif','width="21" height="16"').' class="c-inputButton" title="'.htmlspecialchars(sprintf($LANG->getLL('undoLastChange'),t3lib_BEfunc::calcAge(time()-$undoButtonR['tstamp'],$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))).'" alt="" />'.
 							'</a>';
 				}
 				if ($this->getNewIconMode($this->firstEl['table'],'showHistory'))	{
 					$aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
-					$panel.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
+					$buttons['history'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
 							'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' class="c-inputButton" alt="" />'.
 							'</a>';
 				}
 
 					// If only SOME fields are shown in the form, this will link the user to the FULL form:
 				if ($this->columnsOnly)	{
-					$panel.= '<a href="'.htmlspecialchars($this->R_URI.'&columnsOnly=').'">'.
+					$buttons['columns_only'] = '<a href="'.htmlspecialchars($this->R_URI.'&columnsOnly=').'">'.
 							'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' class="c-inputButton" title="'.$LANG->getLL('editWholeRecord',1).'" alt="" />'.
 							'</a>';
 				}
 			}
 		}
-		return $panel;
+		$buttons['shortcut'] = $this->shortCutLink();
+		return $buttons;
 	}
 
+
 	/**
 	 * Create the selector box form element which allows to select between open documents.
 	 * Can be disabled through Page TSconfig.
@@ -885,6 +899,7 @@
 	function makeDocSel()	{
 		global $BE_USER,$LANG;
 
+		$docSel = '';
 			// Render the selector ONLY if it has not been disabled:
 		if (!$this->modTSconfig['properties']['disableDocSelector'])	{
 
@@ -895,7 +910,6 @@
 			}
 
 				// Now, create the document selector box:
-			$docSel='';
 			if (is_array($this->docHandler))	{
 				$opt = array();
 				$opt[] = '<option value="">[ '.$LANG->getLL('openDocs',1).': ]</option>';
@@ -913,7 +927,7 @@
 					// Add CSH:
 				$docSel.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_docSelector', $GLOBALS['BACK_PATH'],'', TRUE);
 			}
-		} else $docSel='';
+		}
 		return $docSel;
 	}
 
@@ -925,6 +939,7 @@
 	 * @see template::clearCacheMenu()
 	 */
 	function makeCmenu()	{
+		$cMenu = '';
 
 			// Generate the menu if NOT disabled:
 		if (!$this->modTSconfig['properties']['disableCacheSelector'])	{
@@ -932,85 +947,89 @@
 
 				// Add CSH:
 			$cMenu.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'],'', TRUE);
-		} else $cMenu ='';
+		}
 		return $cMenu;
 	}
 
+
 	/**
-	 * Put together the various elements (buttons, selectors, form) into a table
+	 * Put together the various elements for the header
 	 *
-	 * @param	string		The button panel HTML
-	 * @param	string		Document selector HTML
-	 * @param	string		Clear-cache menu HTML
-	 * @param	string		HTML form.
-	 * @param	string		Language selector HTML for localization
 	 * @return	string		Composite HTML
 	 */
-	function compileForm($panel,$docSel,$cMenu,$editForm, $langSelector='')	{
+	function compileHeader()	{
 		global $LANG;
 
+		$btns = $this->getButtons();
+		$docSel = $this->makeDocSel();
+		$cMenu = $this->makeCmenu();
 
-		$formContent='';
-		$formContent.='
+		$content = '
+	<!-- Page header with buttons for saving & closing and path details -->
+	<div id="typo3-docheader">
+		<div id="typo3-docheader-row1">
+			<div class="buttonsleft">'.$btns['save'].$btns['save_view'].$btns['save_close'].$btns['save_new'].'</div>
+			<div class="buttonsright">'.$docSel.$cMenu.$btns['delete'].$btns['shortcut'].$btns['history'].$btns['undo'].$btns['close'].'</div>
+		</div>
+		';
 
-			<!--
-			 	Header of the editing page.
-				Contains the buttons for saving/closing, the document selector and menu selector.
-				Shows the path of the editing operation as well.
-			-->
-			<table border="0" cellpadding="0" cellspacing="1" width="470" id="typo3-altdoc-header">
-				<tr>
-					<td nowrap="nowrap" valign="top"><div class="bgColor4" style="position:fixed; padding: 5px 5px 5px 5px; border: 1px solid black;">'.$panel.'</div></td>
-					<td nowrap="nowrap" valign="top" align="right">'.$docSel.$cMenu.'</td>
-				</tr>';
-
-		if ($langSelector) {
-			$langSelector ='<div id="typo3-altdoc-lang-selector">'.$langSelector.'</div>';
-		}
-
 		if (is_array($this->tceforms->extraFormHeaders))	{
-			$formContent .= implode(chr(10), $this->tceforms->extraFormHeaders);
+			$content .= '<div id="typo3-docheader-rowextra">'.implode(chr(10), $this->tceforms->extraFormHeaders).'</div>';
 		}
 
-		$pagePath = '<div id="typo3-altdoc-page-path">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.htmlspecialchars($this->generalPathOfForm).'</div>';
 
-		$formContent.='
-				<tr>
-					<td colspan="2"><div id="typo3-altdoc-header-info-options">'.$pagePath.$langSelector.'</div></td>
-				</tr>
-			</table>
+			// language switch/selector for editing
+			// show only when a single record is edited - multiple records are too confusing
+		if (count($this->elementsData) == 1) {
+			$langSelector = '<div class="langselector">'.$this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']).'</div>';
+		}
 
+		
+		$content.='
+		<div id="typo3-docheader-row2">
+			<div class="pagepath">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.htmlspecialchars($this->generalPathOfForm).'</div>
+			<div class="infooptions">'.$langSelector.'</div>
+		</div>
+	</div>';
+		return $content;
+	}
 
 
+	/**
+	 * Put together the various elements (buttons, selectors, form) into a table
+	 *
+	 * @param	string		HTML form.
+	 * @return	string		Composite HTML
+	 */
+	function compileForm($editForm)	{
+		global $LANG;
 
-			<!--
-			 	EDITING FORM:
-			-->
+		$panel = $this->makeButtonPanel();
+		
+		$formContent = '
 
+			<!-- EDITING FORM -->
 			'.$editForm.'
 
+			<!-- Saving buttons (same as in top) -->
 
-
-			<!--
-			 	Saving buttons (same as in top)
-			-->
-
-			'.$panel.
-			'<input type="hidden" name="returnUrl" value="'.htmlspecialchars($this->retUrl).'" />
+			'.$panel.'
+			<input type="hidden" name="returnUrl" value="'.htmlspecialchars($this->retUrl).'" />
 			<input type="hidden" name="viewUrl" value="'.htmlspecialchars($this->viewUrl).'" />';
 
 		if ($this->returnNewPageId)	{
-			$formContent.='<input type="hidden" name="returnNewPageId" value="1" />';
+			$formContent .= '<input type="hidden" name="returnNewPageId" value="1" />';
 		}
-		$formContent.='<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
+		$formContent .= '<input type="hidden" name="popViewId" value="'.htmlspecialchars($this->viewId).'" />';
 		if ($this->viewId_addParams) {
-			$formContent.='<input type="hidden" name="popViewId_addParams" value="'.htmlspecialchars($this->viewId_addParams).'" />';
+			$formContent .= '<input type="hidden" name="popViewId_addParams" value="'.htmlspecialchars($this->viewId_addParams).'" />';
 		}
-		$formContent.='<input type="hidden" name="closeDoc" value="0" />';
-		$formContent.='<input type="hidden" name="doSave" value="0" />';
-		$formContent.='<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
-		$formContent.='<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
-		$formContent.='<input type="hidden" name="_scrollPosition" value="" />';
+		$formContent .= '
+			<input type="hidden" name="closeDoc" value="0" />
+			<input type="hidden" name="doSave" value="0" />
+			<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />
+			<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />
+			<input type="hidden" name="_scrollPosition" value="" />';
 
 		return $formContent;
 	}
@@ -1046,39 +1065,40 @@
 				'.$funcMenus;
 	}
 
+
 	/**
-	 * Create shortcut and open-in-window link in the bottom of the page
+	 * Create shortcut icon
 	 *
 	 * @return	string
 	 */
 	function shortCutLink()	{
 		global $BE_USER,$LANG;
 
-			// ShortCut
-		if ($this->returnUrl!='close.html')	{
-			$content.='<br /><br />';
+		if ($this->returnUrl == 'close.html' || !$BE_USER->mayMakeShortcut()) {
+			return '';
+		}
+		return $this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
+	}
 
-				// Shortcut:
-			if ($BE_USER->mayMakeShortcut())	{
-				$content.=$this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name'],1);
-			}
 
-				// Open in new window:
-			$aOnClick = 'vHWin=window.open(\''.t3lib_div::linkThisScript(array('returnUrl'=>'close.html')).'\',\''.md5($this->R_URI).'\',\''.($BE_USER->uc['edit_wideDocument']?'width=670,height=500':'width=600,height=400').',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
-			$content.='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
-					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/open_in_new_window.gif','width="19" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.openInNewWindow',1).'" alt="" />'.
-					'</a>';
+	/**
+	 * Creates open-in-window link
+	 *
+	 * @return	string
+	 */
+	function openInNewWindowLink()	{
+		global $BE_USER,$LANG;
+		if ($this->returnUrl == 'close.html') {
+			return '';
 		}
-		return '
-
-				<!--
-				 	Shortcut link:
-				-->
-				'.$content;
+		$aOnClick = 'vHWin=window.open(\''.t3lib_div::linkThisScript(array('returnUrl'=>'close.html')).'\',\''.md5($this->R_URI).'\',\''.($BE_USER->uc['edit_wideDocument']?'width=670,height=500':'width=600,height=400').',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
+		return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
+				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/open_in_new_window.gif','width="19" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.openInNewWindow',1).'" alt="" /></a>';
 	}
 
+
 	/**
-	 * Reads comment messages from TCEforms and prints them in a HTML comment in the buttom of the page.
+	 * Reads comment messages from TCEforms and prints them in a HTML comment in the bottom of the page.
 	 *
 	 * @return	void
 	 */
Index: stylesheet.css
===================================================================
--- stylesheet.css	(revision 2675)
+++ stylesheet.css	(working copy)
@@ -126,6 +126,7 @@
 	background-color: #9BA1A8;
 }
 
+body#typo3-alt-doc-php { padding: 0; margin: 0; overflow: hidden; height: 100%; }
 
 
 
@@ -143,6 +144,7 @@
 DIV.typo3-noDoc H2 { width: 740px; }
 DIV.typo3-mediumDoc { width: 470px; }
 DIV.typo3-smallDoc { width: 350px; }
+div.typo3-fullDoc { width: 100%; height: 100%; }
 
 
 
@@ -273,6 +275,8 @@
 #dragIcon { z-index: 1; position: absolute; visibility: hidden; filter: alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; white-space: nowrap; }
 
 /* TCEforms */
+table.typo3-TCEforms { width: 93%; border-collapse: collapse; }
+table.typo3-TCEforms, table.typo3-TCEforms td { margin: 0; border: 0; padding: 0; }
 TABLE.typo3-TCEforms SPAN.typo3-TCEforms-recHeader { font-weight: bold; color: #333366; }
 TABLE.typo3-TCEforms SPAN.typo3-TCEforms-newToken { font-weight: bold; color: #990000; }
 TABLE.typo3-TCEforms SPAN.typo3-TCEforms-helpText { color: #666; }
@@ -339,11 +343,26 @@
 BODY#typo3-alt-doc-nodoc-php { margin-left: 5px; }
 
 /* Record editing (alt_doc.php) */
-TABLE#typo3-altdoc-header { margin: 0px 0px 0.3em 0px; }
-DIV#typo3-altdoc-header-info-options { margin-top: 1em; display: table; width: 100%; }
-DIV#typo3-altdoc-header-info-options div { display: table-cell; }
-DIV#typo3-altdoc-header-info-options div { vertical-align: bottom; }
-DIV#typo3-altdoc-lang-selector { text-align: right; }
+div#typo3-docheader { postion: absolute; top: 0; left: 0; z-index: 5; }
+div#typo3-docheader-row1 { height: 20px; background: #cbc7c3; }
+div#typo3-docheader-row2 { background: #fcfcfc; line-height: 27px; border-bottom: 2px solid #595d66; }
+div#typo3-docheader div.buttonsleft  { margin: 0 0 0 3px; line-height: 16px; float: left; }
+div#typo3-docheader div.buttonsright { margin: 0 3px 0 0; line-height: 16px; float: right; }
+div#typo3-docheader img, div#typo3-docheader input { margin: 2px 3px; vertical-align: top; }
+div#typo3-docheader img.typo3-csh-icon { margin: 2px 15px 0 2px; }
+div#typo3-docheader select { margin: 2px 0 0; border: 0; padding: 0; height: 16px; line-height: 16px; }
+div#typo3-docheader .pagepath { margin-left: 6px; }
+div#typo3-docbody {
+	width: 98%;
+	padding: 2% 0% 2% 2%;
+	overflow: auto;
+	top: 49px;
+	bottom: 0;
+	position: absolute;
+	z-index: 2;
+}
+* html div#typo3-docbody { height: 90%; top: 49px; padding-top: 0; padding-bottom: 0; }
+* html div#typo3-docbody table.typo3-TCEforms { margin-top: 20px; }
 
 /* Login Screen
 
Index: sysext/t3skin/stylesheets/typo3-TCEforms.css
===================================================================
--- sysext/t3skin/stylesheets/typo3-TCEforms.css	(revision 2675)
+++ sysext/t3skin/stylesheets/typo3-TCEforms.css	(working copy)
@@ -2,15 +2,16 @@
  * typo3-TCEforms.css
  */
 
-table.typo3-TCEforms {
-	}
+div#typo3-docheader-row1 { background: url('../icons/gfx/alt_menu_mainitem_bg.gif') top left repeat-x; }
 
+table.typo3-TCEforms { }
+
 table.typo3-TCEforms .bgColor2,
 table.typo3-TCEforms tr.bgColor2 td {
 	background-color: #EFEFF4;
 	color: #212424;
 	padding-bottom: 5px;
-	}
+}
 
 table#typo3-altdoc-header input,
 .c-inputButton {
