function initPrograms() {
	// Fix PNGs for IE6 //
	$(document).pngFix();
	// For loading the initial page from Programs Page, or refreshing page //
	var chosen = window.location.hash.substring(1);
	if (chosen == "") {
		var chosen = "0"
		}
	
	var listHeight = $("#program_list").height() - 75;
	$("#loadedContent").animate({height: "" + listHeight + ""}, 300);
	
	$("#loadedContent").load("module_details.asp div.item:eq("+ chosen +")", function(){ 
		$("#loadedContent .theTitle").css("display","none");
		$("#window_top .program_title").load("module_details.asp div.item:eq("+ chosen +") .theTitle a");
		$("#loadedContent .item").fadeIn(300);
		// Set the QueryString HREFs //
		$("#program_list a").each(function(i) {
			$(this).attr("href","#" + i + "");
		});		
	});	

	// Populate the list on init
	$("#adult ul.theList:eq(0)").load("module_details.asp #group1 div.item li.ARS", function() { 	
		$("#adult ul.theList:eq(1)").load("module_details.asp #group1 div.item li.ADS", function() { 	
			$("#youth ul.theList:eq(0)").load("module_details.asp #group2 div.item li.home_based", function() { 	
				$("#youth ul.theList:eq(1)").load("module_details.asp #group2 div.item li.school_summer", function() { 	
					$("#youth ul.theList:eq(2)").load("module_details.asp #group2 div.item li.yfs", function() { 	//was YFS group for childrens residential
						// Set the QueryString HREFs //
						$("#program_list a").each(function(i) {
							$(this).attr("href","#" + i + "");
							// Fix the height of the loadedContent window //
							//var listHeight = $("#program_list").height() - 75;
							//$("#loadedContent").css("height", "" + listHeight + "px");			
						});
						//$(".group li a").parent("li").parent("ul").slideDown(300, function(){ //expand all
						// Make an exception for CRS
						/*if (chosen == "0") {
							$(".listLoader").css("display","none");
							$(".group").fadeIn(300).slideDown(300, function(){ 
								var listHeight = $("#program_list").height() - 75;
								$("#loadedContent").css("height", "" + listHeight + "px");
							});					
						}*/
						//else {
							$(".group li a[href=#"+ chosen +"]").parent("li").parent("ul").slideDown(300, function(){  //expand only the chosen category
								$(".listLoader").css("display","none");
								$(".group").fadeIn(300).slideDown(300, function(){ 
									var listHeight = $("#program_list").height() - 75;
									$("#loadedContent").css("height", "" + listHeight + "px");
								});
		
							});	
						//}	
						// AJAX Load the content //	
						$("#program_list  a").click(function(){ 
							$("#loadedContent").html("<div style='text-align:center;padding-top:80px;'><img src='images/loading.gif' /></div>");
							var chosen = $("#program_list a").index(this);
							$("#window_top .program_title").load("module_details.asp div.item:eq("+ chosen +") .theTitle a");				
							$("#loadedContent").load("module_details.asp div.item:eq("+ chosen +")", function(){ 
								$("#loadedContent .theTitle").css("display","none");							
								$("#loadedContent .item").fadeIn(300);
							});
						});																		
					});			
				});			
			});			
		});			 //was used for YFS group, childrens residential
	});
}

function insideLink(i) {
// A hacky way to deal with interior links //	
$("#loadedContent").load("module_details.asp div.item:eq("+i+")", function(){ 
	$("#loadedContent .theTitle").css("display","none");
	$("#window_top .program_title").load("module_details.asp div.item:eq("+i+") .theTitle a");
	$("#loadedContent .item").fadeIn(300);
	//var theTitle = $("#window_top .theTitle").html();
	//$("#window_top .program_title").append(theTitle);
});

}

$(document).ready(function() {	

	//Accordion Functionality
	$(".group .title").click(function() {
		$(this).next("ul.theList").slideToggle(300).parent(".group").siblings(".group").children("ul.theList").slideUp(200);
		$(this).delay(300,function(){
			var listHeight = $("#program_list").height() - 75;
			$("#loadedContent").animate({height: "" + listHeight + ""}, 300);
		});	

	});	
});