<?php
 defined('VSIGN') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");

$username 	= Kit::GetParam('username', _SESSION, _USERNAME);
$p 			= Kit::GetParam('p', _REQUEST, _WORD);
$q 			= Kit::GetParam('q', _REQUEST, _WORD);

$thisPage 	= Kit::GetParam('session', _SESSION, _WORD);
$userid		= Kit::GetParam('userid', _SESSION, _INT, 0);
$homepage 	= $user->homePage;

$help 		= new HelpManager($db, $user);
$helpLink 	= $help->Link();

$datemanager	= new DateManager($db);
 
?>
<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>VSign Digital Signage</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="shortcut icon" href="img/favicon.ico" />

		<style type='text/css'>
		    #mask{ 
		        position:absolute; /* important */
		        top:0px; /* start from top */
		        left:0px; /* start from left */
		        height:100%; /* cover the whole page */
		        width:100%;  /* cover the whole page */
		        display:none; /* don't show it '*/          
		        
		        /* styling bellow */
		        background-color: black; 
		    }
		    
		    .modal_window{
		        position:absolute; /* important so we can position it on center later */
		        display:none; /* don't show it */
		        
		        /* styling bellow */
		        color:white;
		    }
		    
		    /* style a specific modal window  */
		    #modal_window{
		        padding:50px;
		        border:1px solid gray;
		        background: #246493;
		        color:black;
		    }

		    #peekview{
				position: absolute;
				left: 0;
				width: 100%;
				z-index: 10000;
				text-align: center;
				line-height: 0;
				font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
				font-weight: normal;
		    }

		    #peekmask{ 
				position: absolute;
				top: 0;
				left: 0;
				z-index: 9999;
				background-color: black;
				filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85);
				opacity: 0.85;
				display: none;
		    }

		</style>

		<!-- Javascript Libraries -->
		<script type="text/javascript" src="3rdparty/jQuery/jquery.min.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery-ui.min.js"></script>
                <link rel="stylesheet" type="text/css" href="3rdparty/jQuery/css/jquery-ui.css" />

		<script type="text/javascript" src="3rdparty/jQuery/jquery.form.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.validate.min.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.tablesorter.pack.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.tablesorter.pager.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.ifixpng.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.contextmenu.r2.packed.js"></script>
		<script type="text/javascript" src="3rdparty/jQuery/jquery.corner.js"></script>

		<!-- Lightbox for peekview -->
		<script type="text/javascript" src="3rdparty/lightbox/lightbox.js"></script>
		<link rel="stylesheet" type="text/css" href="template/css/lightbox.css" />

		<!-- Our own -->
		<link rel="stylesheet" type="text/css" href="template/css/presentation.css" />
                <!--[if gte IE 8]>
                <link rel="stylesheet" type="text/css" href="template/css/ie8.css" />
                <![endif]-->
		<script type="text/javascript" src="lib/js/functions.js"></script>
		<script type="text/javascript" src="lib/js/ping.js"></script>
		<script type="text/javascript" src="lib/js/core.js"></script>
        <?php
		if ($p != '') 
		{
                    echo '<script type="text/javascript" src="lib/js/' . $p . '.js"></script>';
			
			if ($p == 'layout' || $p == 'mediamanager' || $p == 'index')
			{
				?>
					<script type="text/javascript" src="lib/js/text-render.js"></script>
                                        <script type="text/javascript" src="3rdparty/ckeditor/ckeditor.js"></script>
                                        <script type="text/javascript" src="3rdparty/ckeditor/adapters/jquery.js"></script>
                                        <link rel="stylesheet" type="text/css" href="template/css/timeline.css" />
				<?php
			}
		}

        if (file_exists('stylesheet.css'))
        {
            // Include the custom style sheet
            echo '<link rel="stylesheet" type="text/css" href="stylesheet.css" />';
        }
        ?>
	</head>
<?php

	$body = '<body>';
	
	if ($q != '') $body = '<body ' . $this->thePage->on_page_load() . '>';

	echo $body;
?>
    
	<div id="container">
		<div id="headercontainer">
	  		<div id="header"></div>
			<div id="headerback">
				<ul>
				<li><div class="dashiconsheaders">
					<a href="index.php?q=logout">
					<img class="dash_button" src="img/logout.jpg"/title="<?php echo __('Logout user'); ?>">
					<span class="dash_text">Logout</span></a>
				</div></li>
				<li><div class="dashiconsheaders">
					<a id="VsignClock" class="VsignFormButton" href="index.php?p=clock&q=ShowTimeInfo" title="<?php echo __('Click to show more time information'); ?>">
					<img class="dash_button" src="img/time.jpg"/>
					<?php echo $datemanager->GetClock(); ?></a>
				</div>
				</li>
				<li><div class="dashiconsheaders">
					<a class="VsignFormButton" href="index.php?p=user&q=ChangePasswordForm" title="<?php echo __('Change Password') ?>">
					<img class="dash_button" src="img/user.jpg"/>
					<?php echo $username; ?></a>
				</div>
				</li>
				</ul>	
			</div>
		</div>
		<div id="navigation">
			<ul id="nav">
				<?php
					// Always have access to your own homepage
					echo '<li><a href="index.php?p=' . $homepage . '">' . __('Dashboard') . '</a></li>';
				
					// Put a menu here
					if (!$menu = new MenuManager($db, $user, 'Top Nav')) trigger_error($menu->message, E_USER_ERROR);
					
					while ($menuItem = $menu->GetNextMenuItem())
					{
						$uri 	= Kit::ValidateParam($menuItem['name'], _WORD);
						$args 	= Kit::ValidateParam($menuItem['Args'], _STRING);
						$class 	= Kit::ValidateParam($menuItem['Class'], _WORD);
						$title 	= Kit::ValidateParam($menuItem['Text'], _STRING);
						$title 	= __($title);
						
                        $href = 'index.php?p=' . $uri . '&' . $args;

                        echo '<li class="' . $class . '"><a href="' . $href . '" class="' . $class . '">' . $title . '</a></li>';
					}
				?>
			</ul>
		</div>
		<div id="contentwrap">
			<div id="content">

<!--The remaining content follows here in the page that included this template file. The footer.php file then closes off any block elements that remain open-->