/**
 * JavaScript to load provide a popup frame for social sharing options.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS\module\social
 * @copyright Copyright (c) 2014 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

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

	// Social sharing
	$fl('.cfSocialShare a').bind('click', function(e) {
		if($fl(window).width() > 767) {
			var width = Math.min(800, window.screen.width),
				height = Math.min(540, window.screen.height),
				leftPosition = (window.screen.width / 2) - ((width / 2) + 10),
				topPosition = (window.screen.height / 2) - ((height / 2) + 50);

			var popup = window.open(
				e.target.href,
				"cfSocialShare",
				"status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no"
			);

			e.preventDefault();
			e.stopPropagation();
			return false;
		}
	});
});
