var cold='';

	function showHide(fieldName, selectNum) //(DIV ID명/선택한 글번호/총 ROW수)
	{
		submenu = eval(fieldName+selectNum).style;

		if(cold != submenu) {
			if(cold != '') {
				cold.display='none';
			}
			submenu.display='block';
			cold=submenu;
		} else {
			submenu.display='none';
			cold='';
		}

	}

var Browser = {
	a:navigator.userAgent.toLowerCase()
}

Browser={
	ie:/*@cc_on true || @*/false,
	ie6:Browser.a.indexOf('msie 6')!=-1,
	ie7:Browser.a.indexOf('msie 7')!=-1,
	ie8:Browser.a.indexOf('msie 8')!=-1,
}

if(Browser.ie6){
	alert("Internet Explorer 버전이 낮아 오동작을 일으킬 수 있습니다.");
}else if(Browser.ie7){
	alert("Internet Explorer 버전이 낮아 오동작을 일으킬 수 있습니다.");
}


 // 자주이용하는 서비스보기
function imLink() {
	if (document.getElementById('IM_MENU').style.display == 'block') {
		document.getElementById('IM_MENU').style.display = 'none';
		document.getElementById('LINKWINDOWS').innerHTML = "<img src='/main/inc/img/main/btn_01_o.gif' width='416' height='36' alt='지역지식센터 전체현황보기' />";
		
	} else {
		document.getElementById('IM_MENU').style.display = 'block';
		document.getElementById('IM_LYR').style.display = 'none';
		document.getElementById('LINKWINDOWS').innerHTML = "<img src='/main/inc/img/main/btn_02.gif' width='416' height='36' alt='지역지식센터 전체현황닫기' />";
		document.getElementById('LINKWINDOWSS').innerHTML = "<img src='/main/inc/img/main/btn_03_on.gif' width='253' height='203' alt='지역지식센터 전체현황보기' />";
	}	
}

// 지식재산센터 전체현황보기
function wdLyr() {
	if (document.getElementById('IM_LYR').style.display == 'inline') {
		document.getElementById('IM_LYR').style.display = 'none';
        document.getElementById('LINKWINDOWSS').innerHTML = "<img src='/main/inc/img/main/btn_03_on.gif' width='253' height='203' alt='지역지식센터 전체현황보기' />";
	} else {
		document.getElementById('IM_LYR').style.display = 'inline';
		document.getElementById('IM_MENU').style.display = 'none';
		document.getElementById('LINKWINDOWS').innerHTML = "<img src='/main/inc/img/main/btn_01_o.gif' width='416' height='36' alt='자주이용하는 서비스닫기' />";
		 document.getElementById('LINKWINDOWSS').innerHTML = "<img src='/main/inc/img/main/btn_03.gif' width='253' height='203' alt='지역지식센터 전체현황보기' />";
	}
}




// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
			
//동영상
function aviPlay(src,w,h) {
document.write('<embed src="'+src+'" width='+w+' height='+h+'>')
}			

/*png 투명이미지 처리*/
function setPng24(obj) { 
  obj.width=obj.height=1; 
  obj.className=obj.className.replace(/\bpng24\b/i,''); 
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
  obj.src='';  
  return ''; 
}

/*IE6 Background Flicker 버그 수정*/
(function(){
var m = document.uniqueID
&& document.compatMode
&& !window.XMLHttpRequest
&& document.execCommand;

try{
if(!!m){
m("BackgroundImageCache",false,true)
}
}catch(oh){};
})();
/*IE6 Background Flicker 버그 수정*/

// 네비게이션 스크립트

function initNavigation(seq) {

		nav = document.getElementById("topnav");

		nav.menu = new Array();

		nav.current = null;

		nav.menuseq = 0;

		navLen = nav.childNodes.length;

		

		allA = nav.getElementsByTagName("a")

		for(k = 0; k < allA.length; k++) {

			allA.item(k).onmouseover = allA.item(k).onfocus = function () {

				nav.isOver = true;

			}

			allA.item(k).onmouseout = allA.item(k).onblur = function () {

				nav.isOver = false;

				setTimeout(function () {

					if (nav.isOver == false) {

						if (nav.menu[seq])

							nav.menu[seq].onmouseover();

						else if(nav.current) {

							menuImg = nav.current.childNodes.item(0);

							menuImg.src = menuImg.src.replace("_o.png", ".png");

							if (nav.current.submenu)

								nav.current.submenu.style.display = "none";

							nav.current = null;

						}

					}

				}, 10000);

			}

		}



	for (i = 0; i < navLen; i++) {

		navItem = nav.childNodes.item(i);

		if (navItem.tagName != "LI")

			continue;



		navAnchor = navItem.getElementsByTagName("a").item(0);

		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);

		

		navAnchor.onmouseover = navAnchor.onfocus = function () {

			if (nav.current) {

				menuImg = nav.current.childNodes.item(0);

				menuImg.src = menuImg.src.replace("_o.png", ".png");

				if (nav.current.submenu)

					nav.current.submenu.style.display = "none";

				nav.current = null;

			}

			if (nav.current != this) {

				menuImg = this.childNodes.item(0);

				menuImg.src = menuImg.src.replace(".png", "_o.png");

				if (this.submenu)

					this.submenu.style.display = "block";

				nav.current = this;

			}

			nav.isOver = true;

		}

		nav.menuseq++;

		nav.menu[nav.menuseq] = navAnchor;

	}

	if (nav.menu[seq])

		nav.menu[seq].onmouseover();

}




// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드)
function flashWrite(url,w,h,id,bg,vars,win){

 // 플래시 코드 정의
 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='"+vars+"' /> "+
 "<embed src='"+url+"' FlashVars='"+vars+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
 "</object>";

 // 플래시 코드 출력
 document.write(flashStr);

}

/* 웹접근성에 이용할 플래시 로더 스크립트*/
function SWFLoader() {
	var obj = new String;
	var parameter = new String;
	var embed = new String;
	
	var classId = new String;
    var codeBase = new String;
	var pluginSpage = new String;
	var embedType = new String;	
	var allParameter = new String;	
	
	var src = new String;
	var width = new String;
	var height = new String;
	var id = new String;
	var title = new String;
	var layer = new String;
	var arg = new String;
	var altText = new String;
	var wmode = new String;

	this.init = function ( w, h, s, a ) {
		width = w; 
		height = h; 
		src = s; 
		arg = a; 
		wmode = 'transparent'; 

		classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
		codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
		pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
		embedType = 'application/x-shockwave-flash';

		parameter += "<param name='allowScriptAccess' value='always'>\n";
		parameter += "<param name='allowFullScreen' value='false'\n>";
		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='best'/>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name='scale' value='noscale'/>\n";
		parameter += "<param name='expressinstall' value='Scripts/expressInstall.swf' />\n";
	}
	
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	this.wmode = function ( value ) {
		wmode = value;
	}

	this.id = function ( value ) {
		id = value;
	}
	this.title = function ( value ) {
		title = value;
	}

	this.shocknone = function ( value ) {
		altText = value;
	}

	this.layer = function ( value ) {
		if(value == undefined) {
			layer = "";
		} else {
			layer = value;
		}
	}

	this.show = function () {
		obj = '<object id="'+id+'" width="'+width+'" height="'+height+'" title="'+title+'" classid="'+classId+'" codebase="'+codeBase+'">\n'+
			parameter +
			'<param name="wmode" value="'+wmode+'">\n'+
			'<!--[if !IE]>-->\n' +
			'<object type="application/x-shockwave-flash" data="' + src + '" width="' + width + '" height="' + height + '" name="' + id + '">\n' +
				parameter +
				'<param name="wmode" value="'+wmode+'">\n'+
			'<!--<![endif]-->\n' +
				'<div class="alt-content alt-' + id + '2">' + altText + '</div>\n' +
			'<!--[if !IE]>-->\n' +
			'</object>\n' +
			'<!--<![endif]-->\n' +
		'</object>';

		if(layer == "") {
			document.write(obj);

		}else{
			var div = document.getElementById( layer);
			div.style.display = "";
			div.innerHTML = obj;
		}
	}
}
/* 웹접근성에 이용할 플래시 로더 스크립트*/


/* font 사이즈  */

var ttsenv_fontRate = 2;
var ttsenv_fontmaxRate = 19;
var ttsenv_fontminRate = 10;
var ttsenv_fontDefault = '';
var ttsenv_mustadjustfont = true;
var ttsenv_fontcolor = new Array();
var tts_curRate;
var tts_fontcolorindex;
var tts_bgcolorindex;
var tts_curfontsize;
var ttsenv_bgcolor = new Array();

ttsenv_fontcolor[0] = "";
ttsenv_fontcolor[1] = "#000000";
ttsenv_fontcolor[2] = "#ffff00";
ttsenv_fontcolor[3] = "#ffffff";
ttsenv_fontcolor[4] = "#6666ff";
ttsenv_fontcolor[5] = "#ff6666";
ttsenv_fontcolor[6] = "#ff66ff";
ttsenv_fontcolor[7] = "#66ff66";

ttsenv_bgcolor[0] = "";
ttsenv_bgcolor[1] = "#ffffff";
ttsenv_bgcolor[2] = "#000000";
ttsenv_bgcolor[3] = "#6666ff";
ttsenv_bgcolor[4] = "#ff6666";
ttsenv_bgcolor[5] = "#ff66ff";
ttsenv_bgcolor[6] = "#66ff66";

function f_scalescreen(mode)
{
   
    if((document.body.style.zoom==null)||(ttsenv_mustadjustfont==true)) {
        
        if(mode==1) {
            if(tts_curfontsize==null) {
                tts_curfontsize=ttsenv_fontminRate;
            } else if(tts_curfontsize=='') {
                tts_curfontsize=ttsenv_fontminRate;
            } else {
                tts_curfontsize=tts_curfontsize-(-ttsenv_fontRate);
                if(tts_curfontsize>ttsenv_fontmaxRate) {
                    tts_curfontsize=ttsenv_fontmaxRate;
                }
            }
        } else if(mode==-1) {
            if(tts_curfontsize!=null) {
                if(tts_curfontsize!='') {
                    tts_curfontsize=tts_curfontsize-ttsenv_fontRate;
                    if(tts_curfontsize<ttsenv_fontminRate) {
                        tts_curfontsize='';
                    }
                }
            }
        } 
        
        webgen_setface();
    } 
}


function f_setBasic()
{        
    tts_curfontsize = '';
//	var objSelectBox = document.getElementById("selectSite");
//    objSelectBox.selectedIndex = 0;	
    webgen_setface();  
}


function webgen_setface()
{
    webgen_setface_run(document.body);
    if(document.getElementById('select')!=null) {
        document.getElementById('select').selectedIndex = parseInt(tts_fontcolorindex);
    }
    if(document.getElementById('select')!=null) {
        document.getElementById('select').selectedIndex = parseInt(tts_bgcolorindex);
    }    
}


function webgen_setface_run(obj) {
    if(obj==null) {
        return;
    }
    if(obj.childNodes!=null) {
        var i;
        var s=false;
        if(obj.style!=null) {
            obj.style.backgroundColor=ttsenv_bgcolor[tts_bgcolorindex];
            obj.style.color=ttsenv_fontcolor[tts_fontcolorindex];
        }
        for(i=0;i<obj.childNodes.length;i++) {
            if(obj.childNodes[i].nodeName=="#text") {
                if(s==false) {
                    if(obj.style!=null) {
                        if((document.body.style.zoom==null)||(ttsenv_mustadjustfont==true)) {
                            if(tts_curfontsize==null) {
                                obj.style.fontSize='';
                            } else if(tts_curfontsize=='') {
                                obj.style.fontSize='';
                            } else {
                                obj.style.fontSize=tts_curfontsize+'pt';
                            }
                        }
                    }
                    s=true;
                }
            } else {
                webgen_setface_run(obj.childNodes[i]);
            }
        }
    }
}



/* font 사이즈  */

//main banner start
var bannerArr = new Array();
var b_process = true; //true일 때 스크롤 false일 때 stop
var speed =1; //스크롤속도-작을수록빠름

function initBanner(bannerBox, bannerContent, delay) {
	
	bannerArr[bannerArr.length] = bannerBox;	
	
	var bannerArrsum = 1; //initBanner함수전체호출수-추가할때마다수정요함
	bannerBox.delay = delay/(speed/bannerArrsum);
	bannerBox.moveOffset = bannerBox.offsetHeight;//Safari만다른값.가끔될때도있음.
	bannerBox.count = 0;
	bannerBox.bannerOver = false;
	bannerBox.cont = bannerContent;
	bannerBox.cont.currentHeight = 0;
 
	bannerBox.move = setInterval("moveBanners()", speed );
	p_num = bannerBox.move;
 
	for (i=0; i<bannerArr.length; i++) {
		bannerArr[i].onmouseover = function() { this.bannerOver=true; }
		bannerArr[i].onmouseout = function() { this.bannerOver=false; }
	}
}

 
function moveBanners() {

	
	for (i=0; i<bannerArr.length; i++) {
		if (bannerArr[i].cont.currentHeight % bannerArr[i].moveOffset == 0 && bannerArr[i].count < bannerArr[i].delay) {
			if(!bannerArr[i].bannerOver) bannerArr[i].count++;//bannerOver가 false 일때 카운트증가시킨다
		} else {
			bannerArr[i].count = 0;
 
			bannerArr[i].cont.currentHeight -= bannerArr[i].moveOffset;//스크롤안함
 
			if (bannerArr[i].cont.currentHeight % (bannerArr[i].cont.offsetHeight) == 0) {
				bannerArr[i].cont.currentHeight = 0;
			}
			bannerArr[i].cont.style.top = bannerArr[i].cont.currentHeight + "px";
		}
	}
}
//main banner end
