<script type='text/javascript'>

  //# sourceURL=rhp_sliding_panel.js

	jQuery(document).ready(function($){

		init_social_panel();

		$('.rhp-share-link').click(function(e){
			e.preventDefault();
			window.location = 'http://' + $(this).attr('href');
		});

		$('#rhp-facebook').click(function(e){
            e.preventDefault();

            // calling the API ...
            <?php
            if (isset($_GET['fbs']) && ($_GET['fbs'] == '1')) {
            ?>
                var obj = {
                  method: 'share',
                  href:rhp_vars.shareRedirectURI,
                };
            <?php
            } else {
            ?>
                var obj = {
                  method: 'feed',
                  //app_id: rhp_vars.fb_appID,
                  //appId: rhp_vars.fb_appID,
                  link: rhp_vars.shareLink,
                  //picture: rhp_vars.sharePicture,
                  name: rhp_vars.shareTitle,
                  caption: rhp_vars.shareTitle,
                  description: rhp_vars.shareDescription
                };

                if( false!==rhp_vars.sharePicture && ''!=rhp_vars.sharePicture ){
                	obj.picture = rhp_vars.sharePicture;
                }
                
            <?php
            }
            ?>

            function rhp_fb_callback(response) {
              console.log('fb_cb', response);
            }

            try {
            	FB.ui(obj, rhp_fb_callback);
            }catch(err){
            
            }
		  });

		$('#rhp-twitter').click(function(e){
			var articleUrl = encodeURIComponent(rhp_vars.shareLink);
			var articleSummary = encodeURIComponent(rhp_vars.shareTitle);
			var goto = 'https://twitter.com/share?' +
			    '&url=' + articleUrl +
			    '&text=' + articleSummary +
			    '&counturl=' + articleUrl;
			openWindow(goto, 'Twitter');
		});

		$('#rhp-linkedin').click(function(e){

			var articleUrl = encodeURIComponent(rhp_vars.shareLink);
			var articleTitle = encodeURIComponent(rhp_vars.shareTitle);
			var articleSummary = encodeURIComponent(rhp_vars.shareDescription);
			var articleSource = encodeURIComponent(rhp_vars.shareLink);
			var goto = 'http://www.linkedin.com/shareArticle?mini=true'+
				 '&url='+articleUrl+
				 '&title='+articleTitle+
				 '&summary='+articleSummary+ articleUrl +
				 '&source='+articleSource;
			openWindow(goto, 'LinkedIn');

			return false;
		});


		$('#rhp-google').click(function(e){
		    var articleUrl = encodeURIComponent(rhp_vars.shareLink);
		    var goto = 'https://plus.google.com/share?url=' + articleUrl;

		    openWindow(goto, 'Google+');
		});

		function openWindow(url, title){
			window.open(url, title, "width=660,height=400,scrollbars=no;resizable=no");
		}

		$(".rhp-close-button").click(function(e){
			$(this).parent().parent()
				.removeClass('rhp-spmenu-open')
				.removeClass('cbp-spmenu-open')
			;
			$('BODY')
				.removeClass('cbp-spmenu-push-toright')
				.removeClass('cbp-spmenu-push-toleft')
			;
			return false;
		});
	 });


</script>

<nav class="cbp-spmenu cbp-spmenu-vertical cbp-hidden" id="cbp-spmenu-s1">
	<h3 class="rhp_title">Share</h3>
	<a id="rhp-facebook" href="#">Facebook</a>
	<a id="rhp-twitter" href="#">Twitter</a>
	<a id="rhp-linkedin" href="#">LinkedIn</a>
	<a id="rhp-google" href="#">Google+</a>
	<div class="rhp-link-holder"></div>
	<div class="rhp-close-button-hold"><a class="rhp-close-button" href="javascript:void(0);">X</a></div>
</nav>
