$(function(){
	// Enable drop-down twoLevel menu.
	$("#homepage_banner").hide();
	$("#homepage_slideshow_banner").show().cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	$("#menu").wwMenu({
		mode: "horizontal"
	});
	// add the project types
	$("#project-sprout a").html("<span class='project_type'>GTECH: Project</span>"+$("#project-sprout a").html());
	$("#green-tool-box a").html("<span class='project_type'>GTECH: Project</span>"+$("#green-tool-box a").html());
	$("#green-job-advisory a").html("<span class='project_type'>GTECH: Project</span>"+$("#green-job-advisory a").html());

	$("#jenette-street a").html("<span class='project_type'>GTECH: Bioenergy Garden</span>"+$("#jenette-street a").html());
	$("#sparc a").html("<span class='project_type'>GTECH: Project</span>"+$("#sparc a").html());
	$("#uptown a").html("<span class='project_type'>GTECH: Bioenergy Garden</span>"+$("#uptown a").html());

	$("#larimer-ave a").html("<span class='project_type'>GTECH: Bioenergy Garden</span>"+$("#larimer-ave a").html());
	$("#almono-brownfield a").html("<span class='project_type'>GTECH: Brownfield</span>"+$("#almono-brownfield a").html());


	$('.expander').click(function(){
		$('.collapse').hide('normal');
		$(this).next('.collapse').show('normal');
	})
	$('a[href="http://www.twitter.com/gtechstrategies/"]').attr('target', '_blank');
	var randomslide=Math.floor(Math.random()*4)+1;
	$("#sidebar_logo").append("<img src='/assets/sidebar_logo_"+randomslide+".jpg'>");
	Cufon.replace('#section_nav ul li a, .sidebar_large a');
	// add the typeface.js to the section menu headlines
	// test if we are in the featured projects or current projects sections
	if($('#section_nav a.currentSection').text() == 'Projects + Partners'){
		// if we are in the featured projects section
		// turn off the main title, and the current projects section as well.
		if($("a.currentPage").parents('li[id=featured-projects]').length > 0){
			$("#current-projects").hide();
			$("#past-projects").hide();
			$("#section_nav .currentSection").css('display', 'none').hide();
			$("a.currentPage").parents('li[id=featured-projects]').addClass('overrideSection').parents('ul').addClass('overrideSection')
			Cufon.refresh();
		}
		if($("a.currentPage").parents('li[id=current-projects]').length > 0){
			$("#featured-projects").hide();
			$("#past-projects").hide();
			$("#section_nav .currentSection").css('display', 'none').hide();
			$("a.currentPage").parents('li[id=current-projects]').addClass('overrideSection').parents('ul').addClass('overrideSection')
			Cufon.refresh();
		}
		if($("a.currentPage").parents('li[id=past-projects]').length > 0){
			$("#featured-projects").hide();
			$("#current-projects").hide();
			$("#section_nav .currentSection").css('display', 'none').hide();
			$("a.currentPage").parents('li[id=past-projects]').addClass('overrideSection').parents('ul').addClass('overrideSection')
			Cufon.refresh();
		}
	}
});