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

$alphabank = ($moduleParameters['alphabank'] == "__EMPTY__" || empty($moduleParameters['alphabank'])) ? null : (int)$moduleParameters['alphabank'];
$useShadowToWhite = ($moduleParameters['useShadowToWhite'] == "__EMPTY__" || empty($moduleParameters['useShadowToWhite'])) ? null : (int)$moduleParameters['useShadowToWhite'];
$payPal = ($moduleParameters['payPal'] == "__EMPTY__" || empty($moduleParameters['payPal'])) ? null : (int)$moduleParameters['payPal'];
$masterCard = ($moduleParameters['masterCard'] == "__EMPTY__" || empty($moduleParameters['masterCard'])) ? null : (int)$moduleParameters['masterCard'];
$visa = ($moduleParameters['visa'] == "__EMPTY__" || empty($moduleParameters['visa'])) ? null : (int)$moduleParameters['visa'];
$visaElectron = ($moduleParameters['visaElectron'] == "__EMPTY__" || empty($moduleParameters['visaElectron'])) ? null : (int)$moduleParameters['visaElectron'];
$maestro = ($moduleParameters['maestro'] == "__EMPTY__" || empty($moduleParameters['maestro'])) ? null : (int)$moduleParameters['maestro'];
$americanExpress = ($moduleParameters['americanExpress'] == "__EMPTY__" || empty($moduleParameters['americanExpress'])) ? null : (int)$moduleParameters['americanExpress'];
$discover = ($moduleParameters['discover'] == "__EMPTY__" || empty($moduleParameters['discover'])) ? null : (int)$moduleParameters['discover'];
$toCheckout = ($moduleParameters['toCheckout'] == "__EMPTY__" || empty($moduleParameters['toCheckout'])) ? null : (int)$moduleParameters['toCheckout'];


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
        }
        ?>
    </style>

    <div id="cc_icons">
        <?php
        if (!empty($payPal)) {
            ?>
            <div class="cc_icon cc_icon_payPal"></div>
            <?php
        }
        if (!empty($masterCard)) {
            ?>
            <div class="cc_icon cc_icon_masterCard"></div>
            <?php
        }
        if (!empty($visa)) {
            ?>
            <div class="cc_icon cc_icon_visa"></div>
            <?php
        }
        if (!empty($visaElectron)) {
            ?>
            <div class="cc_icon cc_icon_visaElectron"></div>
            <?php
        }
        if (!empty($maestro)) {
            ?>
            <div class="cc_icon cc_icon_maestro"></div>
            <?php
        }
        if (!empty($americanExpress)) {
            ?>
            <div class="cc_icon cc_icon_americanExpress"></div>
            <?php
        }
        if (!empty($discover)) {
            ?>
            <div class="cc_icon cc_icon_discover"></div>
            <?php
        }
        if (!empty($toCheckout)) {
            ?>
            <div class="cc_icon cc_icon_toCheckout"></div>
            <?php
        }
        if (!empty($alphabank)) {
            ?>
            <div class="cc_icons_alphabank"></div>
            <style>
                #cc {
                    background-color: white !important;
                    border-top: none !important;
                }

                #copyright_text a {
                    color: #191919 !important;
                }

                #copyright_text a:hover {
                    color: #191919 !important;
                }

                .shade {
                    height: 10px;
                }

                .shade1 {
                    background-color: #323232;
                }

                .shade2 {
                    background-color: #565656;
                }

                .shade3 {
                    background-color: #807f7f;
                }

                .shade4 {
                    background-color: #aaa9a9;
                }

                .shade5 {
                    background-color: #d7d6d6;
                }
            </style>
        <?php
        if ($useShadowToWhite){
        ?>
            <script>
                jQuery().ready(function () {
                    <?php
                    for($n = 1; $n <= 5; $n++){
                    ?>
                    var elm = '<div class="shade shade<?php echo $n;?>"></div>';
                    $('#cc').before(elm);
                    <?php
                    }
                    ?>
                });
            </script>
            <?php
        }
        }
        ?>
    </div>
    <?php
    if ($useModuleContainer){
    ?>
</div>
<?php
}
?>
