/* ================================================================
This copyright notice must be untouched at all times.
Copyright (c) 2008 Stu Nicholls - stunicholls.com - all rights reserved.
=================================================================== */
/* <![CDATA[ */
$(document).ready(function(){
/* CONFIG */
/* set start (sY) and finish (fY) heights for the list items */

sY = 24; /* height of li.sub */
fY = 200; /* 165 height of maximum sub lines * sub line height */
/* end CONFIG */

/* open first list item */
//animate (fY)

$("#slide .sub").click(function() {

	if (this.className.indexOf('clicked') != -1 ) {

		animate(sY)
		$(this)			.removeClass('clicked')
						.css("background", "url(images/menu-out.gif) no-repeat 5px 8px")
						.css("color", "#000");
	}
	else {
        $noofrow = $(this).find('ul').children().size();
        fY = 20 * $noofrow + 30;

		animate(sY)
		$('.clicked')	.removeClass('clicked')
						.css("background", "url(images/menu-out.gif) no-repeat 5px 8px")
						.css("color", "#000");
		$(this)			.addClass('clicked');
		animate(fY)
	}
});

function animate(pY) {
    $('.clicked').animate({"height": pY + "px"}, 500);
}

$("#slide .sub")		.hover(function(){
$(this)					.css("background", "url(images/menu-out.gif) no-repeat 5px 8px")
						.css("color", "#c00");
},function(){
if (this.className.indexOf('clicked') == -1) {
$(this)					.css("background", " url(images/menu-out.gif) no-repeat 5px 8px")
						.css("color", "#000");
}
});

});
/* ]]> */
