<?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." ";
}

$verticalDisplay = ($moduleParameters['verticalDisplay'] == "__EMPTY__" || empty($moduleParameters['verticalDisplay'])) ? 0 : $moduleParameters['verticalDisplay'];
$facebook = $moduleParameters["facebook"];
$twitter = $moduleParameters["twitter"];
$youtube = $moduleParameters["youtube"];
$linkedin = $moduleParameters["linkedin"];
$vimeo = $moduleParameters["vimeo"];
$pinterest = $moduleParameters["pinterest"];
$googlePlus = $moduleParameters["googlePlus"];
$tumblr = $moduleParameters["tumblr"];
$instagram = $moduleParameters["instagram"];
$flickr = $moduleParameters["flickr"];
$vine = $moduleParameters["vine"];


if($useModuleContainer ){
?>
<div id="<?php echo $mn.$sufixID;?>" data-editable="editable">
<?php
}
?>

<style  type="text/css">
<?php
if($useModuleContainer ){
	?>
#<?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['moduleAlign'] && $moduleParameters['moduleHR']){ // there are system parameters...

if($moduleParameters['moduleHR'] == "top" || $moduleParameters['moduleHR'] == "bottom"){
?>
	border-<?php echo $moduleParameters['moduleHR'];?> : 1px solid black;
<?php 
}
}
?>
}
<?php
}
if(!empty($verticalDisplay)){
?>
.social_icon{
	display:block !important;
}
<?php	
}
?>
</style>
<script type="text/javascript">
function uc(){
	alert("Under Construction");
}
</script>
<div id="social_icons">
<?php
if(!empty($facebook)){
	$target = ($facebook == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_facebook" href="<?php echo $facebook;?>"<?php echo $target;?> title="Facebook"></a>
<?php
}
if(!empty($twitter)){
	$target = ($twitter == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_twitter" href="<?php echo $twitter;?>"<?php echo $target;?> title="Twitter"></a>
<?php
}
if(!empty($linkedin)){
	$target = ($linkedin == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_linkedin" href="<?php echo $linkedin;?>"<?php echo $target;?> title="Linked In"></a>
<?php
}
if(!empty($youtube)){
	$target = ($youtube == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_youtube" href="<?php echo $youTube;?>"<?php echo $target;?> title="YouTube"></a>
<?php
}
if(!empty($vimeo)){
	$target = ($vimeo == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_vimeo" href="<?php echo $vimeo;?>"<?php echo $target;?> title="Vimeo"></a>
<?php
}
if(!empty($pinterest)){
	$target = ($pinterest == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_pinterest" href="<?php echo $pinterest;?>"<?php echo $target;?> title="Pinterest"></a>
<?php
}
if(!empty($googlePlus)){
	$target = ($googlePlus == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_googleplus" href="<?php echo $googlePlus;?>"<?php echo $target;?> title="Google Plus"></a>
<?php
}
if(!empty($tumblr)){
	$target = ($tumblr == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_tumblr" href="<?php echo $tumblr;?>"<?php echo $target;?> title="Tumblr"></a>
<?php
}
if(!empty($instagram)){
	$target = ($instagram == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_instagram" href="<?php echo $instagram;?>"<?php echo $target;?> title="Instagram"></a>
<?php
}
if(!empty($flickr)){
	$target = ($flickr == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_flickr" href="<?php echo $flickr;?>"<?php echo $target;?> title="Flickr"></a>
<?php
}
if(!empty($vine)){
	$target = ($vine == "javascript:uc()") ? NULL : ' target="_blank"';
?>
    <a class="social_icon social_icon_vine" href="<?php echo $vine;?>"<?php echo $target;?> title="Vine"></a>
<?php
}
?>
</div>

<?php
if($useModuleContainer ){
?>
</div>
<?php 
}
?>
