$(document).ready(function() {
	// Stuff to do as soon as the DOM is ready;

	$('#socialPopUp').hide();
	
	$('html').click(function() {
		//Hide the menus if visible
		$('#socialPopUp').hide();
		$('#tweet').hide();
		$('#fbPost').hide();
		$('#linkedIn').hide();
		$('#WellWatch').hide();
		$('#twitterBtn').attr('src', 'img/social/twitter.png');
		$('#fbBtn').attr('src', 'img/social/fb.png');
		$('#linkedInBtn').attr('src', 'img/social/linkedIn.png');
	});
	
	
	$('#socialIcons a').click(function(e){
		e.stopPropagation();
		e.preventDefault();
		$('#tweet').hide();
		$('#fbPost').hide();
		$('#linkedIn').hide();
		$('#WellWatch').hide();
		
		$('#socialPopUp').show();
		var btnClicked = $(this).attr('rel');
		if (btnClicked == "twitterBtn"){
			$('#tweet').show();
			
			//set Buttons
			$('#twitterBtn').attr('src', 'img/social/tweetAct.png');
			$('#fbBtn').attr('src', 'img/social/fb.png');
			$('#linkedInBtn').attr('src', 'img/social/linkedIn.png');
			
		}
		else if (btnClicked == 'fbBtn'){
			$('#fbPost').show();
			
			//set buttons
			$('#fbBtn').attr('src', 'img/social/fbAct.png');
			$('#twitterBtn').attr('src', 'img/social/twitter.png');
			$('#linkedInBtn').attr('src', 'img/social/linkedIn.png');
		}
		else if (btnClicked == "WellWatch"){
			$('#WellWatch').show();
			
			//set Buttons
			$('#twitterBtn').attr('src', 'img/social/twitter.png');
			$('#fbBtn').attr('src', 'img/social/fb.png');
			$('#linkedInBtn').attr('src', 'img/social/linkedIn.png');
		}
		else if (btnClicked == 'linkedInBtn'){
			$('#linkedIn').show();
		//	onLinkedInLoad();
			//set buttons
			$('#linkedInBtn').attr('src', 'img/social/linkedInAct.png');
			$('#fbBtn').attr('src', 'img/social/fb.png');
			$('#twitterBtn').attr('src', 'img/social/twitter.png');
			
			/*
			//	Call for AJAX
			$.ajax({ 
						type: "POST",
						url: site_url + "ajax/linkedIn",
						success: function(response) {
							if(response!="false"){
								alert("LinkedIn: " + response);
							}
						}
					});
			*/	
		}
		else{
			//do nothing
		}
		
	})
});
