<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$title = $params->get('title');
$path = $params->get('image');
$height = intval($params->get('height'));
$text = $params->get('fulltext');
$link = $params->get('link');

$color = $params->get('textcolor');
if ($color) $color = " color:#$color;";
$bgcolor = $params->get('bgcolor');
if ($bgcolor) $bgcolor = " background-color:#$bgcolor;";
$trans = intval($params->get('transparent'));
if (!$trans) $trans = 100;
//~ if ($trans) $trans = " opacity:".($trans/100)."; filter:alpha(opacity=".$trans.");";
//~ else $trans = "";
$xheight = intval($params->get('expandheight'));

$path = JURI::base() . "/" . $path;

global $ja_slwi_id;
if (!defined( '_MOD_JA_SLWI')) {
	echo '
	<script type="text/javascript" src="'.JURI::base().'/modules/mod_ja_slwi/ja_slwi/ja_slwi.js"></script>
	<script type="text/javascript">
		jaSLWI.expandH = '.$xheight.';
	</script>';
	define( '_MOD_JA_SLWI', 1 );
	$ja_slwi_id = 0;
}
echo '
<div '.($link ? 'onclick="location.href=\''.$link.'\'"' : '').' class="ja-slwi" style="position: relative; height: '.$height.'px; margin: 0; padding: 0;background:url('.$path.') no-repeat;'.($link ? ' cursor: pointer;' : '').'">
	<div class="ja-slwi-container" style="position: absolute; z-index: 1; bottom: 2px; left: 0;">
		<p>&nbsp;</p>
		<div class="ja-slwi-text" style="position:relative;height: 0; overflow: hidden;">
		<div id="ja-slwi-textbg'.(++$ja_slwi_id).'" style="position: absolute; top:0;left:0;height:'.$xheight.'px;width:100%;'.$bgcolor.'">
		<script type="text/javascript">
			textbg = document.getElementById("ja-slwi-textbg'.($ja_slwi_id).'");
			textbg.style.opacity = '.($trans/100).';
			textbg.style.filter = \'alpha(opacity='.$trans.')\';
		</script>
		</div>
		<div style="position: absolute; top:0;left:0;height:'.$xheight.'px;'.$color.'"><h3>'.$title.'</h3>'.$text.'</div>
		</div>
	</div>
</div>';
?>
