function fcInit(){
	$(".catbox").height("30px");
	$(".cbList").height("30px");
	$(".cbContent").height("30px");
}

$(document).ready(function(){
	$(".cbTitle").click(function(){
		var cbContent = $(this).parent().find(".cbContent");
		cbVisToggle(cbContent);
	});
	$(".cbShowAll").click(function(){
		var cbList = $(this).parent().parent().find(".cbList");
		cbShowAllToggle(cbList);
	});
	$(".cbContent").find("input:checkbox").click(function(){
		cbBlogUpdate($(this));
	});
	/* ===========================================================================================================
		if you want all items to be checked when the user opens the page swap the code below with the following:
		$(".cbContent").find("input").attr("checked","checked");
	=============================================================================================================*/
	$(".cbContent").find("input").removeAttr("checked");
});

function cbVisToggle(target){
	var cbBottom = target.parent().find(".cbBottom");
	var cbList = target.find(".cbList");
	var cbBtn = target.parent().find(".cbTitleBtn");

	if( !target.is(":visible") ) {
		target.show();
		target.animate({height:minHeight});
		cbBottom.show();
		cbList.height(minHeight);
		cbBtn.removeClass("closed").addClass("open");
	}else{
		target.animate({height:"1px"},function(){
			target.hide();
		});
		cbBottom.fadeOut();
		cbList.css("overflow","hidden");
		cbBtn.removeClass("open").addClass("closed");
	}
}

function cbShowAllToggle(target){
	var cbContent = target.parent();
	var cbShowBtn = target.parent().parent().find(".cbShowAll");

	if(target.css("overflow") == "visible"){
		target.css("overflow","hidden");
		target.animate({height:minHeight});
		cbContent.animate({height:minHeight},function(){
			cbShowBtn.html("Show All");
		});
	}else if(target.css("overflow") == "hidden") {
		target.css("overflow","visible");
		target.animate({height:maxHeight});
		cbContent.animate({height:maxHeight},function(){
			cbShowBtn.html("Show 10");
		});
	}
}
/*-------------------------------------------------------------------|
|	Stuff to update the blog part of the page goes below here
|																			
|
--------------------------------------------------------------------*/
function cbBlogUpdate(target){
	if(target.is(":checked")){
		alert(target.attr("id"));
	}else{
		alert("UNCHECKED");
	}
	//Display Blog Categories that are checked including this catID
	
}

function debugOut(inStr){
	$("#debug").append("<p>"+inStr+"</p>");
}


var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;


