 //SHOW/HIDE
var sectionArray = new Array($('#workToggle'), $('#aboutToggle'), null);
var elementCount = 0;

$( document ).ready( function() {
	
	$( '#workToggle' ).animate({ height: 320 }, 0 );
	$( '#aboutToggle' ).animate({ height: 511 }, 0 );
	$( '#servicesToggle' ).animate({ height: 576 }, 0 );
	
});
	 
 $('.accordianButtonClose').each(function() {
	
var toggle = 0;
var $thisButton = $(this);
var associatedElement = sectionArray[elementCount];
var index = elementCount;
elementCount++;
$thisButton.click(function() {
		 
		 
	//
		if(toggle == 0){
			$thisButton.hover(
  				function () {
  	 	 		$(this).css("background-image", "url(img/SeparatorButton_expand_over.jpg)");
 		 		}, 
  				function () {
  	 	 		$(this).css("background-image", "url(img/SeparatorButton_expand.jpg)");
 			 	}
			); 
		
			if( index == 0 ){
				$( '#workToggle' ).animate({ height: 20 }, 300 );
			}
			else if( index == 1 ){
				$( '#aboutToggle' ).animate({ height: 0 }, 300, function() {
    		$('.paragraph2').toggle();
			$('.paragraph2').css("padding-bottom", "18px");
  				});
			}
			else if( index == 2 ){
				$( '#servicesToggle' ).animate({ height: 0 }, 300 );
			}
			toggle = 1;
		 }
		 else {
			$thisButton.hover(
  				function () {
  	 	 		$(this).css("background-image", "url(img/SeparatorButton_close_over.jpg)");
 		 		}, 	
  				function () {
  	 	 		$(this).css("background-image", "url(img/SeparatorButton_close.jpg)");
 				 }
			); 
			if( index == 0 ){
				//Open
				$( '#workToggle' ).animate({ height: 320 }, 300 );
				//Close
				//$( '#aboutToggle' ).animate({ height: 0 }, 300 );
				//$( '#servicesToggle' ).animate({ height: 0 }, 300 );
			}
			else if( index == 1 ){
				//Open
				$( '#aboutToggle' ).animate({ height: 511 }, 300 );
				//Close
				//$( '#workToggle' ).animate({ height: 0 }, 300 );
				//$( '#servicesToggle' ).animate({ height: 0 }, 300 );
				//Other
				$('.paragraph2').toggle();
				$('.paragraph2').css("padding-bottom", "26px");
			}
			else if( index == 2 ){
				//Open
				$( '#servicesToggle' ).animate({ height: 576 }, 300 );
				//Close
				//$( '#aboutToggle' ).animate({ height: 0 }, 300 );
				//$( '#workToggle' ).animate({ height: 0 }, 300 );
			}
			toggle = 0;
		 }
	
		 
//  	$(associatedElement).toggle('slow', function() {
  	  // Animation complete.
	 
  //		});	
  		
  
	});
});

//Expand hover
$(".accordianButtonClose").hover(
  function () {
    $(this).css("background-image", "url(img/SeparatorButton_close_over.jpg)");
  }, 
  function () {
    $(this).css("background-image", "url(img/SeparatorButton_close.jpg)");
  }
);

//Work Next Button hover
$(".accordianButtonWorkClose").hover(
  function () {
    $(this).css("background-image", "url(../../img/work/WorkSeparatorButton_over.jpg)");
  }, 
  function () {
    $(this).css("background-image", "url(../../img/work/WorkSeparatorButton.jpg)");
  }
);
