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();
		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){
	//create array of checked category items
	var  catVizList = Array();
	var checkBox = $(".cbList > li > input");
	
	$("#content").prepend("<div class='loadingAnim'>&nbsp;</div><h4>Loading posts...</h4>");
	
	checkBox.each(function(){
		if($(this).attr("checked")){
			catVizList.push($(this).attr("id"));
		}
	});
	
//	Display Blog Categories that are checked including this catID
//	$("#content").load("http://blog-dev.gartner.com/blog/categories/good-post/?name=John",{catvizlist:catVizList},function(response,status,xhr){
//		$("#content").html(response);
//	});
var selectedCategories;
selectedCategories = catVizList.toString();
$.post("/?cat=1", { category: selectedCategories },function(data){
	$("#content").html(data);
 });


}





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;









