<?php
/**
 * @package Module engineera anibanner3 for Joomla! 1.5
 * @author engineera
 * @Copyright(C) 2010- EngineEra
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined( '_JEXEC' ) or die( 'Restricted access' );

$bannerWidth                   = intval($params->get( 'bannerWidth', 912 ));
$bannerHeight                  = intval($params->get( 'bannerHeight', 700 ));
$backgroundColor         = trim($params->get( 'backgroundColor', '#FFFFFF' ));
$wmode                 = trim($params->get( 'wmode', 'window' ));


$imageURL        = trim($params->get('imageURL', '' )); 
$imageURL_arr    = explode("\n",$imageURL);

$imageLink        = trim($params->get('imageLink', '' )); 
$imageLink_arr    = explode("\n",$imageLink);

$textPosition        = trim($params->get('textPosition', '' )); 
$textPosition_arr    = explode("\n",$textPosition);

$message1        = trim($params->get('message1', '' )); 
$message1_arr    = explode("\n",$message1);

$message2        = trim($params->get('message2', '' )); 
$message2_arr    = explode("\n",$message2);

$message3        = trim($params->get('message3', '' )); 
$message3_arr    = explode("\n",$message3);

$message4        = trim($params->get('message4', '' )); 
$message4_arr    = explode("\n",$message4);

$message5        = trim($params->get('message5', '' )); 
$message5_arr    = explode("\n",$message5);


$xml_data_data = '<?xml version="1.0" encoding="utf-8"?>
<data>
	<channel>
';

foreach ($imageURL_arr as $ik=>$curr_isrc) {
	$xml_data_data .= '		<item>
			<imageURL>' . trim($imageURL_arr[$ik]) . '</imageURL>
			<imageLink>' . trim($imageLink_arr[$ik]) . '</imageLink>
			<textPosition>' . trim($textPosition_arr[$ik]) . '</textPosition>
			<message1>' . trim($message1_arr[$ik]) . '</message1>
			<message2>' . trim($message2_arr[$ik]) . '</message2>
			<message3>' . trim($message3_arr[$ik]) . '</message3>
			<message4>' . trim($message4_arr[$ik]) . '</message4>
			<message5>' . trim($message5_arr[$ik]) . '</message5>			
		</item>
';
}

$animationDuration	= trim($params->get( 'animationDuration', '' ));
$textingHeight	= trim($params->get( 'textingHeight', '' ));
$textingColor	= trim($params->get( 'textingColor', '' ));
$stripeY	= trim($params->get( 'stripeY', '' ));
$stripeAlpha	= trim($params->get( 'stripeAlpha', '' ));
$stripeColor	= trim($params->get( 'stripeColor', '' ));
$paysi	= trim($params->get( 'paysi', '' ));
$applyShadowOnContainer	= trim($params->get( 'applyShadowOnContainer', '' ));








$xml_data_data .= '
	</channel>
	<config>
		<animationDuration>' . $animationDuration .'</animationDuration>	
		<textingHeight>' . $textingHeight .'</textingHeight>	
		<textingColor>' . $textingColor .'</textingColor>	
		<stripeY>' . $stripeY .'</stripeY>	
		<stripeAlpha>' . $stripeAlpha .'</stripeAlpha>	
		<stripeColor>' . $stripeColor .'</stripeColor>	
		<paysi>' . $paysi .'</paysi>	
		<applyShadowOnContainer>' . $applyShadowOnContainer .'</applyShadowOnContainer>	
	</config>
</data>';

$module_path = dirname(__FILE__).DS;
$xml_data_filename = $module_path.'data.xml';
$xml_prodgallery_file = fopen($xml_data_filename,'w');
fwrite($xml_prodgallery_file, $xml_data_data);
fclose($xml_prodgallery_file);

?>
<div align="center">

<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="<?php echo JURI::root()?>modules/mod_engineera_anibanner3/AC_RunActiveContent.js" language="javascript"></script>
<script language="javascript">
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
			AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '<?php echo $bannerWidth;?>',
			'height', '<?php echo $bannerHeight; ?>',
			'src', '<?php echo JURI::root()?>modules/mod_engineera_anibanner3/slideshow',
			'quality', 'high',
			'pluginspage', 'http://www.adobe.com/go/getflashplayer_cn',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noscale',
			'wmode', '<?php echo $wmode;?>',
			'devicefont', 'false',
			'flashvars','url=<?php echo JURI::root()?>modules/mod_engineera_anibanner3/data.xml',
			'id', 'AnimatedLines',
			'bgcolor', '<?php echo $backgroundColor; ?>',
			'name', 'AnimatedLines',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '<?php echo JURI::root()?>modules/mod_engineera_anibanner3/slideshow',
			'salign', 'lt'
			); //end AC code
	}
</script>

<noscript>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="<?php echo $bannerWidth;?>" height="<?php echo $bannerHeight; ?>" id="AnimatedLines" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="flashvars" value="url=modules/mod_engineera_anibanner3/data.xml"/>
	<param name="movie" value="<?php echo JURI::root()?>modules/mod_engineera_anibanner3/slideshow.swf" />
	<param name="quality" value="high" />
	<param name="bgcolor" value="<?php echo $backgroundColor; ?>" />	
	<embed src="<?php echo JURI::root()?>modules/mod_engineera_anibanner3/slideshow.swf" flashvars="url=modules/mod_engineera_anibanner3/data.xml" quality="high" bgcolor="<?php echo $backgroundColor; ?>" width="<?php echo $bannerWidth;?>" height="<?php echo $bannerHeight; ?>" name="AnimatedLines" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_cn" />
	</object>
</noscript>
</div>