var noti=new Array(), startPanel=0, n_panel=0, i=0, j=0, count=1;
var htmlstr = "", flag=true, mouse=1, s_speed=1, wait=5000, temp=0, height=20, amount=20;

function adminNotice() 
{     
    for (i=0; i<noti.length; i++) insertText(i);    
    //for (i=0; i<2; i++) insertText(i);    
    if (noti.length > 1)
        scroll();
}
function scroll() 
{
    if (mouse && flag) {

      for (i=0;i<noti.length;i++) {
        temp++;
        tmp = document.getElementById('scroll_area'+i).style;
        tmp.top = parseInt(tmp.top)-s_speed;
        if (parseInt(tmp.top) <= height*(-1)) {
          tmp.top = height*(noti.length-1);
        }
        if (temp>(amount-1)*noti.length) {
          flag=false;
          temp=0;
          window.setTimeout("flag=true;temp=0;",wait);
        }
      }
    }
    window.setTimeout("scroll()",1);
}

function insertText(i) 
{
	if(typeof(bbsMain) != 'undefined' && bbsMain) {
    	noti[i]=noti[i].replace("#C8EEED","#000000");
    	noti[i]=noti[i].replace("class=txt_notice","color=#000000");
	}
    htmlstr='<div style="left: 0px; width: 575px; position: absolute; top: '+(height*i+1)+'px" id="scroll_area'+i+'">\n';
    htmlstr+=noti[i]+'\n'+'</div>\n';
    document.getElementById('scroll_div').innerHTML=document.getElementById('scroll_div').innerHTML+htmlstr;
}


function initQuickMenu(){
	var obj = document.getElementById("quickMenu");
    obj.style.top = bodyTable.offsetTop + 170;
	var winWidth = document.body.clientWidth;
	var bodyWidth = parseInt(bodyTable.width);
	
	if (bodyWidth > 900)
		obj.style.right = -40 + "px";
	else if(bodyWidth > 850)
		obj.style.right = -80 + "px";
	else
		obj.style.right = -55 + "px";
	moveQuickMenu();
}

function moveQuickMenu()
{
	var timer;
	var activeSpeed = 200; // ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ¼Óµµ (¼ýÀÚ°¡ Å¬¼ö·Ï ´Ê°Ô ¾Ë¾ÆÂ÷¸²)
	var scrollSpeed = 10; // ½ºÅ©·ÑµÇ´Â ¼Óµµ (Å¬¼ö·Ï ´Ê°Ô ¿òÁ÷ÀÓ)
	var menuGap = 170;

	var stPoint, edPoint, refreshTimer;

	stPoint = parseInt(quickMenu.style.top);
	edPoint = document.body.scrollTop;
	if (edPoint < menuGap) edPoint = menuGap;

	refreshTimer = activeSpeed;

	if ( stPoint != edPoint ) {
		scrollAmount = Math.ceil( Math.abs( edPoint - stPoint ) / 15 );
		quickMenu.style.top = parseInt(quickMenu.style.top) + ( ( edPoint<stPoint ) ? -scrollAmount : scrollAmount );
		refreshTimer = scrollSpeed;
		}

	timer = setTimeout ("moveQuickMenu();", refreshTimer);
}


