//Readying the software listing
$(document).ready(function() {
	//We only want to show the full software details on the first page.
	var loc = window.location.href;
	var locindex = loc.indexOf("/decs/");
	if($.cookie('softwareListingDisplay') == 'hide' || ($.cookie('softwareListingDisplay') == null && loc.substring(locindex) != "/decs/software")) { 
		$("div.sw-list-body").hide();
		$("#sw-listing-index .sw-list-title").removeClass("sw-list-title-open");
	} else { 
		$("div.sw-list-body").show();
		$("#sw-listing-index .sw-list-title").addClass("sw-list-title-open");
	} 

	$("#sw-listing-index .sw-list-title").hover(function() {
		$(this).addClass("sw-list-title-over");
		},function(){
		$(this).removeClass("sw-list-title-over");
	}).click(function() {
		myparent = $(this);
		$(this).parent().parent().children(".sw-list-body").each(function(){
		    $(this).toggle(); 
			if($(this).css("display") == "none") { 
			    $(myparent).removeClass("sw-list-title-open");
			} else { 
			    $(myparent).addClass("sw-list-title-open");
			} 
		});
	});
});

//Show or Hide the software details
function softwareDetails(d) { 
	if(d == "hide") { 
		$("div.sw-list-body").hide();
		$("#sw-listing-index .sw-list-title").removeClass("sw-list-title-open");
		$.cookie('softwareListingDisplay','hide', { expires: 20 });
	} else { 
		$("div.sw-list-body").show();
		$("#sw-listing-index .sw-list-title").addClass("sw-list-title-open");
		$.cookie('softwareListingDisplay','show', { expires: 20 });
	} 
} 