(function($) {
	$.fn.homepageLoad = function(options) {
	
		var defaults = {}
		var options = $.extend(defaults, options);
						 
		return this.each(function() {

			var obj = $(this);			
			var isActive = false;
			var idActive = false;
			var growing = false;
			
			var circleAimg = [151,150,161,160];
			var circleBimg = [192,189,202,199];
			var circleCimg = [187,190,197,200];
			var circleDimg = [159,160,169,170];

		

										obj.children().each(function() {

											$(this).bind('click', function(event) {
												event.preventDefault();
	
												if(isActive == false) {
													isActive = true;					

													var circleId = $(this).attr('id');
													$(this).contents().attr('src', 'images/circles/'+$(this).attr('id').toLowerCase()+'.png');					
													$(this).find('img').addClass("active");

													var title = getCircleTitle(circleId);

                                                                                                        /* Title Now Doesnt Hide */

													$('#intro').find('div').fadeOut('slow', function() {	});

													$('#titleHeader').fadeOut('slow', function() {
														$('#titleHeader').css('background', 'none');
															$('#titleHeader').html(title);
															Cufon.refresh();

															$('#titleHeader').fadeIn('slow', function() {

															});
													});


													$('.infoactive').fadeOut('slow', function() {
														$(this).removeClass('infoactive');	

														$('#'+circleId+'-info').fadeIn('slow', function() {
															$(this).addClass('infoactive');
															isActive = false;
														});
													});

													$(this).parent().children().each(function() {

														if(circleId != $(this).attr('id')) {
															$(this).contents().attr('src', 'images/circles/'+$(this).attr('id').toLowerCase()+'-dark.png');
															var circle = getCircleDimensions($(this).attr('id'));
															$(this).find('img').removeClass('active')
														      $(this).css({'z-index' : '0'});
															$(this).find('img').removeClass("hover").stop()  
																.animate({
																	marginTop: '-5px',
																	marginLeft: '-5px',
																	top: '0',
																	left: '0',
																	width: circle[0]+'px',
																	height: circle[1]+'px',
																	padding: '5px'
																}, {duration: 200});
														}
													});										
												}

					
											});

											$(this).hover(function() {
													var isActive = $(this).find('img').hasClass('active');

													if(!isActive) {
														var circle = getCircleDimensions($(this).attr('id'));					
											/* removed by !Steve	$(this).css({'z-index' : '10'});  Add a higher z-index value so this image stays on top*/
														$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
															.animate({
																marginTop: '-5px', /* The next 4 lines will vertically align this image */
																marginLeft: '-5px',
																top: '50%',
																left: '50%',
																width: circle[2]+'px', /* Set new width */
																height: circle[3]+'px', /* Set new height */
																padding: '0px'
															}, {duration: 200}); /* this value of "200" is the speed of how fast/slow this hover animates */
													}
													} , function() {

													var isActive = $(this).find('img').hasClass('active');	

													if(!isActive) {							
														var circle = getCircleDimensions($(this).attr('id'));											
                                                                                                        /* $(this).css({'z-index' : '0'});  Set z-index back to 0 */
														$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
															.animate({
																marginTop: '0', /* Set alignment back to default */
																marginLeft: '0',
																top: '0',
																left: '0',
																width: circle[0]+'px', /* Set new width */
																height: circle[1]+'px' /* Set new height */
//																padding: '5px'
															}, {duration: 200});
													}
											});

											function getCircleTitle(id) {
												switch(id) {
//													case "circleA" : return "Entrepreneurial spirit with global scale"; break;
//													case "circleB" : return "A unique balance of integration and specialist expertise"; break;
//													case "circleC" : return "A creative blend of consumer led planning and rigorous data analytics"; break;
//													case "circleD" : return "Senior people alongside every piece of business"; break;
												}
											}
											function getCircleDimensions(id) {
												switch(id) {
													case "circleA" : return circleAimg; break;
													case "circleB" : return circleBimg; break;
													case "circleC" : return circleCimg; break;
													case "circleD" : return circleDimg; break;																		
												}	
											}	


										});

									});
								}
							})(jQuery);