//***** ÇÃ·¡½¬ ºÎºÐ *****
// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö)
function flashWrite(url,w,h,id,bg,vars){

	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	//"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='wmode' value='transparent' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' menu='false' quality='high' wmode='transparent' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
//	"<!--[if !IE]> <-->"+
//	"<object type='application/x-shockwave-flash' data='"+vars+"' width='"+w+"' height='"+h+"'>"+
//	"	<p>ÇØ´ç ÇÃ·¡½Ã°¡ Á¦´ë·Î ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù.</p>"+
//	"</object>"+
//	"<!--> <![endif]-->"+
	"</object>";

	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);

}
//*****  Äü¸Þ´º ºÎºÐ *****
var isDOM = (document.getElementById ? true : false);
  var isIE4 = ((document.all && !isDOM) ? true : false);
  var isNS4 = (document.layers ? true : false);
  var isNS = navigator.appName == "Netscape";

  var scrollerHeight = 88;
  var puaseBetweenImages = 3000;
  var imageIdx = 0;
  var slide_top;

  function moveRightEdge() {
    var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
    var quickMNBox = document.getElementById('quick_menu');
    if(isDOM) {
      yMenuFrom = parseInt(quickMNBox.style.top, 10);
      yMenuTo = (isNS ? window.pageYOffset : document.documentElement.scrollTop) + 10;
    }

    timeoutNextCheck = 500;
    if(yMenuFrom != yMenuTo) {
      yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
      if(yMenuTo < yMenuFrom) yOffset = -yOffset;
      if(isNS4) quickMNBox.top += yOffset + "px";
      else if(isDOM) quickMNBox.style.top = parseInt (slide_top.style.top, 10) + yOffset + "px";
      timeoutNextCheck = 10;
    }
    setTimeout('moveRightEdge()', timeoutNextCheck);
  }

  function ScrollTop(){
    self.scroll(0,0);
  }

//***** ÆË¾÷ ºÎºÐ *****
var mainPopupIdx = 0;
var mainPopupRoll = null;
var mainPopupCount = 10;
function mainPopupPause(idx) {
	clearInterval(mainPopupRoll);
	mainPopupView(idx);
}
function mainPopupPlay() {
	for(var i=1; i<=10; i++) {
		if(document.getElementById("popimg_0" + i) != null) {
			mainPopupCount = i;
		}
	}

	if(mainPopupRoll != null) {
		clearInterval(mainPopupRoll);
	}
	mainPopupRoll = setInterval("reload()", 2500);
}
function mainPopupView(idx) {
	for(var i=1; i<=mainPopupCount ; i++) {
		if(i == idx) {
			if(document.getElementById("popimg_0" + i) != null) {
				document.getElementById("popimg_0" + i).src="http://www.daejeon.go.kr/img/main/pop_num_ov_0" + i + ".gif";
				document.getElementById("pop_0" + i).style.display = "block";	
			}
		} else {
			if(document.getElementById("popimg_0" + i) != null) {
				document.getElementById("popimg_0" + i).src="http://www.daejeon.go.kr/img/main/pop_num_0" + i + ".gif";
				document.getElementById("pop_0" + i).style.display = "none";	
			}
		}
	}
}
function reload(){
	mainPopupIdx++;
	if(mainPopupIdx > mainPopupCount) {
		mainPopupIdx = 1;
	}
	mainPopupView(mainPopupIdx);
}


//***** ´º½º ºÎºÐ *****
function ma_news_1() {
	document.getElementById("ma_newsimg_01").src='http://www.daejeon.go.kr/img/main/new_title_ov_01.gif';
	document.getElementById("ma_newsimg_02").src='http://www.daejeon.go.kr/img/main/new_title_02.gif';
	document.getElementById("ma_newsimg_03").src='http://www.daejeon.go.kr/img/main/new_title_03.gif';
	document.getElementById("ma_newsimg_04").src='http://www.daejeon.go.kr/img/main/new_title_04.gif';
	document.getElementById("ma_news_01").style.display = 'block';	
	document.getElementById("ma_news_02").style.display = 'none';
	document.getElementById("ma_news_03").style.display = 'none';
	document.getElementById("ma_news_04").style.display = 'none';
	/*
	document.getElementById("btnmoreId01").style.display = 'block';	
	document.getElementById("btnmoreId02").style.display = 'none';
	document.getElementById("btnmoreId03").style.display = 'none';
	document.getElementById("btnmoreId04").style.display = 'none';
	*/
//	document.getElementById("tbmore").href='#1';
//	document.getElementById("nmenua1").focus();
}

function ma_news_2() {
	document.getElementById("ma_newsimg_01").src='http://www.daejeon.go.kr/img/main/new_title_01.gif';
	document.getElementById("ma_newsimg_02").src='http://www.daejeon.go.kr/img/main/new_title_ov_02.gif';
	document.getElementById("ma_newsimg_03").src='http://www.daejeon.go.kr/img/main/new_title_03.gif';
	document.getElementById("ma_newsimg_04").src='http://www.daejeon.go.kr/img/main/new_title_04.gif';
	document.getElementById("ma_news_01").style.display = 'none';	
	document.getElementById("ma_news_02").style.display = 'block';
	document.getElementById("ma_news_03").style.display = 'none';
	document.getElementById("ma_news_04").style.display = 'none';
	/*
	document.getElementById("btnmoreId01").style.display = 'none';	
	document.getElementById("btnmoreId02").style.display = 'block';
	document.getElementById("btnmoreId03").style.display = 'none';
	document.getElementById("btnmoreId04").style.display = 'none';
	*/
}

function ma_news_3() {
	document.getElementById("ma_newsimg_01").src='http://www.daejeon.go.kr/img/main/new_title_01.gif';
	document.getElementById("ma_newsimg_02").src='http://www.daejeon.go.kr/img/main/new_title_02.gif';
	document.getElementById("ma_newsimg_03").src='http://www.daejeon.go.kr/img/main/new_title_ov_03.gif';
	document.getElementById("ma_newsimg_04").src='http://www.daejeon.go.kr/img/main/new_title_04.gif';
	document.getElementById("ma_news_01").style.display = 'none';	
	document.getElementById("ma_news_02").style.display = 'none';
	document.getElementById("ma_news_03").style.display = 'block';
	document.getElementById("ma_news_04").style.display = 'none';
	/*
	document.getElementById("btnmoreId01").style.display = 'none';	
	document.getElementById("btnmoreId02").style.display = 'none';
	document.getElementById("btnmoreId03").style.display = 'block';
	document.getElementById("btnmoreId04").style.display = 'none';
	*/


}function ma_news_4() {
	document.getElementById("ma_newsimg_01").src='http://www.daejeon.go.kr/img/main/new_title_01.gif';
	document.getElementById("ma_newsimg_02").src='http://www.daejeon.go.kr/img/main/new_title_02.gif';
	document.getElementById("ma_newsimg_03").src='http://www.daejeon.go.kr/img/main/new_title_03.gif';
	document.getElementById("ma_newsimg_04").src='http://www.daejeon.go.kr/img/main/new_title_ov_04.gif';
	document.getElementById("ma_news_01").style.display = 'none';	
	document.getElementById("ma_news_02").style.display = 'none';
	document.getElementById("ma_news_03").style.display = 'none';
	document.getElementById("ma_news_04").style.display = 'block';
	/*
	document.getElementById("btnmoreId01").style.display = 'none';	
	document.getElementById("btnmoreId02").style.display = 'none';
	document.getElementById("btnmoreId03").style.display = 'none';
	document.getElementById("btnmoreId04").style.display = 'block';
	*/

}
function bt(id,after)
{
  eval(id+'.filters.blendTrans.stop();'); 
  eval(id+'.filters.blendTrans.Apply();'); 
  eval(id+'.src="'+after+'";'); 
  eval(id+'.filters.blendTrans.Play();'); 
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


//***** »õ¼Ò½Ä ºÎºÐ *****
function initView(el_id, view_item_count, style)
{
    var menu = document.getElementById(el_id);
    var menu_list = menu.getElementsByTagName('dl');
    var menu_count = menu_list.length;
    style = (typeof(style) != 'undefined') ? style : 'block';

    for(var i=0;i<menu_count;i++)
	{
        if(i < view_item_count) 
		{
			menu_list[i].style.display = style;
		}
        else 
		{
			menu_list[i].style.display = 'none';
		}
    }
}
function moveList(direction, el_id, view_item_count, scroll_count, style)
{
    var menu = document.getElementById(el_id);
    var menu_list = menu.getElementsByTagName('dl');
    var menu_count = menu_list.length;
    var start_no = 0;

    style = (typeof(style) != 'undefined') ? style : 'block';

    // ÇöÀç º¸¿©Áö°í ÀÖ´Â ¿¤¸®¸ÕÆ®ÀÇ ½ÃÀÛÀ» È®ÀÎ
    for(var i=0;i<menu_count;i++){
        if(menu_list[i].style.display == style){
            start_no = i;
            break;
        }
    }
    
    // ¹æÇâ¿¡ µû¸¥ ÀÌµ¿
    if(direction == 'next'){
        if(menu_list[menu_count-1].style.display == style) return false;
        else{
            for(var i=0;i<menu_count;i++){
                if(i>=start_no + scroll_count && i<start_no + scroll_count + view_item_count){
                    menu_list[i].style.display = style;
                }else{
                    menu_list[i].style.display = 'none';
                }
            }
        }
    }else if(direction == 'prev'){
        if(menu_list[0].style.display == style) return false;
        else{
            for(var i=0;i<menu_count;i++){
                if(i>=start_no - scroll_count && i<start_no - scroll_count + view_item_count){
                    menu_list[i].style.display = style;
                }else{
                    menu_list[i].style.display = 'none';
                }
            }
        }
    }
}

//-->


// º»¹® ÇÁ¸°Æ®
function contentPrint() {
	var windowLeft = (screen.width-680)/2;
	var windowTop = (screen.height-480)/2;

	var printURL = "http://www.daejeon.go.kr/main/print.html";


	window.open(printURL,"content",'width=662, height=400, menubar=yes, scrollbars=yes,status=no,resizable=yes,top=' + windowTop + ',left=' + windowLeft + '');
}
