<?php

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

JHTML::script( 'crawler.js','modules/mod_imgscrawler/tmpl/',false);
?>

<div class="ic_marquee" id="myimgscrawler-<?php echo $imgscrawler_id; ?>">
	<?php foreach ( $images as $image ) { echo $image; } ?>
</div>
<?php

$style = "'width':'".$params->get( 'width' )."',".
		 "'height':'".$params->get( 'height' )."'";
if ( $bgcolor = $params->get( 'bgcolor' ) )
	$style .= ",'background':'".$bgcolor."'";

$doc = &JFactory::getDocument();

if (!defined('_MOD_VARGAS_ONLOAD')) {
    define ('_MOD_VARGAS_ONLOAD',1);
    $doc->addScriptDeclaration("function addLoadEvent(func) { if (typeof window.onload != 'function') { window.onload = func; } else { var oldonload = window.onload; window.onload = function() { if (oldonload) { oldonload(); } func(); } } }");
}

$doc->addScriptDeclaration("addLoadEvent(function(){marqueeInit({uniqueid: 'myimgscrawler-".$imgscrawler_id."',style:{".$style."},inc:".$params->get( 'speed' ).",mouse: '".$params->get( 'mouse' )."',direction:'".$params->get( 'direction' )."',valign:'".$params->get( 'valign' )."',moveatleast:".$params->get( 'moveatleast' ).",neutral:".$params->get( 'neutral' ).",savedirection:".$params->get( 'savedirection' )."});});");