<?php
#############################################################################
#                              Site@School
# Site@School is a website management system designed for schools.
#
############################################################################
# dropdown theme
# main.inc.php: last changed 13/06/2005
#            by F.C. Stuurman (fc.stuurman@hccnet.nl)
#$Id: main.inc.php,v 1.1 2006/10/03 11:13:26 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# 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('IN_SAS') )
{
	die("Hacking attempt");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang[lang_charset]?>">
<?php
print "<title>$sitename - $pagetitle</title>";
?>
<style>
/* CoolMenus 4 - default styles - do not edit */
.clCMAbs{position:absolute; visibility:hidden; left:0; top:0}
/* CoolMenus 4 - default styles - end */
  
/*Style for the background-bar*/
.clBar{position:absolute; width:10; height:10; layer-background-color:#FF9900; visibility:hidden}

/*Styles for level 0*/
.clLevel0, .clLevel0over{position:absolute; padding:1px; font-family:tahoma,arial,helvetica; font-size:12px; font-weight:bold}
.clLevel0{background-color:#0000FF; layer-background-color:#0000FF; color:white;}
.clLevel0over{background-color:#336699; layer-background-color:#336699; color:#FF9900; cursor:pointer; cursor:hand; }
.clLevel0border{position:absolute; visibility:hidden; background-color:red; layer-background-color:red}

/*Styles for level 1*/
.clLevel1, .clLevel1over{position:absolute; padding:2px; font-family:tahoma, arial,helvetica; font-size:11px; font-weight:bold}
.clLevel1{background-color:#FF9900; layer-background-color:#FF9900; color:white;}
.clLevel1over{background-color:#006699; layer-background-color:#006699; color:Yellow; cursor:pointer; cursor:hand; }
.clLevel1border{position:absolute; visibility:hidden; background-color:#006699; layer-background-color:#006699}

/*Styles for level 2*/
.clLevel2, .clLevel2over{position:absolute; padding:2px; font-family:tahoma,arial,helvetica; font-size:10px; font-weight:bold}
.clLevel2{background-color:#FF9900; layer-background-color:Navy; color:white;}
.clLevel2over{background-color:#67FF00; layer-background-color:#67FF00; color:Yellow; cursor:pointer; cursor:hand; }
.clLevel2border{position:absolute; visibility:hidden; background-color:#006699; layer-background-color:#006699}

</style>
<script language="JavaScript1.2" src="starnet/themes/dropdown/coolmenus4.js">
/*****************************************************************************
Copyright (c) 2001 Thomas Brattli (webmaster@dhtmlcentral.com)

DHTML coolMenus - Get it at coolmenus.dhtmlcentral.com
Version 4.0_beta
This script can be used freely as long as all copyright messages are intact.

Extra info - Coolmenus reference/help - Extra links to help files **** 
CSS help: http://192.168.1.31/projects/coolmenus/reference.asp?m=37
General: http://coolmenus.dhtmlcentral.com/reference.asp?m=35
Menu properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=47
Level properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=48
Background bar properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=49
Item properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=50
******************************************************************************/
</script>
</head>
<body marginwidth="0" marginheight="0" rightmargin="0" topmargin="0" bottommargin="0" leftmargin="0" background="<?php echo $cmsdir ?>/themes/<?php echo $themelocation ?>/background.gif" style="font-family: Verdana, Arial, Helvetica; font-size: 10pt" link="#000000" vlink="#000000" alink="#466C9B">
<script>
oCMenu=new makeCM("oCMenu") //Making the menu object. Argument: menuname

//Menu properties   
oCMenu.pxBetween=10
oCMenu.fromLeft=10
oCMenu.fromTop=80  
oCMenu.rows=0 
oCMenu.menuPlacement="left"
                                                             
oCMenu.offlineRoot="file:///C|/Inetpub/wwwroot/dhtmlcentral/" 
oCMenu.onlineRoot="" 
oCMenu.resizeCheck=1 
oCMenu.wait=1000 
oCMenu.fillImg="starnet/themes/dropdown/cm_fill.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=1
oCMenu.barWidth="menu"
oCMenu.barHeight="menu" 
oCMenu.barClass="clBar"
oCMenu.barX="menu"
oCMenu.barY="menu"
oCMenu.barBorderX=0
oCMenu.barBorderY=0
oCMenu.barBorderClass=""

//Level properties - ALL properties have to be spesified in level 0
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width=135
oCMenu.level[0].height=25 
oCMenu.level[0].regClass="clLevel0"
oCMenu.level[0].overClass="clLevel0over"
oCMenu.level[0].borderX=1
oCMenu.level[0].borderY=1
oCMenu.level[0].borderClass="clLevel0border"
oCMenu.level[0].offsetX=0
oCMenu.level[0].offsetY=0
oCMenu.level[0].rows=0
oCMenu.level[0].arrow="starnet/themes/dropdown/menu_arrow.gif"
oCMenu.level[0].arrowWidth=10
oCMenu.level[0].arrowHeight=9
oCMenu.level[0].align="right"

//EXAMPLE SUB LEVEL[1] PROPERTIES - You have to specify the properties you want different from LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[1]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[1].width=oCMenu.level[0].width-2
oCMenu.level[1].height=22
oCMenu.level[1].regClass="clLevel1"
oCMenu.level[1].overClass="clLevel1over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].align="right" 
oCMenu.level[1].offsetX=0
oCMenu.level[1].offsetY=0
oCMenu.level[1].borderClass="clLevel1border"
oCMenu.level[1].align="right" 

//EXAMPLE SUB LEVEL[2] PROPERTIES - You have to spesify the properties you want different from LEVEL[1] OR LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[2]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[2].width=oCMenu.level[0].width
oCMenu.level[2].height=20
oCMenu.level[2].align="right"
oCMenu.level[2].offsetX=20
oCMenu.level[2].offsetY=0
oCMenu.level[2].regClass="clLevel2"
oCMenu.level[2].overClass="clLevel2over"
oCMenu.level[2].borderClass="clLevel2border"


<?php
$query = "SELECT id, name FROM $table_sections WHERE invisible != 'yes' ORDER BY sort";
$result = mysql_query($query);
$i = 0 ;
while ($sectionmenu = mysql_fetch_array($result))
{
	$section_item = addslashes($sectionmenu[1]) ;
	print "oCMenu.makeMenu('top$i','','$section_item');\n" ;

	$query2 = "SELECT id, category, module, invisible FROM $table_pages WHERE section = '$sectionmenu[0]' and invisible != 'yes' GROUP BY category ORDER BY sort";             // getting pagelist
	$result2 = mysql_query($query2) or die_script(mysql_error());
	$k = 0 ;
	
	if (mysql_num_rows($result2) == 1) 	//one category?
	{
		$query3 = "SELECT id, name, module, invisible FROM $table_pages WHERE section = '$sectionmenu[0]' and invisible != 'yes' ORDER BY sort";             // getting pagelist
		$result3 = mysql_query($query3) or die_script(mysql_error());
		while ($pagemenu = mysql_fetch_array($result3))
		{
		$menu_item = addslashes($pagemenu[1]) ;
		print "oCMenu.makeMenu('sub$i$k','top$i','$menu_item','index.php?section=$sectionmenu[0]&page=$pagemenu[0]');\n";
		$k++ ;
		}
	}
	else
	{
		while ($catlist = mysql_fetch_array($result2)) 
		{
		$cat_item = addslashes($catlist[1]) ;
		print "oCMenu.makeMenu('sub$i$k','top$i','$cat_item','index.php?section=$sectionmenu[0]&page=$catlist[0]');\n";
		
			$query3 = "SELECT id, name, module, invisible FROM $table_pages WHERE section = '$sectionmenu[0]' AND category = '$cat_item' and invisible != 'yes' ORDER BY sort";             // getting pagelist
			$result3 = mysql_query($query3) or die_script(mysql_error());
			$j = 0 ;
			while ($pagemenu = mysql_fetch_array($result3))
			{
			$menu_item = addslashes($pagemenu[1]) ;
			print "oCMenu.makeMenu('sub$i$k$j','sub$i$k','$menu_item','index.php?section=$sectionmenu[0]&page=$pagemenu[0]');\n";
			$j++ ;
			}
		
		$k++;
		}
	}
  
$i++;
}

?>		
//Leave this line
oCMenu.construct()			
</script>

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="45" background="<?php echo $cmsdir ?>/themes/<?php echo $themelocation ?>/banner-bg.gif">
  <tr>
    <td width="5%" align="left">
    <img border="0" src="<?php echo $cmsdir ?>/themes/$themelocation/banner-left.gif" width="1" height="45"></td>
    <td width="70%" align="center" valign="middle"><font face=verdana size=5 color=FFFFFF><b><?php echo $sitename ?></b></font><br>
    </td>
    <td align="right">
    <img border="0" src="<?php echo $cmsdir ?>/themes/<?php echo $themelocation ?>/logo.gif"></td>
    <td width="5%">&nbsp;</td>
   </tr>
</table>
<table border="0" width="100%">
  <tr>
     <td width="160">&nbsp;</td>
     <td width="55%"><font face="Verdana" size="1">&nbsp;
		<?php
		$query = "SELECT name FROM $table_sections WHERE id = $section";        // getting the section name
		$result = mysql_query($query);
		$sectionname = mysql_result($result,0);
		unset($query);
		unset($result);
		print "Location: $sectionname -> $pagetitle";

print "</font></td>
     <td align=\"right\">  
		  <font size=1>";
	if($_SESSION['site'] == "protected")
	{
	  print "<a href=\"index.php?section=$_SESSION[section_came_from]&page=$_SESSION[page_came_from]&site=public\" style=\"text-decoration:none\">".$sas_lang['public_area']."&nbsp;/</a>";
	}
	
	if(IsSet($_SESSION['userid']))
	{
	print "<a href=index.php?section=$section&page=$page&logout=yes style=\"text-decoration:none\"> $sas_lang[logout]</font></a>";
	}
?>
		  </font>
		 </td>
   </tr>
</table> 
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
<tr><td width="150">&nbsp;</td>
<td>
<table height="490" border="0" cellpadding="10" cellspacing="0" style="border-collapse:  collapse" bordercolor="#111111" width="100%">
<tr>
    <td width="10">&nbsp;</td>
    <td valign="top">

<?php
$query = "SELECT module FROM $table_pages WHERE id='$page'";
$result = mysql_query($query);
$module = mysql_result($result,0);
unset($query);
unset($result);
if($module != '')
{
 include("$cmsdir/modules/$module");
}
else
{

 $query = "SELECT content FROM $table_pages WHERE id='$page'";
 $result = mysql_query($query);
 $content = mysql_result($result,0);
 unset($query);
 unset($result);
 $content = str_replace("../","",$content);
 print "$content";
}
print "</td></tr>" ;
$query = "SELECT UNIX_TIMESTAMP(lastupdate) FROM $table_pages where id='$page'";
 $result = mysql_query($query);
 $date = mysql_result($result,0);
 unset($query);
 unset($result);

$date = strftime($sas_config['dateformat'],$date);
?>
  <tr>
    <td colspan="2" align="center"><font face="Verdana" size="1">&copy; <?php echo $sitename ?>, last changed on <?php echo $date ?></font></td>
  </tr>
</table>
</td></tr></table>
</body>
</html>