Mootools脚本在Joomla 1.5中工作,而不是2.5?

时间:2012-03-27 14:22:44

标签: joomla mootools joomla1.5 joomla1.7 joomla2.5

我有一个我需要在Joomla 2.5中使用的脚本,但它似乎不适用于新版本?我有什么选择?

以下是该文件脚本的完整代码。

echo "<script language=\"javascript\" type=\"text/javascript\" src=\"".JURI::base()."/modules/mod_imageshowcase/mootools-release-1.11.js\"></script>\n";
}
echo 
    "<script language=\"javascript\" type=\"text/javascript\">\n".
    "var praiseShowStartImage_".$moduleInstanceId." = '".$startImage."';\n".
    "var praiseShowImageOrder_".$moduleInstanceId." = '".$imageOrder."';\n".
    "var praiseShowPingPong_".$moduleInstanceId." = ".$pingPong.";\n".
    "var praiseShowImageCount_".$moduleInstanceId." = ".$index.";\n".
    "var praiseShowFxs_".$moduleInstanceId." = new Array();\n".
    "var praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "var praiseShowPlayCount_".$moduleInstanceId." = ".$playCount.";\n".
    "var praiseShowCurrentPlayCount_".$moduleInstanceId." = 0;\n".
    "if(praiseShowStartImage_".$moduleInstanceId." == 'random')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "}\n".
    "else if(praiseShowStartImage_".$moduleInstanceId." == 'last_seen')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Cookie.get('praiseShowLastIndex_".$moduleInstanceId."');\n".
    "   if(!praiseShowCurrentImageIndex_".$moduleInstanceId.") { praiseShowCurrentImageIndex_".$moduleInstanceId." = 0; }\n".
    "}\n".
    "else if(praiseShowImageOrder_".$moduleInstanceId." == 'backward')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "}\n".
    "else\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = 0;\n".
    "}\n".
    "window.addEvent('domready',function() {\n".
    $domreadyScript.
    "});\n".
    "window.addEvent('load',function() {\n".
    "   var coords = $('".$containerTagId."').getCoordinates();\n".
    "   var elImage;\n".
    "   var elImageCoords;\n".
    "   $$('.mod_imageshowcase_div_".$moduleInstanceId."').each(function(el, i)\n".
    "   {\n".
    "       elImage = el.getElement('.mod_imageshowcase_image');\n";

if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_height")
{
    echo "          elImage.setStyle('height', coords.height + 'px');\n";
}
if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_width")
{
    echo "          elImage.setStyle('width', coords.width + 'px');\n";
}

if($imageScaleMode != "fit_both")
{
    switch($imageVerticalAlign)
    {
        case "top":
            $jsVerticalAlignText = "0";
            break;
        case "center":
            $jsVerticalAlignText = "(coords.height/2 - elImageCoords.height/2)";
            break;
        case "bottom":
        default:
            $jsVerticalAlignText = "(coords.height - elImageCoords.height)";
            break;
    }
    switch($imageHorizontalAlign)
    {
        case "left":
            $jsHorizontalAlignText = "0";
            break;
        case "center":
            $jsHorizontalAlignText = "(coords.width/2 - elImageCoords.width/2)";
            break;
        case "right":
        default:
            $jsHorizontalAlignText = "(coords.width - elImageCoords.width)";
            break;
    }
    echo
        "       elImageCoords = elImage.getCoordinates();\n".
        "       elImage.setStyle('left', ".$jsHorizontalAlignText." + 'px');\n".
        "       elImage.setStyle('top', ".$jsVerticalAlignText." + 'px');\n";
}
echo 
    "       if(i == praiseShowCurrentImageIndex_".$moduleInstanceId.") { el.setStyle('opacity', 1); }\n".
    "       else { el.setStyle('opacity', 0); }\n".
    "       praiseShowFxs_".$moduleInstanceId."[i] = new Fx.Style(el, 'opacity', {\n".
    "           wait: false,\n".
    "           duration: " . $transition_time . ",\n".
    "           transition: Fx.Transitions.Quart.easeInOut\n".
    "       });\n".
    "   });\n".
    "   switchImage_".$moduleInstanceId.".periodical(" . ($delay_time + $transition_time) . ");\n".
    "});\n".
    "var switchImage_".$moduleInstanceId." = function()\n".
    "{\n".
    "   var nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "   switch(praiseShowImageOrder_".$moduleInstanceId.")\n".
    "   {\n".
    "       case 'random':\n".
    "           while(nextImageIndex == praiseShowCurrentImageIndex_".$moduleInstanceId." && praiseShowImageCount_".$moduleInstanceId." > 0)\n".
    "           {\n".
    "               nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "           }\n".
    "           break;\n".
    "       case 'backward':\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." - 1;\n".
    "           if(nextImageIndex < 0) {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'forward';\n".
    "                   nextImageIndex = 1;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "       default:\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." + 1;\n".
    "           if(nextImageIndex >= praiseShowImageCount_".$moduleInstanceId.") {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'backward';\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 2;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = 0;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "   }\n".
    "   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "   if(praiseShowPlayCount_".$moduleInstanceId." == 0 || praiseShowCurrentPlayCount_".$moduleInstanceId." < praiseShowPlayCount_".$moduleInstanceId."*praiseShowImageCount_".$moduleInstanceId.") {\n".
    "       praiseShowFxs_".$moduleInstanceId."[praiseShowCurrentImageIndex_".$moduleInstanceId."].start(1, 0);\n".
    "       praiseShowFxs_".$moduleInstanceId."[nextImageIndex].start(0, 1);\n".
    "       praiseShowCurrentImageIndex_".$moduleInstanceId." = nextImageIndex;\n".
    "       Cookie.set('praiseShowLastIndex_".$moduleInstanceId."', praiseShowCurrentImageIndex_".$moduleInstanceId.");\n".
    "   }\n".
    "}\n".
    "</script>\n";

查看来源:

<body id="page_bg" class="color_blue bg_blue width_fmax">
<a name="up" id="up"></a>
<div class="center" align="center">
    <div id="wrapper">
        <div id="wrapper_r">
            <div id="header">
                <div id="header_l">
                    <div id="header_r">
                        <div id="logo"></div>

                    </div>
                </div>
            </div>

            <div id="tabarea">
                <div id="tabarea_l">
                    <div id="tabarea_r">
                        <div id="tabmenu">
                        <table cellpadding="0" cellspacing="0" class="pill">
                            <tr>
                                <td class="pill_l">&nbsp;</td>
                                <td class="pill_m">
                                <div id="pillmenu">

                                </div>
                                </td>
                                <td class="pill_r">&nbsp;</td>
                            </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div id="search">

            </div>

            <div id="pathway">
                <link href="http://localhost/test//modules/mod_imageshowcase/mod_imageshowcase.css" rel="stylesheet" type="text/css" />
<div style="" class="mod_imageshowcase_container" id="mod_imageshowcase_containerTagId_16">
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_160" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_160" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/CMS-Tactics-Inc-logo.gif" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_161" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_161" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/beeheard-logo.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_162" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_162" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/beeheardlite-logo.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_163" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_163" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/cookiescrumbslogo3.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_164" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_164" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/full_accesslevel-mid.jpg" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_165" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_165" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/moo_menu_logo.jpg" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_166" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_166" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/playlistgen_dropdown.jpg" title="" />
<br />
</div>
</div>
<script language="javascript" type="text/javascript">
var praiseShowStartImage_16 = 'first';
var praiseShowImageOrder_16 = 'forward';
var praiseShowPingPong_16 = 0;
var praiseShowImageCount_16 = 7;
var praiseShowFxs_16 = new Array();
var praiseShowCurrentImageIndex_16;
var praiseShowPlayCount_16 = 0;
var praiseShowCurrentPlayCount_16 = 0;
if(praiseShowStartImage_16 == 'random')
{
    praiseShowCurrentImageIndex_16 = Math.floor(Math.random()*praiseShowImageCount_16);
}
else if(praiseShowStartImage_16 == 'last_seen')
{
    praiseShowCurrentImageIndex_16 = Cookie.get('praiseShowLastIndex_16');
    if(!praiseShowCurrentImageIndex_16) { praiseShowCurrentImageIndex_16 = 0; }
}
else if(praiseShowImageOrder_16 == 'backward')
{
    praiseShowCurrentImageIndex_16 = praiseShowImageCount_16 - 1;
}
else
{
    praiseShowCurrentImageIndex_16 = 0;
}
window.addEvent('domready',function() {
});
window.addEvent('load',function() {
    var coords = $('mod_imageshowcase_containerTagId_16').getCoordinates();
    var elImage;
    var elImageCoords;
    $$('.mod_imageshowcase_div_16').each(function(el, i)
    {
        elImage = el.getElement('.mod_imageshowcase_image');
        elImageCoords = elImage.getCoordinates();
        elImage.setStyle('left', (coords.width/2 - elImageCoords.width/2) + 'px');
        elImage.setStyle('top', (coords.height/2 - elImageCoords.height/2) + 'px');
        if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }
        praiseShowFxs_16[i] = new Fx.Style(el, 'opacity', {
            wait: false,
            duration: 1500,
            transition: Fx.Transitions.Quart.easeInOut
        });
    });
    switchImage_16.periodical(6500);
});
var switchImage_16 = function()
{
    var nextImageIndex = praiseShowCurrentImageIndex_16;
    switch(praiseShowImageOrder_16)
    {
        case 'random':
            while(nextImageIndex == praiseShowCurrentImageIndex_16 && praiseShowImageCount_16 > 0)
            {
                nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_16);
            }
            break;
        case 'backward':
            nextImageIndex = praiseShowCurrentImageIndex_16 - 1;
            if(nextImageIndex < 0) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'forward';
                    nextImageIndex = 1;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = praiseShowImageCount_16 - 1;
                }
            }
            break;
        default:
            nextImageIndex = praiseShowCurrentImageIndex_16 + 1;
            if(nextImageIndex >= praiseShowImageCount_16) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'backward';
                    nextImageIndex = praiseShowImageCount_16 - 2;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = 0;
                }
            }
            break;
    }
    praiseShowCurrentPlayCount_16++;
    if(praiseShowPlayCount_16 == 0 || praiseShowCurrentPlayCount_16 < praiseShowPlayCount_16*praiseShowImageCount_16) {
        praiseShowFxs_16[praiseShowCurrentImageIndex_16].start(1, 0);
        praiseShowFxs_16[nextImageIndex].start(0, 1);
        praiseShowCurrentImageIndex_16 = nextImageIndex;
        Cookie.set('praiseShowLastIndex_16', praiseShowCurrentImageIndex_16);
    }
}
</script>


            </div>

            <div class="clr"></div>

            <div id="whitebox">
                <div id="whitebox_t">
                    <div id="whitebox_tl">
                        <div id="whitebox_tr"></div>
                    </div>
                </div>

                <div id="whitebox_m">
                    <div id="area">


                        <div id="leftcolumn">
                                                            <div class="module_menu">
            <div>
                <div>
                    <div>
                                                    <h3>Main Menu</h3>
                                            <ul class="menu"><li id="current" class="active item1"><a href="http://localhost/test/"><span>Home</span></a></li></ul>                 </div>
                </div>
            </div>
        </div>

                                                </div>

                                                <div id="maincolumn">

                            <table class="nopad">
                                <tr valign="top">
                                    <td>
                                        <div class="componentheading">
    Test</div>
<table class="blog" cellpadding="0" cellspacing="0">
<tr>
    <td valign="top">
                </td>
</tr>


</table>


                                    </td>
                                                                    </tr>
                            </table>

                        </div>
                        <div class="clr"></div>
                    </div>
                    <div class="clr"></div>
                </div>

                <div id="whitebox_b">
                    <div id="whitebox_bl">
                        <div id="whitebox_br"></div>
                    </div>
                </div>
            </div>

            <div id="footerspacer"></div>
        </div>

        <div id="footer">
            <div id="footer_l">
                <div id="footer_r">
                    <p id="syndicate">

                    </p>
                    <p id="power_by">
                        Powered by <a href="http://www.joomla.org">Joomla!</a>.
                        valid <a href="http://validator.w3.org/check/referer">XHTML</a> and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>


</body>

仅渲染脚本:

<script language="javascript" type="text/javascript">
var praiseShowStartImage_16 = 'first';
var praiseShowImageOrder_16 = 'forward';
var praiseShowPingPong_16 = 0;
var praiseShowImageCount_16 = 7;
var praiseShowFxs_16 = new Array();
var praiseShowCurrentImageIndex_16;
var praiseShowPlayCount_16 = 0;
var praiseShowCurrentPlayCount_16 = 0;
if(praiseShowStartImage_16 == 'random')
{
    praiseShowCurrentImageIndex_16 = Math.floor(Math.random()*praiseShowImageCount_16);
}
else if(praiseShowStartImage_16 == 'last_seen')
{
    praiseShowCurrentImageIndex_16 = Cookie.get('praiseShowLastIndex_16');
    if(!praiseShowCurrentImageIndex_16) { praiseShowCurrentImageIndex_16 = 0; }
}
else if(praiseShowImageOrder_16 == 'backward')
{
    praiseShowCurrentImageIndex_16 = praiseShowImageCount_16 - 1;
}
else
{
    praiseShowCurrentImageIndex_16 = 0;
}
window.addEvent('domready',function() {
});
window.addEvent('load',function() {
    var coords = $('mod_imageshowcase_containerTagId_16').getCoordinates();
    var elImage;
    var elImageCoords;
    $$('.mod_imageshowcase_div_16').each(function(el, i)
    {
        elImage = el.getElement('.mod_imageshowcase_image');
        elImageCoords = elImage.getCoordinates();
        elImage.setStyle('left', (coords.width/2 - elImageCoords.width/2) + 'px');
        elImage.setStyle('top', (coords.height/2 - elImageCoords.height/2) + 'px');
        if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }
        praiseShowFxs_16[i] = new Fx.Style(el, 'opacity', {
            wait: false,
            duration: 1500,
            transition: Fx.Transitions.Quart.easeInOut
        });
    });
    switchImage_16.periodical(6500);
});
var switchImage_16 = function()
{
    var nextImageIndex = praiseShowCurrentImageIndex_16;
    switch(praiseShowImageOrder_16)
    {
        case 'random':
            while(nextImageIndex == praiseShowCurrentImageIndex_16 && praiseShowImageCount_16 > 0)
            {
                nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_16);
            }
            break;
        case 'backward':
            nextImageIndex = praiseShowCurrentImageIndex_16 - 1;
            if(nextImageIndex < 0) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'forward';
                    nextImageIndex = 1;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = praiseShowImageCount_16 - 1;
                }
            }
            break;
        default:
            nextImageIndex = praiseShowCurrentImageIndex_16 + 1;
            if(nextImageIndex >= praiseShowImageCount_16) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'backward';
                    nextImageIndex = praiseShowImageCount_16 - 2;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = 0;
                }
            }
            break;
    }
    praiseShowCurrentPlayCount_16++;
    if(praiseShowPlayCount_16 == 0 || praiseShowCurrentPlayCount_16 < praiseShowPlayCount_16*praiseShowImageCount_16) {
        praiseShowFxs_16[praiseShowCurrentImageIndex_16].start(1, 0);
        praiseShowFxs_16[nextImageIndex].start(0, 1);
        praiseShowCurrentImageIndex_16 = nextImageIndex;
        Cookie.set('praiseShowLastIndex_16', praiseShowCurrentImageIndex_16);
    }
}
</script>

我相信它目前在mootools v1.11上。 感谢。

2 个答案:

答案 0 :(得分:4)

看起来Joomla 2.5正在使用mooTools 1.4

Joomla 1.5正在使用1.12

您唯一的选择是手动将mootools 1.12代码更新为mootools 1.4标准。

网上有很多资源可以帮助您。

您的代码链接是否有效?

此链接将帮助您从1.1移动到1.2(此时您可以下载并使用moo兼容层[不推荐]): https://github.com/mootools/mootools-core/wiki/Conversion-from-1.11-to-1.2-

此链接将从1.2到1.3: https://github.com/mootools/mootools-core/wiki/Upgrade-from-1.2-to-1.3

此时你应该是好的MooTools 1.4添加核心改进,最显着的是选择器引擎升级和事件委托(以前只能在更多中找到)

请参阅:http://mootools.net/blog/2011/09/10/mootools-1-4-0/

希望这有帮助!

答案 1 :(得分:4)

好的第一件事就是这样:

new Fx.Style(el, 'opacity', {
    wait: false,
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut
});

更改为:

new Fx.Tween(el, {
    link: 'cancel',
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut,
    property: 'opacity'
}).start(el.getStyle('opacity').toInt()?0:1);

回复结果和萤火虫(或等效物)中的任何错误;

更新: 实际上比这一行更好

el.getStyle('opacity').toInt()?0:1

也会改变:

if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }

if(i == praiseShowCurrentImageIndex_16) {
    var targetOpacity = 1;
    el.setStyle('opacity', targetOpacity);
} else {
    var targetOpacity = 0;
    el.setStyle('opacity', targetOpacity);
}

on on start function pass:

new Fx.Tween(el, {
    link: 'cancel',
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut,
    property: 'opacity'
}).start(targetOpacity);

更新了PHP(顶级测试可能不是轻微的错误)

    echo 
        "<script language=\"javascript\" type=\"text/javascript\">\n".
        "var praiseShowStartImage_".$moduleInstanceId." = '".$startImage."';\n".
        "var praiseShowImageOrder_".$moduleInstanceId." = '".$imageOrder."';\n".
        "var praiseShowPingPong_".$moduleInstanceId." = ".$pingPong.";\n".
        "var praiseShowImageCount_".$moduleInstanceId." = ".$index.";\n".
        "var praiseShowFxs_".$moduleInstanceId." = new Array();\n".
        "var praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
        "var praiseShowPlayCount_".$moduleInstanceId." = ".$playCount.";\n".
        "var praiseShowCurrentPlayCount_".$moduleInstanceId." = 0;\n".
        "if(praiseShowStartImage_".$moduleInstanceId." == 'random')\n".
        "{\n".
        "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
        "}\n".
        "else if(praiseShowStartImage_".$moduleInstanceId." == 'last_seen')\n".
        "{\n".
        "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Cookie.get('praiseShowLastIndex_".$moduleInstanceId."');\n".
        "   if(!praiseShowCurrentImageIndex_".$moduleInstanceId.") { praiseShowCurrentImageIndex_".$moduleInstanceId." = 0; }\n".
        "}\n".
    "else if(praiseShowImageOrder_".$moduleInstanceId." == 'backward')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "}\n".
    "else\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = 0;\n".
    "}\n".
    "window.addEvent('domready',function() {\n".
    $domreadyScript.
    "});\n".
    "window.addEvent('load',function() {\n".
    "   var coords = $('".$containerTagId."').getCoordinates();\n".
    "   var elImage;\n".
    "   var elImageCoords;\n".
    "   $$('.mod_imageshowcase_div_".$moduleInstanceId."').each(function(el, i)\n".
    "   {\n".
    "       elImage = el.getElement('.mod_imageshowcase_image');\n";

    if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_height")
    {
    echo "          elImage.setStyle('height', coords.height + 'px');\n";
    }
    if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_width")
    {
    echo "          elImage.setStyle('width', coords.width + 'px');\n";
    }

    if($imageScaleMode != "fit_both")
    {
    switch($imageVerticalAlign)
    {
    case "top":
    $jsVerticalAlignText = "0";
    break;
    case "center":
    $jsVerticalAlignText = "(coords.height/2 - elImageCoords.height/2)";
    break;
    case "bottom":
    default:
    $jsVerticalAlignText = "(coords.height - elImageCoords.height)";
    break;
    }
    switch($imageHorizontalAlign)
    {
    case "left":
    $jsHorizontalAlignText = "0";
    break;
    case "center":
    $jsHorizontalAlignText = "(coords.width/2 - elImageCoords.width/2)";
    break;
    case "right":
    default:
    $jsHorizontalAlignText = "(coords.width - elImageCoords.width)";
    break;
    }
    echo
    "       elImageCoords = elImage.getCoordinates();\n".
    "       elImage.setStyle('left', ".$jsHorizontalAlignText." + 'px');\n".
    "       elImage.setStyle('top', ".$jsVerticalAlignText." + 'px');\n";
    }
    echo 
    "       if(i == praiseShowCurrentImageIndex_".$moduleInstanceId.") { var targetOpacity = 1; el.setStyle('opacity', targetOpacity); }\n".
    "       else { var targetOpacity = 0; el.setStyle('opacity', targetOpacit); }\n".
    "       praiseShowFxs_".$moduleInstanceId."[i] = Fx.Tween(el, {\n".
    "           link: 'cancel',\n".
    "           duration: " . $transition_time . ",\n".
    "           transition: Fx.Transitions.Quart.easeInOut,\n".
    "           property: 'opacity'\n".
    "       }).start(targetOpacity);\n".
    "   });\n".
    "   switchImage_".$moduleInstanceId.".periodical(" . ($delay_time + $transition_time) . ");\n".
    "});\n".
    "var switchImage_".$moduleInstanceId." = function()\n".
    "{\n".
    "   var nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "   switch(praiseShowImageOrder_".$moduleInstanceId.")\n".
    "   {\n".
    "       case 'random':\n".
    "           while(nextImageIndex == praiseShowCurrentImageIndex_".$moduleInstanceId." && praiseShowImageCount_".$moduleInstanceId." > 0)\n".
    "           {\n".
    "               nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "           }\n".
    "           break;\n".
    "       case 'backward':\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." - 1;\n".
    "           if(nextImageIndex < 0) {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'forward';\n".
    "                   nextImageIndex = 1;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "       default:\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." + 1;\n".
    "           if(nextImageIndex >= praiseShowImageCount_".$moduleInstanceId.") {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'backward';\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 2;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = 0;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "   }\n".
    "   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "   if(praiseShowPlayCount_".$moduleInstanceId." == 0 || praiseShowCurrentPlayCount_".$moduleInstanceId." < praiseShowPlayCount_".$moduleInstanceId."*praiseShowImageCount_".$moduleInstanceId.") {\n".
    "       praiseShowFxs_".$moduleInstanceId."[praiseShowCurrentImageIndex_".$moduleInstanceId."].start(1, 0);\n".
    "       praiseShowFxs_".$moduleInstanceId."[nextImageIndex].start(0, 1);\n".
    "       praiseShowCurrentImageIndex_".$moduleInstanceId." = nextImageIndex;\n".
    "       Cookie.set('praiseShowLastIndex_".$moduleInstanceId."', praiseShowCurrentImageIndex_".$moduleInstanceId.");\n".
    "   }\n".
    "}\n".
    "</script>\n";