############################################################## 
## MOD Title: Collapsible Categories
## MOD Author: Brf < b.fermanich@insightbb.com  > (Brad Fermanich) http://castledoom.com/ 
## MOD Description: This MOD allows each user to collapse categories on index and viewforum
##		    and stores those settings for later page views.
## MOD Version: 0.0.0
## 
## Installation Level: Easy 
## Installation Time: 5 Minutes 
## Files To Edit: styles/subsilver2/templates/forumlist_body.html
## Included Files: styles/subsilver2/theme/images/cc_up.gif
##		   styles/subsilver2/theme/images/cc_down.gif
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/
############################################################## 
## Author Notes: 
## This package contains ONLY the changes for subsilver2 template
############################################################## 
## MOD History: 
##
##   2008-1-23 - Version 0.2.0a
##	- Blank value.
##
##   2008-1-23 - Version 0.2.0
##	- Use image button.
##
##   2008-1-16 - Version 0.1.0
##	- subsilver2 template
##
##   2008-1-16 - Version 0.0.0
##	- Initial Release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ COPY ]------------------------------------------ 
#
copy root/styles/subsilver2/theme/images/cc_open.gif to styles/subsilver2/theme/images/cc_open.gif
copy root/styles/subsilver2/theme/images/cc_close.gif to styles/subsilver2/theme/images/cc_close.gif

# 
#-----[ OPEN ]------------------------------------------ 
#
styles/subsilver2/template/forumlist_body.html
# 
#-----[ FIND ]------------------------------------------ 
#
<table class="tablebg" cellspacing="1" width="100%">

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<style>
.ccopen{
	background: #888888 url("{T_THEME_PATH}/images/cc_down.gif") no-repeat center center;
	width: 25px;
	height:25px;
	border: thin solid #666666 
}
.ccclose{
	background: #888888 url("{T_THEME_PATH}/images/cc_up.gif") no-repeat center center;
	width: 25px;
	height:25px;
	border: thin solid #666666
}
</style> 
<script type="text/javascript">
// <![CDATA[
function flipf(btn, thiscat)
{
	rnd = Math.random().toString().substring(2);
    myurl = "{S_AJAX_COLLAPSE_ACTION}" + "&rnd=" + rnd;
	if (btn.className=="ccclose")
	{
		btn.className="ccopen";
		document.getElementById('flist'+thiscat).style.display="none";
		myurl = myurl + "&cset=" + thiscat;
	}
	else
	{
		btn.className="ccclose";
		document.getElementById('flist'+thiscat).style.display="";
		myurl = myurl + "&cunset=" + thiscat;
	}
	// alert (myurl);
	var myajax=ajaxobject();
	myajax.open('GET',myurl,true);
	myajax.onreadystatechange = function()
		{
			if (myajax.readyState == 4)
			{
				if (myoutput = myajax.responseXML)
					{
						// Discard
						return;
					}
			}		
		}
	myajax.send(null);
}
function ajaxobject()
{
	try
	{
		var http_request = false;
		if (window.XMLHttpRequest)
		{ // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/xml');
			}
		}
		else if (window.ActiveXObject)
		{ // IE
			try
			{
				http_request = new ActiveXObject('Msxml2.XMLHTTP');
			}
			catch (e)
			{
				try
				{
					http_request = new ActiveXObject('Microsoft.XMLHTTP');
				}
				catch (e)
				{
				}
			}
		}

		if (!http_request)
		{
			 return false;
		}
		else
		{
			return http_request;
	}	
	}
	catch (e)
	{
		handle(e);
		return false;
	}
}

// ]]>
</script>

<table class="tablebg" cellspacing="1" width="100%"> 
<tbody>

# 
#-----[ FIND ]------------------------------------------ 
#
	<!-- IF forumrow.S_IS_CAT -->
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
</tbody>

# 
#-----[ FIND ]------------------------------------------ 
#

			<td class="catdiv" colspan="3">&nbsp;</td>
		</tr>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
			<td class="catdiv" colspan="3" align="right"><input type="button" class="{forumrow.COLLAPSE_CLASS}" value=" " onclick="flipf(this,'{forumrow.FORUM_ID}');" /></td>
		</tr>
		<tbody id="flist{forumrow.FORUM_ID}" {forumrow.S_COLLAPSE}>
# 
#-----[ FIND ]------------------------------------------ 
#
		<!-- IF forumrow.S_NO_CAT -->
			<tr>
				<td class="cat" colspan="2"><h4>{L_FORUM}</h4></td>
				<td class="catdiv" colspan="3">&nbsp;</td>
			</tr>
		<!-- ENDIF -->
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
		<!-- IF forumrow.S_NO_CAT -->
			</tbody>
			<tr>
				<td class="cat" colspan="2"><h4>{L_FORUM}</h4></td>
				<td class="catdiv" colspan="3" align="right"><input type="button" class="{forumrow.COLLAPSE_CLASS}" value=" " onclick="flipf(this,'{forumrow.FORUM_ID}');" /></td>
			</tr>
			<tbody id="flist{forumrow.FORUM_ID}" {forumrow.S_COLLAPSE}>
		<!-- ENDIF -->

# 
#-----[ FIND ]------------------------------------------ 
#
</table>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
</tbody>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 