<? /* Quotenik 1.2 - Default Layout. Some Markup from CakePHP Default */?>


<!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>
	<?php echo $html->charset(); ?>
        <title>
	    <?php __('CMC'); ?>
	    <?php echo $title_for_layout; ?>
        </title>
	<? echo $html->meta('icon'); ?>
	<?php
	echo $html->css('quotenik');
	echo $html->css('jquery-ui.custom.css');


	//echo $javascript->link('ckeditor/ckeditor');

	echo $javascript->link('jquery');

	echo $javascript->link('jquery-ui');
	echo $javascript->link('jquery.form');
	//echo $javascript->link('jquery.validate.min');
	echo $javascript->link('menu');
	echo $javascript->link('global');
	echo $javascript->link('search');
	echo $javascript->link('jquery.jeditable.mini');
	//echo $javascript->link('ckeditor/adapters/jquery');

	echo $scripts_for_layout;


	?>


    </head>
    <body>
        <div id="container">

            <div id="header">
                <h3 id="logo">CMC Technologies</h3>

                <div id="username">

		    <?php
		    if(isset($currentuser) == FALSE) {
			echo $html->link('Login', '/users/login');
		    }
		    else {
			$logoutlink = $html->link('Logout', '/users/logout');
			echo "Logged in as: ". $html->link($currentuser['User']['username'], '/users/view/'. $currentuser['User']['id']). ' (' . $logoutlink.')';
		    }
		    ?>
                </div>

                <div id = "navdiv">
                    <ul id="nav">
                        <li><?php echo $html->link('Enquiries', '/enquiries/index'); ?>
			    <ul>
                                <li class="last"><?php echo $html->link('Enquiry Register', '/enquiries/index'); ?></li>
                            </ul>
                        </li>

                        <li><?php echo $html->link('Jobs', '/jobs/index'); ?>
			    <ul>

				<?
				    if($currentuser['User']['access_level'] == 'manager' || $currentuser['User']['access_level'] == 'admin' ):
				?>
				    <li><?=$html->link('Reports','/jobs/reports');?></li>
				<? endif;?>
                                <li class="last"><?php echo $html->link('Job List', '/jobs/index'); ?></li>
				
                            </ul>
                        </li>

			<li><?php echo $html->link('Shipments','/shipments/index');?>
			    <ul>
				<li class=""><?php echo $html->link('Shipments List', '/shipments/index');?></li>
			    </ul>
			</li>

                        <li><?php echo $html->link('Customers', '/customers/index'); ?>
                            <ul>
                                <li><?php echo $html->link('Customer Index', '/customers/index'); ?></li>
                                <li><?php echo $html->link('Add Customer', '/customers/add'); ?></li>
                                <li class="last"><?php echo $html->link('Industries', '/industries/index'); ?></li>
                            </ul>
                        </li>

                        <li><?php echo $html->link('POs', '/purchase_orders/index'); ?>
                            <ul>
                                <li><?php echo $html->link('PO Index', '/purchase_orders/index'); ?></li>
                                <li class="last"><?php echo $html->link('New PO', '/purchase_orders/add'); ?></li>
                            </ul>
                        </li>


                        <li><?php echo $html->link('Invoices', '/invoices/index'); ?>
                            <ul>
                                <li class="last"><?php echo $html->link('Invoices Index', '/invoices/index'); ?></li>
				<li class="last"><?php echo $html->link('Print View', '/invoices/printView'); ?></li>
                            </ul>
                        </li>

                        <li><?php echo $html->link('Products', '/products/index'); ?>
                            <ul>
                                <li><?php echo $html->link('Product Index', '/products/index'); ?></li>
                                <li class="last"><?php echo $html->link('Add Product', '/products/add'); ?></li>
                            </ul>
                        </li>


                        <li><?php echo $html->link('Principles', '/principles/index'); ?>
                            <ul>
                                <li><?php echo $html->link('Principle Index', '/principles/index'); ?></li>
                                <li class="last"><?php echo $html->link('Add Principle', '/principles/add'); ?></li>
                            </ul>
                        </li>

			<?php /*<li> echo $html->link('Users', '/users/index'); ?>
                            <ul>
                                <li> echo $html->link('Users Index', '/users/index'); </li>
                                <li class="last"><?php echo $html->link('Add User', '/users/add'); </li>
                            </ul>
                        </li>*/
			?>

                        <li><?php echo $html->link('Search', '/enquiries/search', array('id'=>'searchLink')); ?>
                        </li>
                        <li><?php echo $html->link('Help', '/pages/help'); ?>
                            <ul>
                                <li class="last"><?php echo $html->link('About', '/pages/about'); ?></li>
                            </ul>
                        </li>


                    </ul>

                </div>

            </div>
            <div id="content">
		<?php
		if ($session->check('Message.flash')):
		    $session->flash();
		endif;
		?>

		<?php echo $content_for_layout; ?>

            </div>
            <div id="footer">
		<?php echo $html->link(
		$html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
		'http://www.cakephp.org/',
		array('target'=>'_new'), null, false
		);
		?>
            </div>
        </div>


        <div id="dialogDiv">



	    <?php
	    echo $form->create('Enquiry', array('default'=>false, 'id'=>'searchForm'));
	    echo '<h2>Search';
	    echo $html->image('system-search.png');
	    echo '</h2>';
	    echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";

	    echo $form->input('Enquiry.search_string', array('label'=>false, 'id'=>'searchString'));



	    echo $form->end();

	    ?>

            <div class ="ui-widget">
                <button id="searchButton">Search</button>
            </div>


	    <div id="ajaxLoading"><?php echo $html->image('ajax-loader.gif'); ?></div>

	    <div id="results"></div>
	</div>


	<?php
	$mem_usage = memory_get_usage(true);

	if ($mem_usage < 1024)
	    echo $mem_usage." bytes";
	elseif ($mem_usage < 1048576)
	    echo round($mem_usage/1024,2)." kilobytes";
	else
	    echo round($mem_usage/1048576,2)." megabytes";
	echo "<br/>";

	?>


	<?php // debug($currentuser); ?>

	<?php echo $cakeDebug; ?>

    </body>
</html>
