﻿jQuery.noConflict();

jQuery(document).ready(function(){
	var gray = "rgb(242, 242, 242)";
	var gray2 = "rgb(242,242,242)";
	var white = "rgb(255, 255, 255)";
	var white2 = "#ffffff";
	var white3 = "rgb(255,255,255)";
  
	//start all div's as closed
	
	//start with the practice industries open
	jQuery(".div_001").show();
	jQuery(".div_001").parent().find(".BioExpanderLinks").css("background-color", gray);
	jQuery(".div_001").parent().find(".BioExpanderLinks #lnkBioIco").text("-");
	
	//loop through bio item
	jQuery(".ExpansionItem").each(function(){
		var item = jQuery(this);
		
		//attach click to each link
		jQuery(this).children(".BioExpanderLinks").click(
			function(){
				if(jQuery(this).css("background-color") == white || jQuery(this).css("background-color") == white2 || jQuery(this).css("background-color") == white3){
					//open
					jQuery(this).css("background-color", gray);
					jQuery(this).find("#lnkBioIco").text("-");
				}
				else if(jQuery(this).css("background-color") == gray || jQuery(this).css("background-color") == gray2){
					//close
					jQuery(this).css("background-color", white);
					jQuery(this).find("#lnkBioIco").text("+");		
				}
				jQuery(this).parent().find(".BioExpanderContent").slideToggle('fast');
				
				return false;
			}
		);
	});
  
	//add a click to the full bio btn
	jQuery(".GlobalToggle a").click(
		function(){
			//loop through all of the child links
			jQuery(".BioExpanderLinks").each(function(){
				
				if(jQuery(".GlobalToggle a").html() == "Full Bio"){
					//open
					if(jQuery(this).css("background-color") == white || jQuery(this).css("background-color") == white2 || jQuery(this).css("background-color") == white3){
						jQuery(this).css("background-color", gray);
						jQuery(this).find("#lnkBioIco").text("-");
						jQuery(this).parent().find(".BioExpanderContent").slideToggle('fast');
					}
				}
				else {
					//close
					if(jQuery(this).css("background-color") == gray || jQuery(this).css("background-color") == gray2){
						jQuery(this).css("background-color", white);
						jQuery(this).find("#lnkBioIco").text("+");
						jQuery(this).parent().find(".BioExpanderContent").slideToggle('fast');
					}
				}
			});
			
			//set the new toggle text
			if(jQuery(".GlobalToggle a").html() == "Full Bio"){
				jQuery(".GlobalToggle a").html("Close All");
			}
			else {
				jQuery(".GlobalToggle a").html("Full Bio");
			}
			
			return false;
		}
	);

});
