//declare the container div, what the toggle is (h [usually an h1, h2, h3, etc.]), and what the expanding elements are (El [usually a div])
function firstBlind(container, h, El) {
	$("#"+container).find(h).each(function(i) {
					var theImg = container+'img'+i;
					$(this).prepend("<div class='bullet "+theImg+" closed'></div>");
    					$(this).addClass("point");
    					var theDiv = container+'El'+i;
    					$(this).click(function () {
    						bUp(container, document.getElementById(container).openDiv);bDown(container, theDiv, theImg);
    						});
     				});
     				
	$("#"+container).find('div:odd').each(function(i) { //sometimes you need the :odd or :even sudo classes to eliminate 'mystery divs'
    					$(this).addClass(container+"El"+i);
    					$(this).slideUp();
     				});
     				
   $("#"+container+" b").css("color", "white");//WEBBERKEEPER SPECIFIC--make bold text white in the accordian
     				
    document.getElementById(container).lastImg = 'nothing'; /*init lastImg incase an accordian was already manipulated on a previous page*/
    document.getElementById(container).openDiv = 'nothing'; /*same as above*/
    document.getElementById(container).count = 0;
}

function bDown(container, bDiv, img) {
	if (document.getElementById(container).openDiv == bDiv) { /*if you are clicking the tab that is already open*/
		document.getElementById(container).count++;
			if (document.getElementById(container).count == 2) { /*if you click the same tab three times you want it to bDown again and not bUp at the same time*/
				$("."+bDiv).slideDown(300);
				$("."+img).removeClass('closed').addClass('open');
				document.getElementById(container).count = 0;
			}
	}
	
	if (document.getElementById(container).openDiv != bDiv) { /*if you aren't clicking the tab that is already open*/
		$("."+bDiv).slideDown(300);
		$("."+img).removeClass('closed').addClass('open');
		document.getElementById(container).openDiv = bDiv;	/*set current bDdiv to 'open' so it will bUp next time*/
		document.getElementById(container).lastImg = img;
		document.getElementById(container).count = 0;
	}
}

function bUp(container, openDiv) {
	if (document.getElementById(container).count == 0) { /*count value for bUp is one less than the count for bDown*/
		$("."+document.getElementById(container).openDiv).slideUp(300);
		$("."+document.getElementById(container).lastImg).removeClass('open').addClass('closed');
	}
}

