<?php
//define this module's name and path
$mn = basename(__FILE__ , ".php");
include("modules/modules.php");

/*
Available variables:
All system classes
All request variables
$p (the template path)
$mp (the module path)
$sufixID (id sufix for this module's divs)
*/

$marginTop = ($moduleParameters['marginTop'] == "__EMPTY__" || empty($moduleParameters['marginTop'])) ? 0 : $moduleParameters['marginTop'];
$marginRight = ($moduleParameters['marginRight'] == "__EMPTY__" || empty($moduleParameters['marginRight'])) ? 0 : $moduleParameters['marginRight'];
$marginBottom = ($moduleParameters['marginBottom'] == "__EMPTY__" || empty($moduleParameters['marginBottom'])) ? 0 : $moduleParameters['marginBottom'];
$marginLeft = ($moduleParameters['marginLeft'] == "__EMPTY__" || empty($moduleParameters['marginLeft'])) ? 0 : $moduleParameters['marginLeft'];
$paddingTop = ($moduleParameters['paddingTop'] == "__EMPTY__" || empty($moduleParameters['paddingTop'])) ? 0 : $moduleParameters['paddingTop'];
$paddingRight = ($moduleParameters['paddingRight'] == "__EMPTY__" || empty($moduleParameters['paddingRight'])) ? 0 : $moduleParameters['paddingRight'];
$paddingBottom = ($moduleParameters['paddingBottom'] == "__EMPTY__" || empty($moduleParameters['paddingBottom'])) ? 0 : $moduleParameters['paddingBottom'];
$paddingLeft = ($moduleParameters['paddingLeft'] == "__EMPTY__" || empty($moduleParameters['paddingLeft'])) ? 0 : $moduleParameters['paddingLeft'];
$useModuleContainer = ($moduleParameters['useModuleContainer'] == "__EMPTY__" || empty($moduleParameters['useModuleContainer'])) ? 0 : (int)$moduleParameters['useModuleContainer'];
$widthInPixels = ($moduleParameters['widthInPixels'] == "__EMPTY__" || empty($moduleParameters['widthInPixels'])) ? null : (int)$moduleParameters['widthInPixels'];


if(empty($marginTop) && empty($marginRight) && empty($marginBottom) && empty($marginLeft)){
	$Mmargin = "0";
}else{
	$Mmargin = $marginTop." ".$marginRight." ".$marginBottom." ".$marginLeft." ";
}
if(empty($paddingTop) && empty($paddingRight) && empty($paddingBottom) && empty($paddingLeft)){
	$Mpadding = "0";
}else{
	$Mpadding = $paddingTop." ".$paddingRight." ".$paddingBottom." ".$paddingLeft." ";
}

global $doNotShowSocial;
if($_SERVER['SERVER_NAME'] == "localhost" && $doNotShowSocial) return;


$sendButton = ($moduleParameters['sendButton']) ? "true" : "false";
$showDetails = $moduleParameters['showDetails'];
$width = $moduleParameters['width'];
$showFaces = ($moduleParameters['showFaces']) ? "true" : "false";
$colorSheme = ($moduleParameters['colorSheme'] == "dark") ? true : false;
$font = $moduleParameters['font'];
$mLanguage = $moduleParameters['mLanguage'];
global $domain_name;

$thisPage = getBase()."index.php?section=".$section."&view=".$view."&id=".$id."&r=".rand();
if($catID) $thisPage.="&catID=".$catID;
if($month) $thisPage.="&month=".$month;
if($year) $thisPage.="&year=".$year;
$thisPage.="&langID=".$langID;

if($useModuleContainer ){
?>

<div id="<?php echo $mn.$sufixID;?>" data-editable="editable" class="responsive_float">
<style type="text/css">
#<?php echo $mn.$sufixID;?>{
	<?php 
	$alignRule = ($moduleParameters['moduleAlign'] == "center") ? "text-align" : "float";
	echo $alignRule.": ".$moduleParameters['moduleAlign'].";".PHP_EOL;
	?>
	margin : <?php echo $Mmargin;?>;
	padding : <?php echo $Mpadding;?>;
<?php
if($widthInPixels){
	?>
	width: <?php echo $widthInPixels;?>px;
	<?php 
}	
if($moduleParameters['moduleHR'] == "top" || $moduleParameters['moduleHR'] == "bottom"){
?>
	border-<?php echo $moduleParameters['moduleHR'];?> : 1px solid black;
<?php 
}
?>
}
</style>
<?php 
}
?>
<div style="text-align:left">

<script>function fbs_click() {u='<?php echo $thisPage;?>';t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>

<div id="fb-root" style="float:left;"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/<?php echo $mLanguage;?>/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk2'));</script>
<div class="fb-like" data-href="<?php echo $thisPage;?>" data-send="<?php echo $sendButton;?>" data-width="<?php echo $width;?>" data-show-faces="<?php echo $showFaces;?>" <?php if($colorSheme){ echo 'data-colorscheme="dark"' ;}?> data-font="<?php echo $font;?>"></div>
</div>
<?php
if($useModuleContainer ){
?>		 
</div>
<?php 
}
?>
