<?php
// ------------------------------------------------------------------------- //
//                XOOPS - PHP Content Management System                      //
//                       <http://www.xoops.org/>                             //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
if ( !defined("XOOPS_CPFUNCTIONS_INCLUDED") ) {
	define("XOOPS_CPFUNCTIONS_INCLUDED",1);

	function xoops_cp_header(){
		global $xoopsConfig, $xoopsUser;
		xoops_header(false);
		include_once(XOOPS_ROOT_PATH."/modules/system/cache/adminmenu.php");
		$admin_mids = XoopsModule::getByRight($xoopsUser->groups(), "A");
		$abscissa_step = 140;	// step for the left boundaries of layers
		$abscissa_offset = 15;	// to choose the horizontal coordinate start offset for the layers
		$abscissa_stepx5 = $abscissa_step*5;
		$rightarrow = " &middot;&middot;&middot;&gt;";
		// the following is to support browsers not detecting the mouse position
		$ordinata_step = 15;	// estimated value of the number of pixels between links on a layer
		$ordinata[1] = 150-$ordinata_step;// to choose the vertical coordinate start offset for the layers
?>

<script language='JavaScript'>
<!--
var thresholdY = 15; // in pixels; threshold for vertical repositioning of a layer
var ordinata_margin = 20; // to start the layer a bit above the mouse vertical coordinate
// -->
</script>

<script language='JavaScript' src='<?php echo XOOPS_URL."/layersmenu.js";?>'></script>

<script language='JavaScript'>
<!--
<?php
		echo $xoops_admin_menu_js;
?>
function moveLayers() {
<?php
		foreach ( $admin_mids as $adm ) {
			echo $xoops_admin_menu_ml[$adm];
		}
?>
}
function shutdown() {
<?php
		foreach ( $admin_mids as $adm ) {
			echo $xoops_admin_menu_sd[$adm];
		}
?>
}
if (NS4) {
document.onmousedown = function() { shutdown(); }
} else {
document.onclick = function() { shutdown(); } 
}
// -->
</script>

<?php
		$logo = file_exists(XOOPS_URL."/themes/".getTheme()."/images/logo.gif") ? XOOPS_URL."/themes/".getTheme()."/images/logo.gif" : XOOPS_URL."/images/logo.gif";
		echo "</head>
		<body topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>
		<table border='0' width='100%' cellspacing='0' cellpadding='0'><tr><td><a href='http://www.xoops.org/' target='_blank'><img src='".$logo."' alt='".$xoopsConfig['sitename']."' /></a></td><td align='right'></td></tr><tr class='bg3'><td>&nbsp;<a href='".XOOPS_URL."/admin.php'>"._CPHOME."</a></td><td align='right'><a href='".XOOPS_URL."/'>"._YOURHOME."</a> &nbsp;|&nbsp; <a href='' target='_blank'>"._MANUAL."</a>&nbsp;&nbsp;</td></tr></table>

		<table border='0' cellpadding='0' cellspacing='5' width='100%'><tr><td width='110' valign='top'>
		<table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'><table width='100%' border='0' cellpadding='4' cellspacing='1'>
		";
		foreach ( $admin_mids as $adm ) {
			if ( !empty($xoops_admin_menu_ft[$adm]) ) {
				echo "<tr><td class='bg3' align='center'>".$xoops_admin_menu_ft[$adm]."</td></tr>";
			}
		}
		echo "</table></td></tr></table>
		<br /></td><td valign='top' width='100%'>\n";
	}

	function xoops_cp_footer(){
		echo"</td></tr><tr><td align='center' colspan='2'>Powered by&nbsp;".XOOPS_VERSION." &copy; 2002 <a href='http://www.xoops.org/' target='_blank'>The XOOPS Project</a><br /></td></tr></table>";
		include(XOOPS_ROOT_PATH."/modules/system/cache/adminmenu.php");
		echo $xoops_admin_menu_dv;
		echo "</body></html>";
	}

	// We need these because theme files will not be included
	function OpenTable() {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0'><tr class='bg2'><td valign='top'>\n";
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg3'><td valign='top'>\n";
	}

	function CloseTable() {
		echo "</td></tr></table></td></tr></table>\n";
	}

}
?>