<h1>
	<a href='resources.php' title='Resources'>Resources</a>
</h1>
<p class='random_verse'>
<?php
echo "\"{$this->data['verse']->text}\" <span>{$this->data['verse']->ref}</span>";
?>
</p>
<ul class='page_toc'>
	<li><a href="#articles">articles</a></li>
	<li><a href="#booksandotherinformation">books &amp; other info</a></li>
	<li><a href="#onleadership">on leadership</a></li>
	<li><a href="#teachingoutlines">teaching outlines</a></li>
	<li><a href="#toolsforministrylocalchurch">tools for ministry: local church</a></li>
	<li><a href="#toolsforpersonal">tools for personal</a></li>
	<li class='last'><a href="#links">links</a></li>
</ul>

<h2><a name='articles'>Articles</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<ul>
<?php foreach($this->data['xml']['articles']->article as $article): ?>
	<li><a href='javascript:PopUp("/site/data/resources/articles/<?php echo $article->link ?>")'><?php echo $article->title ?></a></li>
<?php endforeach; ?>
</ul>

<h2><a name='booksandotherinformation'>Books and Other Information</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<?php foreach($this->data['xml']['books']->category as $category): ?>
<h3><?php echo $category->name ?></h3>
<ul>	
	<?php foreach($category->file as $file): ?>
	<li><a href='javascript:PopUp("/site/data/resources/books/<?php echo $file ?>")'><?php echo str_replace('.htm','',$file) ?></a></li>
	<?php endforeach; ?>
</ul>
<?php endforeach; ?>

<h2><a name='onleadership'>On Leadership</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<ul>
<?php foreach($this->data['xml']['onleadership']->file as $file): ?>
	<li><a href='javascript:PopUp("/site/data/resources/onleadership/<?php echo $file ?>")'><?php echo str_replace('.htm','',$file) ?></a></li>
<?php endforeach; ?>
</ul>

<h2><a name='teachingoutlines'>Teaching Outlines</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<ul>
<?php foreach($this->data['xml']['teachingoutlines']->file as $file): ?>
	<li><a href='javascript:PopUp("/site/data/resources/teachingoutlines/<?php echo $file ?>")'><?php echo str_replace('.htm','',$file) ?></a></li>
<?php endforeach; ?>
</ul>

<h2><a name='toolsforministrylocalchurch'>Tools for Ministry: Local Church</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<?php foreach($this->data['xml']['toolsforministry']->category as $category): ?>
<?php
	if((int)$category->subcategoryof != 0) continue;
	print_cat($category);
?>
<?php endforeach; ?>

<h2><a name='toolsforpersonal'>Tools for Personal</a></h2>
<p>Click on each link to open a window with the subject material in it.</p>
<?php foreach($this->data['xml']['toolsforpersonal']->category as $category): ?>
<?php
	if((int)$category->subcategoryof != 0) continue;
	print_cat($category);
?>
<?php endforeach; ?>

<h2><a name='links'>Links</a></h2>
<?php foreach($this->data['xml']['links']->internal->page as $page): ?>
<h3><a href='<?php echo $page->href ?>'><?php echo $page->name ?></a></h3>
<ul>
	<?php foreach($page->link as $link): ?>
	<li><a href='<?php echo $link->href ?>' title='<?php echo $link->name ?>'><?php echo $link->name ?></a></li>
	<?php endforeach; ?>
</ul>
<?php endforeach; ?>
<h3>E-mail Addresses</h3>
<ul>
	<?php foreach($this->data['xml']['links']->emails->link as $link): ?>
	<li><a href='<?php echo $link->href ?>' title='<?php echo $link->name ?>'><?php echo $link->name ?></a></li>
	<?php endforeach; ?>
</ul>
<h3>External Links</h3>
<ul>
	<?php foreach($this->data['xml']['links']->external->link as $link): ?>
	<li><a href='<?php echo $link->href ?>' title='<?php echo $link->name ?>'><?php echo $link->name ?></a></li>
	<?php endforeach; ?>
</ul>

<?php
########################################################## FUNCTION: print_cat #
function print_cat(&$category) {
?>
<h3><?php echo $category->name ?></h3>
<ul>
	<?php if($category->file): ?>
		<?php foreach($category->file as $file): ?>
	<li><a href='javascript:PopUp("/site/data/resources/toolsforministry/<?php echo $category->folder.'/'.$file ?>")'><?php echo str_replace('.htm','',$file) ?></a></li>
		<?php endforeach; ?>
	<?php endif; ?>
	<?php
		foreach($category->subcategories->subcategory as $subcategory_id):
			foreach($category->xpath('//category') as $subcat):
				if((int)$subcat['id'] == $subcategory_id):
					print_cat($subcat);
				endif;
			endforeach;
		endforeach;
	?>
</ul>
<?php } ?>
