$(document).ready( function() {
	// panel open
	$('.shareBtn').click(function(e){
	   $('#sharePanel').slideToggle('fast',function(){
		   $('.socialFacebook').addClass('hoverState');
		   $('.socialTwitter').addClass('hoverState');
		   $('.socialDelicious').addClass('hoverState');
		   $('.socialDigg').addClass('hoverState');
		   $('.socialBlogger').addClass('hoverState');
		   $('.socialMyspace').addClass('hoverState');
		   $('.socialLivejournal').addClass('hoverState');
		   $('.socialOther').addClass('hoverState');
	   });
	   e.preventDefault();
	});
	
	// sharing buttons
	$('.facebook').click(function(e){
		shareLink('facebook');
		e.preventDefault();
	});
	
	$('.facebook').mouseover(function(e){
		$('.socialFacebook').removeClass('hoverState');
	});
	
	$('.facebook').mouseout(function(e){
		$('.socialFacebook').addClass('hoverState');
	});	
	
	$('.twitter').click(function(e){
		shareLink('twitter');
		e.preventDefault();
	});
	
	$('.twitter').mouseover(function(e){
		$('.socialTwitter').removeClass('hoverState');
	});
	
	$('.twitter').mouseout(function(e){
		$('.socialTwitter').addClass('hoverState');
	});		
	
	
	$('.delicious').click(function(e){
		shareLink('delicious');
		e.preventDefault();
	});
	
	$('.delicious').mouseover(function(e){
		$('.socialDelicious').removeClass('hoverState');
	});
	
	$('.delicious').mouseout(function(e){
		$('.socialDelicious').addClass('hoverState');
	});		
	
	$('.digg').click(function(e){
		shareLink('digg');
		e.preventDefault();
	});
	
	$('.digg').mouseover(function(e){
		$('.socialDigg').removeClass('hoverState');
	});
	
	$('.digg').mouseout(function(e){
		$('.socialDigg').addClass('hoverState');
	});		
	
	$('.blogger').click(function(e){
		shareLink('blogger');
		e.preventDefault();
	});
	
	$('.blogger').mouseover(function(e){
		$('.socialBlogger').removeClass('hoverState');
	});
	
	$('.blogger').mouseout(function(e){
		$('.socialBlogger').addClass('hoverState');
	});		
	
	$('.myspace').click(function(e){
		shareLink('myspace');
		e.preventDefault();
	});	
	
	$('.myspace').mouseover(function(e){
		$('.socialMyspace').removeClass('hoverState');
	});
	
	$('.myspace').mouseout(function(e){
		$('.socialMyspace').addClass('hoverState');
	});	
	
	$('.livejournal').click(function(e){
		shareLink('livejournal');
		e.preventDefault();
	});	
	
	$('.livejournal').mouseover(function(e){
		$('.socialLivejournal').removeClass('hoverState');
	});
	
	$('.livejournal').mouseout(function(e){
		$('.socialLivejournal').addClass('hoverState');
	});		
	
	$('.otherShare').click(function(e){
		shareLink('other');
		e.preventDefault();
	});
	
	$('.otherShare').mouseover(function(e){
		$('.socialOther').removeClass('hoverState');
	});
	
	$('.otherShare').mouseout(function(e){
		$('.socialOther').addClass('hoverState');
	});	
	
function shareLink(socialMedia){	
	if(socialMedia != 'other'){
	  window.open("http://api.addthis.com/oexchange/0.8/forward/" + socialMedia + "/offer?url=http://www.lionel.com&title=Lionel Trains");
	} else{
		window.open("http://api.addthis.com/oexchange/0.8/offer?url=http://www.lionel.com&title=Lionel Trains");
	}
};
	
	
});

