/*********************************/
/* Author: Eric.Xu,Richie.pu     */
/* Date: 07.10.24                */
/* For TopeveryCMS PictureChange */
/* Description:
	
E.R PictureChange¤„
*/
/*********************************/


var imgWidth = 131;                        /** IMG Width 146px **/
var imgHeight = 100;                       /** IMG Height 110px  **/
var textFromHeight = 17;
var textStyle = "texttitle1";
var textLinkStyle = "texttitle1";
var buttonLineOn = "#f48909";              /** NumberLink On  **/
var buttonLineOn_font_weight = "normal";     /** NumberLink On  **/
var buttonLineOn_font_color = "#fff";
var buttonLineOff = "#58b126";             /** NumberLink Off  **/
var TimeOut = 5000;                        /** Picture Change Speed  **/
var imgUrl = new Array();
var imgLink = new Array();
var imgtext = new Array();
var imgAlt = new Array();
var adNum = 0;

document.write('<div id="focuseFrom">');

//-----------------------------------------------------------------------------
var playdivs = document.getElementById("playdivs").getElementsByTagName("ul");
for (var i = 0; i < playdivs.length; i++) {
    var j = i + 1;
    var emelis = playdivs[i].getElementsByTagName("li");
    imgUrl[j] = emelis[0].innerHTML;
    imgtext[j] = emelis[1].innerHTML;
    imgLink[j] = emelis[2].innerHTML;
    imgAlt[j] = emelis[3].innerHTML;
}
//-----------------------------------------------------------------------------

function changeimg(n) {
    adNum = n;
    window.clearInterval(theTimer);
    adNum = adNum - 1;
    nextAd();
}
function goUrl() {
    window.open(imgLink[adNum], '_blank');
}
if (navigator.appName == "Netscape") {
    function nextAd() {
        if (adNum < (imgUrl.length - 1)) adNum++;
        else adNum = 1;
        theTimer = setTimeout("nextAd()", TimeOut);
        document.getElementById("imgInit").src = imgUrl[adNum];
        document.getElementById("imgInit").alt = imgAlt[adNum];
        document.getElementById('focustext').innerHTML = imgtext[adNum];
        document.getElementById('imgLink').href = imgLink[adNum];
    }
    document.write('<div class="imgLayer_ff"><a id="imgLink" href="' + imgLink[1] + '" target=_blank class="p1"><img src="' + imgUrl[1] + '" name="imgInit" id="imgInit" width=' + imgWidth + ' height=' + imgHeight + ' border=1 alt="' + imgAlt[1] + '" class="imgClass"></a><div id="txtFrom"><span id="focustext" class="' + textStyle + '">' + imgtext[1] + '</span></div>')
    document.write('<div id="imgTitle">');
    document.write('<div id="imgTitle_down"><ul class="img_change_ul_ff">');
    for (var i = 1; i < imgUrl.length; i++) { document.write('<li><a href="javascript:changeimg(' + i + ')" class="button" title="' + imgAlt[i] + '">' + i + '</a></li>'); }
    document.write('</ul></div>');
    document.write('</div>');
    document.write('</div></div>');
    nextAd();
}
else {
    var count = 0;
    for (i = 1; i < imgUrl.length; i++) {
        if ((imgUrl[i] != "") && (imgLink[i] != "") && (imgtext[i] != "") && (imgAlt[i] != "")) {
            count++;
        } else {
            break;
        }
    }
    function playTran() {
        if (document.all)
            document.getElementById("imgInit").filters.revealTrans.play();
    }
    var key = 0;
    function nextAd() {
        if (adNum < count) adNum++;
        else adNum = 1;
        if (key == 0) {
            key = 1;
        } else if (document.all) {
            document.getElementById("imgInit").filters.revealTrans.Transition = 23;
            document.getElementById("imgInit").filters.revealTrans.apply();
            playTran();
        }
        document.getElementById("imgInit").src = imgUrl[adNum];
        document.getElementById("imgInit").alt = imgAlt[adNum];
        document.getElementById('link' + adNum).style.background = buttonLineOn;
        document.getElementById('link' + adNum).style.fontColor = buttonLineOn_font_color;
        document.getElementById('link' + adNum).style.fontWeight = buttonLineOn_font_weight;

        for (var i = 1; i <= count; i++) {
            if (i != adNum) { document.getElementById('link' + i).style.background = buttonLineOff; }
        }
        focustext.innerHTML = imgtext[adNum];
        theTimer = setTimeout("nextAd()", TimeOut);
    }
    document.write('<div class="imgLayer"><a target=_self href="javascript:goUrl()"><img style="FILTER: revealTrans(duration=1,transition=5);" src="javascript:nextAd()" width=' + imgWidth + ' height=' + imgHeight + ' border=0 vspace="0" name="imgInit" id="imgInit" class="imgClass"></a>');
    document.write('<div id="imgTitle">');
    document.write(' <div id="imgTitle_down"> <span class="trans"></span><ul>');
    for (var i = 1; i < imgUrl.length; i++) { document.write('<li><a id="link' + i + '"  href="javascript:changeimg(' + i + ')" class="button" style="cursor:hand" title="' + imgAlt[i] + '" onFocus="this.blur()">' + i + '</a></li>'); }
    document.write('</ul></div>');
    document.write('</div>');
    document.write('</div>')
    document.write('<span id="focustext" class="' + textStyle + '"></span>');

    document.write('</div>');

}
nextAd();
