var elWidth=143;
var elHeight=215;
var elMoveIncr=15;
var elOpenIncr = 10;
var elFrameRate = 60;       // was 40
var elPauseDelay = 7500;    // Maximum if elVaryPause
var elPauseMin = 3700;      // If elVaryPause
var elClosePause = 300;       // 0 for no pause
var elVaryPause = 1000;        // Vary pause based on msg length
var elMiddle = 1;            // 1 for vertical middle, 0 for top

   function RANDOM(Ind_Hist,Hist_Depth,Max_Ind)
            {// Ind_Hist    - History of generated indexes (i1,i2,...,iN)
             // Hist_Depth  - History depth (limited by Max_Ind+1)
             // Max_Ind     - Maximum value of index range (minimum: 1)

             if ((Ind_Hist!="")&&              // Not empty AND
                 (Ind_Hist.indexOf(",")==-1))  // Is not the history list
                {if ((Ind_Hist<1)||
                     (Ind_Hist>Max_Ind))
                    document.write("<BR>Specified index <FONT COLOR=Red><BLINK><B>",
                                   Ind_Hist,"</B></BLINK></FONT> is out of item array range [<B>1</B>,<B>"
                                   ,Max_Ind,"</B>]<BR><BR>",
                                   "Please select index within the valid range of [<B>1</B>,<B>"
                                   ,Max_Ind,"</B>]<BR>",
                                   "or drop <B>?<FONT COLOR=Red>",Ind_Hist,"</FONT></B> altogether to select ",
                                   "item at random.<BR>")
                 else
                    return Ind_Hist+","  // Index for specific item selection
                }
             else
                {if (Hist_Depth>Max_Ind)  // Limit history depth by maximum index
                     Hist_Depth=Max_Ind

                 H=Ind_Hist.split(",",Hist_Depth)  // Split history list into index array

                 // document.write("Input_History=",H,"     ")  // Debugging

                 // Generate next index (non-repeatable for prev of specif depth)
                 // (logic below is necessary to minimize the response time)

                 Cnt=Max_Ind            // Attempts reverse counter
                 K=Math.round(Cnt/4*3)  // Number of purely random attempts
                 L=Cnt-K                // Number of "+1" incremental attempts
                 Valid=false            // Index valid (non-repeatable) flag

                 while (!Valid)      // Repeat until valid index is generated
                       {if (Cnt>=K)  // Attempts counter is within "random" range
                           i=Math.floor(Math.random()*Max_Ind)%Max_Ind+1
                        if (Cnt<L)   // Attempts counter is within "incremental" range
                           i=((i+1)%Max_Ind)+1       // Get "+1" incremental after previous
                        Found=false
                        for (j=0;j<Hist_Depth;j++)  // Compare new index with all previously saved
                            if (Number(H[j])==i)
                               Found=true            // Index is found among previously saved
                        Valid=!Found   // New valid is not not found among previously saved
                        Cnt=Cnt-1      // Decrement the attempts reverse counter
                        if (Cnt<=0)    // Limit number of attempts to number of taglines
                           {i=Max_Ind/2
                            if (H[0]!="")
                               i=((Number(H[0])+1)%Max_Ind)+1  // Get next seq index to prev displayed
                            Valid=true
                           }
                       }

                 for (j=Hist_Depth-1;j>0;j--)  // Push history array down to make room
                     H[j]=H[j-1]               // for the newly generated index
                     
                 H[0]=i                        // Put new index at the top of history array

                 // document.write("     Output_History=",H,"<BR>")  // Debugging

                 return H.join()             // Join index history array into a comma-delimited list
                                             // and return it as a function value
                }
            }
            
var tomb;
var ittart;

function valasztbeallit()
{
        hossz=elContent.length;
        tomb=new Array(hossz);
        for (c=0;c<hossz;c++)
        {
                tomb[c]=c;
        }

        for (c=0;c<(hossz*3);c++)
        {
                random_szam1=Math.round(Math.random()*(hossz-1));
                random_szam2=Math.round(Math.random()*(hossz-1));

                temp=tomb[random_szam1];
                tomb[random_szam1]=tomb[random_szam2];
                tomb[random_szam2]=temp;
        }
        ittart=0;
}

function general()
{
        ig=tomb.length;
        if (ittart+1==tomb.length)ittart=0;
        else ittart++;

        return tomb[ittart];

}



var elUseBallistics = 0;    // 0 for linear movers (not used)


var JSMsgNS = "";
var JSMsgSeq = 0;
var hirvolt= new Array();


var bsOrgArray = new Array(); bsOrgArray[0] = ""; var elCur_i = 0; var DOMObjC; var DOMObjT; var DOMObjB; var IEObj; var NS4xObj; var BalIncr = elMoveIncr; var elBeenHere; var elMousePaused = 0; var MessagePaused = 0; var MsgPauseNow = elPauseDelay; var bsISRWaiting = 0; var elSmallestContent = 0; var elBiggestContent = 0; var elBiggestDif = 0; var elState = 0; var Globi = 0; var elMPCount = 0; var elCritical = 0; function elInitialize()
{
valasztbeallit();
elCur_i=general();
var divobj; var cpyi; if(!elBeenHere) { elBeenHere = 1; setTimeout("elInitialize()", 1100); return;}
else { for(cpyi = 0;cpyi < elContent.length;cpyi++) { bsOrgArray[cpyi] = elContent[cpyi];}
if(!elClosePause) { elClosePause = 1;}
if(!elOpenIncr) { elOpenIncr = elMoveIncr;}
elContent = JSMsgIf(elContent, JSMsgNS, JSMsgSeq); elSizeContent(); if(document.getElementById) { divobj = document.getElementById('ScrollerFrame'); divobj.style.width = elWidth + 'px'; divobj.style.height = elHeight + 'px'; divobj = document.getElementById('elWindow'); divobj.style.width = elWidth + 'px'; divobj.style.height = elHeight + 'px'; divobj = document.getElementById('elCWindow'); divobj.style.width = elWidth + 'px'; divobj.style.height = elHeight + 'px'; divobj.style.zIndex = 1; DOMObjC = divobj; divobj = document.getElementById('elTLid'); divobj.style.width = elWidth + 'px'; divobj.style.height = elHeight + 'px'; divobj.style.zIndex = 2; DOMObjT = divobj; divobj = document.getElementById('elBLid'); divobj.style.width = elWidth + 'px'; divobj.style.height = elHeight + 'px'; divobj.style.zIndex = 3; DOMObjB = divobj; DOMObjT.style.top = (elHeight*(-1)) + 'px'; DOMObjB.style.top = '0px'; DOMObjC.style.top = ((elHeight*2) * (-1)) + 'px'; moverDOM();}
else if(document.all) { ScrollerFrame.style.width = elWidth; IEObj=eval(elCWindow); IEObj.style.pixelTop=((elHeight*2) * (-1)); moverIE();}
else if(document.layers) { NS4xObj=document.elSlideWindow.document.elContentWindow; moverNS4x();}
}
}


function moverDOM()
{ var reducer, tmp, tmpT, tmpB; var TTop = parseInt(DOMObjT.style.top); var BTop = parseInt(DOMObjB.style.top); Globi++; if(!elState) { if(elMousePaused) { elMPCount++; if(elMPCount > 500) { elMousePaused = 0;}
setTimeout("moverDOM()", elFrameRate); return;}
elState = 1; setTimeout("moverDOM()", elFrameRate);}
else if(elState == 1) { tmp = elHeight / 2; tmp += elMoveIncr; tmp *= (-1); if(BTop <= tmp) { elState = 2; setTimeout("moverDOM()", elClosePause); return;}
else { tmpB = BTop - elMoveIncr; DOMObjB.style.top = tmpB + "px"; tmpT = TTop + elMoveIncr; DOMObjT.style.top = tmpT + "px"; setTimeout("moverDOM()", elFrameRate);}
}
else if(elState == 2) { if(elCritical) { setTimeout("moverDOM()", elFrameRate);}
if(elMiddle) { DOMObjC.innerHTML = '<table height="100%"><tr><td>' + elContent[elCur_i] + '<\/td><\/tr><\/table>';}
else { DOMObjC.innerHTML = elContent[elCur_i];}
elState = 3; tmpB = BTop + elOpenIncr; DOMObjB.style.top = tmpB + "px"; tmpT = TTop - elOpenIncr; DOMObjT.style.top = tmpT + "px"; setTimeout("moverDOM()", elClosePause); return;}
else if(elState == 3) { if(BTop >= 0) { elState = 0; tmp = elGetOpenDelay(); elCur_i=general();
setTimeout("moverDOM()", tmp); return;}
else { tmpB = BTop + elOpenIncr; DOMObjB.style.top = tmpB + "px"; tmpT = TTop - elOpenIncr; DOMObjT.style.top = tmpT + "px"; setTimeout("moverDOM()", elFrameRate);}
}
}
function moverIE()
{ var tmp; if(elMiddle) { IEObj.innerHTML = '<table height="100%"><tr><td>' + elContent[elCur_i] + '<\/td><\/tr><\/table>';}
else { IEObj.innerHTML = elContent[elCur_i];}
elCur_i=general();
elState = 0; tmp = elGetOpenDelay(); setTimeout("moverIE()", tmp);}
function moverNS4x()
{ NS4xObj.document.write( elContent[elCur_i] ); NS4xObj.document.close(); elCur_i=general();
elState = 0; tmp = elGetOpenDelay(); setTimeout("moverNS4x()", tmp);}
function elGetOpenDelay()
{ var tmp; var thisdif; if(elVaryPause) { thisdif = elContent[elCur_i].length - elSmallestContent; tmp = thisdif / elBiggestDif; tmp = elPauseDelay * tmp; tmp = parseInt(tmp); if(tmp < elPauseMin) { tmp = elPauseMin;}
return(tmp);}
return(elPauseDelay);}
function elSizeContent()
{ var cpyi; elSmallestContent = 5000; elBiggestContent = 0; for(cpyi = 0;cpyi < elContent.length;cpyi++) { if(elContent[cpyi].length < elSmallestContent) { elSmallestContent = elContent[cpyi].length;}
if(elContent[cpyi].length > elBiggestContent) { elBiggestContent = elContent[cpyi].length;}
}
elBiggestDif = elBiggestContent - elSmallestContent;}
function MousePause()
{ elMousePaused = 1;}
function MouseStart()
{ elMousePaused = 0;}
function RunScroller()
{ var msg; msg = ''; msg += '<div ID="ScrollerFrame" CLASS="ScrollerFrame">'; if(!document.getElementById && !document.all) { msg += '<ilayer name="elSlideWindow" width="' + elWidth + '"; height="' + elHeight + '";>\n'; msg += '<layer name="elContentWindow" width="' + elWidth + '"; onMouseover="MousePause();" onMouseout="MouseStart();">'; msg += '<\/layer>'; msg += '<\/ilayer>';}
document.write(msg); if (document.getElementById || document.all) { document.write('<div id="elWindow" class="elWindow" style="position:relative;overflow:hidden;width:' +elWidth+ ';height:' +elHeight+ ';clip:rect(0 ' +elWidth+ ' ' +elHeight+ ' 0);" onMouseover="MousePause();" onMouseout="MouseStart();">'); document.write('<div id="elTLid" class="elTLid" style="position:relative;height:0;width:' +elWidth+ ';"><\/div>'); document.write('<div id="elBLid" class="elBLid" style="position:relative;height:0;width:' +elWidth+ ';"><\/div>'); document.write('<div id="elCWindow" class="elCWindow" style="position:relative;"><\/div>'); document.write('<\/div>');}
document.write('<\/div>'); elInitialize();}
function JSMsgIf(msgAr, myNs, mySeq)
{ var TotNS,LongestNS; var NSAr = new Array(); var i,j,k,o; if(!myNs) { myNs = "";}
if(!mySeq) { mySeq = 0;}
o = msgAr.length; if(myNs) { NSAr = myNs.split(" "); TotNS = NSAr.length; LongestNS = 0; j = 0; for(i = 0;i < TotNS;i++) { j = jsmMetaMsg(NSAr[i], "MetaCount"); if(j > LongestNS) { LongestNS = j;}
}
if(!j) { return(msgAr);}
k = o; if(mySeq) { for(j = 0;j < TotNS;j++) { for(i = 0;i < LongestNS;i++) { if(jsmMetaMsg(NSAr[j],"MetaCount") <= i) { continue;}
msgAr[k] = jsmGetN(NSAr[j], "LinkTitle", i); if(!msgAr[k]) { msgAr[k] = jsmGetN(NSAr[j], "Body", i); msgAr[k] += "<BR>   -"; t = jsmGetN(NSAr[j], "Attrib",i); if(t.length > 17) { t = t.substr(0,14); t += "...";}
msgAr[k] += t;}
msgAr[k] = msgAr[k].replace(/&/g, "&"); msgAr[k] = msgAr[k].replace(/&apos;/g, "\'"); k++;}
}
}
else { for(j = 0;j < LongestNS;j++) { for(i = 0;i < TotNS;i++) { if(jsmMetaMsg(NSAr[i],"MetaCount") <= j) { continue;}
msgAr[k] = jsmGetN(NSAr[i], "LinkTitle", j); if(!msgAr[k]) { msgAr[k] = jsmGetN(NSAr[i], "Body", j); msgAr[k] += "<BR>   -"; t = jsmGetN(NSAr[i], "Attrib",j); if(t.length > 17) { t = t.substr(0,14); t += "...";}
msgAr[k] += t;}
msgAr[k] = msgAr[k].replace(/&/g, "&"); msgAr[k] = msgAr[k].replace(/&apos;/g, "\'"); k++;}
}
}
}
return(msgAr);}
function jsmGetN(ns,MsgPart,number)
{ var rv, c, er; c = "rv = " + ns + ".GetN('" + MsgPart + "'," + number + ");"; er = eval(c); return(rv);}
function jsmGet(ns,MsgPart,offset)
{ var rv, c, er; c = "rv = " + ns + ".Get('" + MsgPart + "'," + offset + ");"; er = eval(c); return(rv);}
function jsmGetDay(ns,MsgPart)
{ var rv, c, er; c = "rv = " + ns + ".GetDay('" + MsgPart + "');"; er = eval(c); return(rv);}
function jsmMetaMsg(ns,MsgPart)
{ var rv, c, er; c = "rv = " + ns + ".MetaMsg('" + MsgPart + "');"; er = eval(c); return(rv);}



