$(document).ready(function(){
	initToggle();
	initForm();
});

$(window).load(
	function(){ 
		$('.scroll-pane').jScrollPane({
			showArrows: true
		});
	}
);

function initToggle(){
	$("#content ul.list a").click(function(){
		if ($(this).hasClass('collapse')) {
			$("#content ul.col-exp a").removeClass('active');
			$("#content ul.col-exp > li").find("div.text").slideUp('slow', function(){
				$('.scroll-pane').jScrollPaneRemove;
				$('.scroll-pane').jScrollPane({showArrows: true});
			});
		}
		if ($(this).hasClass('expand')) {
			$("#content ul.col-exp a").addClass('active');
			$("#content ul.col-exp > li").find("div.text").slideDown('slow', function(){
				$('.scroll-pane').jScrollPaneRemove;
				$('.scroll-pane').jScrollPane({showArrows: true});
			});
		}
		return false;
		
		
	});
	$("#content ul.col-exp a").click(function(){
		if ($(this).hasClass('active')) {
			$(this).removeClass('active');
		}
		else 
		{	$(this).addClass('active');	}
		$(this).parents("ul.col-exp > li").find("div.text").slideToggle("slow", function(){
			$('.scroll-pane').jScrollPaneRemove;
			$('.scroll-pane').jScrollPane({showArrows: true});
		});
		return false;
		
		
	});
};

function initForm(){
	if ($('#sumbit-form').length){
		$('#sumbit-form').validate();
	}
}