<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
  require_once "/home/bbd/public_html/cmsAdmin/lib/viewer_functions.php";

  list($categoryRecordsMenu) = getCategories(array(
    'tableName'           => 'category',
    'categoryFormat'      => 'showall',  // showall, onelevel, twolevel
  ));


  list($categoriesRecords, $selectedCategory) = getCategories(array( 
    'tableName' => 'category', 
    'categoryFormat' => 'showall', // showall, onelevel, twolevel 
  )); 
   
  // show error message if no matching record is found 
  if (!$selectedCategory) { 
    header("HTTP/1.0 404 Not Found"); 
    print "Record not found!"; 
    exit; 
  } 


  list($categoryRecords, $categoryMetaData) = getRecords(array(
    'tableName'   => 'category',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $categoryRecord = @$categoryRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$categoryRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
?>

<?php 
  $categoriesRecordsByNum = array_combine(array_pluck($categoriesRecords, "num"), $categoriesRecords); 
   
  $lineage = explode("\t", trim(preg_replace("/:/", "\t", $selectedCategory['lineage']))); 
   
  $immediateParent = sizeof($lineage) < 2 ? 0 : $lineage[sizeof($lineage)-2]; 
  $immediateParent = $immediateParent ? $categoriesRecordsByNum[$immediateParent] : null; 
   
  $parents = array(); 
  foreach ($lineage as $parentCatNum) { 
    $parents[] = $categoriesRecordsByNum[$parentCatNum]; 
  } 
   
  $siblingLineage = preg_replace("/:\d+:$/", ":", $selectedCategory['lineage']); 
  $siblings = array(); 
  foreach ($categoriesRecords as $category) { 
    if (preg_match("/^$siblingLineage\d+:$/", $category['lineage'])) { 
      $siblings[] = $category; 
    } 
  } 
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<html>
<head>
<title><?php echo $categoryRecord['seo_title'] ?>: Tutor Myself - Math &amp; Chemistry</title>
<meta name="description" CONTENT="<?php echo $categoryRecord['seo_description'] ?>">
<meta name="keywords" content="<?php echo $categoryRecord['seo_keywords'] ?>, math, mathematics, chem, chemistry, homework, tutor, tutors, tutoring, formulas, graphs, whole number concepts, money, time, measurement, graphs, patterns, geometry, fractions, decimals, rate, ratios, proportions, probability and statistics, integers, real numbers, rational numbers, algerbra,  algebraic expressions, ti-83/84 calculator functions, functions and equations, quadrartic relations, conics, trigonometry, sequences &amp; series, personal finance, vectors, calculus, mole, moles, thermodynamics, electrochemistry, equilibrium, acid base systems, organic compounds, organic reactions, stoichiometry, solutions, gases, matter, bonding" />
<link rel='StyleSheet' type='text/css' href='styles.css'>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<!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" lang="en" xml:lang="en">

<link rel="stylesheet" type="text/css" href="ddsmoothmenu.css" />
<link rel="stylesheet" type="text/css" href="ddsmoothmenu-v.css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
	mainmenuid: "smoothmenu2", //Menu DIV id
	orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
	//customtheme: ["#804000", "#482400"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>

<script type="text/javascript" src="scripts/tabs.js"></script>


</head>

<body bgcolor="#ffffff" onload="init()">
<a name="top"></a>
<div align="center">

<!-- START HEADER -->

<table border="0" cellspacing="0" cellpadding="0" style="margin:0px; background:#191919; width:982px; margin-bottom:1px;">
<tr>
	<td rowspan="2" valign="top"><img src="images/enviro/tutor_myself.gif" alt="" width="506" height="120" border="0"></td>
	<td valign="top"><img src="images/enviro/free_mathematics_and_Chemistry.gif" alt="" width="476" height="45" border="0"></td>
</td>
</tr>
<tr>
	<td valign="top"><div style="margin:0px 0px 0px 10px;">
<script type="text/javascript"><!--
google_ad_client = "pub-3076189579304122";
/* 468x60, created 2/15/09 */
google_ad_slot = "1245350786";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

	</td>
</tr>
</table>


<table align="center" width="982" border="0" cellspacing="0" cellpadding="0" style="margin:0px; width:982px;">
<tr>
	<td>


<div style="margin:0px auto;" id="smoothmenu1" class="ddsmoothmenu">
  <ul>
  <?php foreach ($categoryRecordsMenu as $categoryRecordMenu): ?>
    <?php echo $categoryRecordMenu['_listItemStart'] ?><a href="<?php echo $categoryRecordMenu['_link'] ?>"><?php echo $categoryRecordMenu['name'] ?></a><?php echo $categoryRecordMenu['_listItemEnd'] ?>
  <?php endforeach; ?>
  </ul>
<br style="clear: left" />
</div>



 
 </td>
</tr>
</table>
 

<table width="982" border="0" cellspacing="0" cellpadding="0" style="margin:0px; width:982px;">
<tr>
	<td colspan="5">
	
<div style="font-size:11px;margin:10px;" id="breadcrumb">

    <?php if ($selectedCategory['num'] != 1): ?> 
<a href="?Home-1">Home</a> 
      <?php foreach($parents as $parent): ?>  
&raquo;  <a href="<?php echo $parent['_link'] ?>"><?php echo $parent['name'] ?></a>  
      <?php endforeach ?><br /> 
    <?php endif ?>
</div>
	
<!-- Breadcrumb: <?php echo $categoryRecord['breadcrumb'] ?>
 -->
	
	
	</td>
</tr>


<tr>

	<td valign="top" style="margin:0px; width:210px;">
	
<div class="contentwrap">	
<div class="content">


<h4><?php if ($immediateParent): ?><a href="<?php echo $immediateParent['_link'] ?>"><?php echo $immediateParent['name'] ?></a><?php else: ?>None<?php endif ?></h4>
<p style="font-size:13px; margin-bottom:0px;"><b>Related Units:</b></p>

<ul style="font-size:11px; padding-left:10px; margin-top:5px;">
     
    <?php foreach($siblings as $sibling): ?>  
      <?php $isSelected = ($sibling['num'] == $selectedCategory['num']) ?>  
      <li> 
        <?php if ($isSelected): ?><b><?php endif ?> 
        <a href="<?php echo $sibling['_link'] ?>"><?php echo $sibling['name'] ?></a> 
        <?php if ($isSelected): ?></b><?php endif ?> 
      </li>  
    <?php endforeach ?></ul>

<hr>

<h4>QUICK SEARCH</h4>

<form method="POST" action="list.php"> 
  <input type="text" name="title_keyword" value=""> 
  <input type="submit" name="submit" value="Search"> 
</form>


</div><!-- END CONTENT -->
</div><!-- END CONTENT WRAP -->	
	
	</td>
	
	<td style="width:10px;"><img src="images/enviro/pixel.gif" alt="" width="10" height="1" border="0"></td>
	
	<td valign="top" style="margin:0px; width:542px;">
	
<div class="contentwrap">	
<div class="content">


  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <h1><?php echo $categoryRecord['name'] ?></h1>
	
    <?php if (!$categoryRecord): ?>
      No record found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->

  
<p style="font-size: 13px; margin-bottom: 0px;"><b>Inside this Section:</b></p>


     
<?php 
  $immediateChildren = array();  
  foreach ($categoriesRecords as $category) {  
    if (preg_match("/^" . $selectedCategory['lineage'] . "\d+:$/", $category['lineage'])) {  
      $immediateChildren[] = $category;  
    }  
  }  
?> 
    <ul style="font-size: 11px; padding-left: 10px; margin-top: 5px;">
    <?php foreach($immediateChildren as $immediateChild): ?>  
      <li><a href="<?php echo $immediateChild['_link'] ?>"><?php echo $immediateChild['name'] ?></a></li>  
    <?php endforeach ?></ul>
  
  
  
  

    <ul id="tabs">
		<?php if ($categoryRecord['question']): ?><li><a href="#question">Question</a></li><?php endif ?>
		<li style="display:none;"><a href="#clear">Clear</a></li>
		<?php if ($categoryRecord['answer']): ?><li><a href="#answer">Answer</a></li><?php endif ?>
		<?php if ($categoryRecord['solution']): ?><li><a href="#solution">Solution</a></li><?php endif ?>
		<?php if ($categoryRecord['video_solution']): ?><li><a href="#videosolution">Video Solution</a></li><?php endif ?>
		<?php if ($categoryRecord['explanation']): ?><li><a href="#explanation">Explanation</a></li><?php endif ?>
		<?php if ($categoryRecord['models']): ?><li><a href="#models">Models</a></li><?php endif ?>
		<?php if ($categoryRecord['video_models']): ?><li><a href="#videomodels">Video Models</a></li><?php endif ?>
    </ul>
		



<?php if ($categoryRecord['content']): ?><?php echo $categoryRecord['content'] ?><?php endif ?><br/>	
	
	
<!-- START QUESTION -->

    <?php if ($categoryRecord['question']): ?>
	<div class="tabContent" id="question">
      <h2>Question</h2>
 
      <?php echo $categoryRecord['question'] ?><br/>

    </div>
	<?php endif ?>

<!-- END QUESTION -->
<!-- START CLEAR -->

    <div class="tabContent" id="clear">
      <h2></h2>
       
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
		
    </div>

<!-- END CLEAR -->
<!-- START ANSWER -->

    <?php if ($categoryRecord['answer']): ?>
	<div class="tabContent" id="answer">
      <h2>Answer</h2>
 
      <?php echo $categoryRecord['answer'] ?><br/>

    </div>
	<?php endif ?>

<!-- END ANSWER -->
<!-- START SOLUTION -->	
	
	<?php if ($categoryRecord['solution']): ?>
    <div class="tabContent" id="solution">
      <h2>Solution</h2>

      <?php echo $categoryRecord['solution'] ?><br/>

    </div>
	<?php endif ?>
	
<!-- END SOLUTION -->
<!-- START VIDEO SOLUTION -->	
	
	<?php if ($categoryRecord['video_solution']): ?>
    <div class="tabContent" id="videosolution">
      <h2>Video Solution</h2>

      <?php echo $categoryRecord['video_solution'] ?><br/>

    </div>
	<?php endif ?>	
<!-- END VIDEO SOLUTION -->
<!-- START EXPLANATION -->	
	
	<?php if ($categoryRecord['explanation']): ?>
    <div class="tabContent" id="explanation">
      <h2>Explanation</h2>

      <?php echo $categoryRecord['explanation'] ?><br/>
      
    </div>
	<?php endif ?>
<!-- END EXPLANATION -->
<!-- START MODELS -->	
	
	<?php if ($categoryRecord['models']): ?>
    <div class="tabContent" id="models">
      <h2>Models</h2>

      <?php echo $categoryRecord['models'] ?><br/>
      
    </div>
	<?php endif ?>	
<!-- END MODELS -->
<!-- START VIDEO MODELS -->	
	
	<?php if ($categoryRecord['video_models']): ?>
    <div class="tabContent" id="videomodels">
      <h2>Video Models</h2>

      <?php echo $categoryRecord['video_models'] ?><br/>
      
    </div>
	<?php endif ?>
<!-- END VIDEO MODELS -->
	
<br><br><br><br><br>







</div><!-- END CONTENT -->
</div><!-- END CONTENT WRAP -->
	
	</td>
	
	<td style="width:10px;"><img src="images/enviro/pixel.gif" alt="" width="10" height="1" border="0"></td>
	
	<td valign="top" style="margin:0px; width:210px;">
	
<div class="contentwrap">	
<div class="content">

<div align="center"><img style="margin-top:10px;" title="skyscrapper_ad.gif" src="http://www.tutormyself.com/images/skyscrapper_ad.gif" alt="skyscrapper_ad.gif" width="160" height="600" />
</div>
</div><!-- END CONTENT -->
</div><!-- END CONTENT WRAP -->	
	

	
	</td>

</tr>
</table>



<!-- END MAIN BODY -->

<!-- BEGIN FOOTER -->

<div class="smalltext" align="center" style="width:982px; background-color:#fff;">

<img src="images/footer_bar.gif" width="772" height="4" alt="line" style="margin-bottom:5px;" />
<br>
<A HREF="#top"><img src="images/top.gif" alt="Top of Page" width="14" height="8" border="0" align="right" style="margin:10px 10px 5px 0px;"></A>

<A HREF="index.php">Home</A> | 
<A HREF="#">Mathematics </A> |
<A HREF="#">Chemistry</A> | 
<A HREF="#">Math Glossary</A> |
<A HREF="#">Chem Glossary</A> |
<A HREF="#">About Us</A> |
<A HREF="#">Contact Us</A>

<br />

<div style="color:#444444; margin-top:5px;">&copy; <script language="JavaScript" type="text/javascript">
var today = new Date()
var year = today.getYear()
if (year < 1900)
{
year = year + 1900;
}
document.write(year)
</script> TUTOR MYSELF. All rights reserved.<br />Web Design by: <a href="http://www.high-country.ca/" title="Okotoks Alberta Web Design - High Country Web Design" alt="Okotoks Alberta Web Design - High Country Web Design" target="_blank">High-Country Web Design Okotoks Alberta.</a>
</div>


</div>

<br />

	</td>
</tr>
</table>
</div>

<!-- END FOOTER -->

</body>
</html>