//¾Æ·¡¿¡¼­ À§·Î ÀÌµ¿ÇÏ´Â scroll
var scrollText = new Array();         //³»¿ë
var scrollWait  = 1;
var scrollPause = 1;                  //¸¶¿ì½º À§Ä¡ »óÅÂ [Mouseover=0, Mouseout=1]
var scrollFlag  = true;
var scrollSpeed = 1;                  //ÀÌµ¿¹üÀ§(scrollÀÌµ¿ ¼Óµµ)
var scrollDelay = 6000;	              //³»¿ëÀ» º¸¿©ÁØÈÄ ¸ØÃß´Â ½Ã°£
var scrollHeight= 23;                 //³»¿ë À§Ä¡
var scrollRows  = 5;                            //½ºÅ©·Ñ¿¡ º¸¿©ÁÙ rows


var scrollAmount= scrollHeight * scrollRows;    //½ºÅ©·Ñ»çÀÌÁî
var scrollTemp  = 0;

function startScroll()
{
    for (var i=0; i<scrollText.length; i++)
    {
        insertText(i);
    }

    if(scrollText.length > scrollRows)
    {
        window.setTimeout("loopScroll();", scrollDelay);
    }
}

//text overflow => aaa... text-overflow : ellipsis; overflow : hidden
function insertText(i)
{
    var scrollPos = scrollHeight * i - 2; //³»¿ë À§Ä¡
    var arr = scrollText[i].split("|");

    var mtag = "<img src=\"/images/main/" + ((arr[1] == '1') ? "up.gif": "down.gif") + "\" width=\"9\" height=\"8\" style=\"vertical-align:-1px\">";
    if(arr[1] == "")
    {
        mtag = "";
    }

    var htmlStr = "";
    htmlStr =  "<div style=\"position:absolute; height: 27px; width:400px; top: " + scrollPos + "px;z-index:8;\" id=\"scrollText" + i + "\">\n";
    htmlStr += "<div align='left'   style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:140px;left:14px;\">" + arr[0] + "</div>\n";
//    htmlStr += "<div align='center' style=\"position:absolute; width:24px;left:88px;\">"+stag+"</div>\n";
    htmlStr += "<div align='right'  style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:70px;left:95px;\">" + arr[3] + "</div>\n"
    htmlStr += "<div align='center' style=\"position:absolute; width:8px;left:182px;\">"+mtag+"</div>\n";
    htmlStr += "<div align='right'  style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:40px;left:173px;\">" + arr[2] + "</div>\n"
    htmlStr += "<div align='right'  style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:60px;left:198px;\">" + arr[4] + "</div>\n"
    htmlStr += "<div align='right'  style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:60px;left:247px;\">" + arr[5] + "</div>\n"
    htmlStr += "<div align='right'  style=\"text-overflow:ellipsis;overflow:hidden;position:absolute; width:60px;left:285px;\">" + arr[6] + "</div>\n"
    htmlStr += "</div>\n";
    document.writeln(htmlStr);
}

function loopScroll() {
  if (scrollPause && scrollFlag) {
    for (var i = 0; i < scrollText.length; i++) {
      tmp = document.getElementById('scrollText' + i).style;
      tmp.top = parseInt(tmp.top) - scrollSpeed;

      if (parseInt(tmp.top) <= scrollHeight * (-1))
        tmp.top = scrollHeight * (scrollText.length-1);

      if (scrollTemp++ > (scrollAmount-1) * scrollText.length) {
        scrollFlag=false;
        scrollTemp=0;
        window.setTimeout("scrollFlag=true;scrollTemp=0;", scrollDelay);
      }
    }
  }
  window.setTimeout("loopScroll()", scrollWait);
}

//ÁÂ¿¡¼­ ¿ì·Î ÀÌµ¿ÇÏ´Â scroll
var flashDelay = 500;
var flashWait  = 450;

function startFlash() {
    window.setTimeout("loopFlash();", flashDelay);
}

function loopFlash() {
  marquee.style.visibility = (marquee.style.visibility == "" || marquee.style.visibility == "visible") ? "hidden":"visible";
  window.setTimeout("loopFlash()", flashWait);
}

