try { document.execCommand("BackgroundImageCache", false, true);} catch(err) {}

//탑메뉴
function top2menuView(a) { //2차메뉴보기
	if(this.id){
		eidStr = this.id;
		eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length);
		a = parseInt(eidNum);
	}

	top2menuHideAll();
	top1Menu = document.getElementById("top1m"+a);
	top2Menu = document.getElementById("top2m"+a);
	
	if(a<100){ann='0'+a;} else {ann=''+a;}
	if (a=0) { //메인은2차메뉴활성화안함
	} else {
		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_off.gif","_on.gif");
			if (top2Menu) { top2Menu.style.display = 'inline'; }
		}
	}
}


function top2menuHide(a) { //2차메뉴감추기
	if(this.id){
		eidStr = this.id;
		eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length);
		a = parseInt(eidNum);
	}
	
	top2menuHideAll();
	top1Menu = document.getElementById("top1m"+a);
	top2Menu = document.getElementById("top2m"+a);
	top1MenuCurr = document.getElementById("top1m"+d1n);
	top2MenuCurr = document.getElementById("top2m"+d1n);
	
	if(a<100){ann='0'+a;} else {ann=''+a;}
	if (top1Menu) {
		top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_on.gif","_off.gif");
		if (top2Menu) { top2Menu.style.display = 'none'; }
		
		if (top1MenuCurr) {
			top1MenuCurr.getElementsByTagName("img")[0].src = top1MenuCurr.getElementsByTagName("img")[0].src.replace("_off.gif","_on.gif");
		}
		
		if (top2MenuCurr) { top2MenuCurr.style.display = 'inline'; }
	}
}


function top2menuHideAll() { //2차메뉴모두감추기
	top1menuEl = document.getElementById("top1menu").childNodes;
	
	for (i=1;i<=top1menuEl.length;i++) {
		top1Menu = document.getElementById("top1m"+i);
		top2Menu = document.getElementById("top2m"+i);
		
		if(i<100){inn='0'+i;} else {inn=''+i;}

		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_on.gif","_off.gif");
			if (top2Menu) { top2Menu.style.display = 'none'; }
		}
	}
}


function initTopMenu(d1,d2) {
	d1n = d1;
	d2n = d2;
	d1nn = (d1n<100) ? '0'+d1n : d1n;
	d2nn = (d2n<100) ? '0'+d2n : d2n;

	top1menuEl = document.getElementById("top1menu").childNodes;
	for (i=1;i<=top1menuEl.length;i++) {
		top1Menu = document.getElementById("top1m"+i);
		top2Menu = document.getElementById("top2m"+i);
		
		if (top1Menu) {
			top1Menu.onmouseover = top1Menu.onfocus = top2menuView;
			//top1Menu.onmouseout = top2menuHide;
			
			if (top2Menu) {
				top2Menu.onmouseover = top2Menu.onfocus = top2menuView;
				//top2Menu.onmouseout = top2menuHide;
			}
		}
	}

	top2MenuCurrAct = document.getElementById("top2m"+d1n+"m"+d2n);
	if (top2MenuCurrAct) { top2MenuCurrAct.getElementsByTagName("a")[0].style.color="#8b8c85"; }
	if (top2MenuCurrAct) { top2MenuCurrAct.getElementsByTagName("a")[0].style.fontWeight="bold"; }
}


function displayOver() {
	this.style.display = 'block';
}

function displayOut() {
	this.style.display = 'none';
}


/* 이미지 오버 아웃 */
function imageOver(imgEl) {
	imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
}
function imageOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
}

//------------------- SWF 제어함수 시작

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 layer = new String;
	var arg = new String;
	var altText = new String;
	var wmode = new String;

	this.init = function ( w, h, s, a,wm) {
		width = w; //넓이
		height = h; //높이
		src = s; //파일경로
		arg = a; // 매개변수
		if(!wm){
		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='high'>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name='FlashVars' value='"+a+"'>\n";
	}
	
	

	//플래시 오브젝트 옵션설정
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	// 플래시 wmode 설정 setFlash.wmode('window')
	this.wmode = function ( value ) {
		wmode = value;
	}

	// 플래시 아이디 설정
	this.id = function ( value ) {
		id = value;
	}
	
	// 플래시 대체텍스트 설정
	
	this.alt = 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+'" 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 + '">' + 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;
		}
	}
}

function hideSWFLayer( div) {
	var div = document.getElementById( div);
	div.style.display = "";
	div.innerHTML = "";
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else {
		return document[movieName];
	}
 }

 function callExternalInterface(movieId) {
    thisMovie(movieId).moveMc();	
}
//------------------- SWF 제어함수 끝


// 탭메뉴 공통적으로 사용
//ex) tabOn(1,1);
function tabOn(tabid,a) {
	for (i=1;i<=10;i++) {
		if(i<10){inn="0"+i;} else {inn=""+i;}
		tabMenu = document.getElementById("tab"+tabid+"m"+i);
		tabContent = document.getElementById("tab"+tabid+"c"+i);
		tabMore = document.getElementById("tab"+tabid+"more"+i);
		if (tabMenu) { //객체가존재하면
			if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("on.gif", ".gif"); } //이미지일때
			if (tabMenu.tagName=="A") { tabMenu.className=""; } //앵커일때
		}
		if (tabContent) { tabContent.style.display="none"; }
		if (tabMore) { tabMore.style.display="none"; }

	}
	if(a<10){ann="0"+a;} else {ann=""+a;}
	tabMenu = document.getElementById("tab"+tabid+"m"+a);
	tabContent = document.getElementById("tab"+tabid+"c"+a);
	tabMore = document.getElementById("tab"+tabid+"more"+a);
//	alert(tabMenu.tagName);
	if (tabMenu) { //객체가존재하면
		if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace(".gif", "on.gif"); } //이미지일때
		if (tabMenu.tagName=="A") { tabMenu.className="on"; } //앵커일때
	}
	if (tabContent) { tabContent.style.display="block"; }
	if (tabMore) { tabMore.style.display="block"; }
}


// 서브메뉴
function imgMenuOver(containderID) {
	var objwrap = document.getElementById(containderID);
	var imgMenu = objwrap.getElementsByTagName("a");

	for (i=0; i<imgMenu.length; i++) {
		if(imgMenu[i].getElementsByTagName("img").length == 0) continue;

		if (imgMenu[i].getElementsByTagName("img")[0].src.indexOf("_on.gif") != -1 ) {
			continue;
		}
		imgMenu[i].onmouseover = function() {
			subImage = this.getElementsByTagName("img")[0];
			if (subImage.src.indexOf("_on.gif") != -1) return false;
			subImage.src = subImage.src.replace("_off.gif","_on.gif");
		}
		imgMenu[i].onfocus = function() {
			subImage = this.getElementsByTagName("img")[0];
			if (subImage.src.indexOf("_on.gif") != -1) return false;
			subImage.src = subImage.src.replace("_off.gif","_on.gif");
		}
		imgMenu[i].onmouseout = function() {
			subImage = this.getElementsByTagName("img")[0];
			subImage.src = subImage.src.replace("_on.gif", "_off.gif");
		}
		imgMenu[i].onblur = function() {
			subImage = this.getElementsByTagName("img")[0];
			subImage.src = subImage.src.replace("_on.gif", "_off.gif");
		}
	}
}

// 메인 팝업존
<!--

	var popScrollerHeight = 127;		// 스크롤러의 세로
	var popTotalArea = 0;
	var pWait = true;
	var pMouseOver = false;
	var popScrollSpeed = 1;			// popchanging 속도
	var popWaitTime = 4000;			// 멈추는 시간 팝업존
	var popTemp = 0;
	var popMovingAmount = popScrollerHeight * 1;	//height 곱에 따라 스크롤링 되는 레이어 크기 지정
	var arrScrollContent2 = new Array();
	var poploop = 1;
	var popObjCnt;



	function startscroll2(totCnt) {			// 스크롤 시작
		popObjCnt = totCnt;
		popchanging();

		if (!pMouseOver && pWait) {
			window.setInterval('popchanging()', popWaitTime);
		}
	}

	function popchanging() {// 실제로 스크롤 하는 부분

		if (!pMouseOver && pWait) {
			var imgNum = "";

			if(poploop < 10) imgNum = '0';
			imgNum = imgNum + poploop;

			var objName = "popbt" + imgNum;
			var viewObjName = "mainpop" + imgNum;
			var obj = document.getElementById(objName);
			var viewObj = document.getElementById(viewObjName);

			viewObj.style.visibility = 'visible';
			obj.src = "images/main/number_on_" + imgNum + ".gif";

			for(var i = 1; i <= popObjCnt; i++) {

				if(i == poploop) continue;
				imgNum = "";

				if(i < 10) imgNum = "0";

				imgNum = imgNum + i;

				var tmpobjName = "popbt" + imgNum;
				var tmpviewObjName = "mainpop" + imgNum;

				var tmpobj = document.getElementById(tmpobjName);
				var tmpviewObj = document.getElementById(tmpviewObjName);


				tmpviewObj.style.visibility = "hidden";

				tmpobj.src = "images/main/number_off_" + imgNum + ".gif";


			}

			poploop++;

			if(poploop > popObjCnt) poploop = 1;
		}
	}
//-->

<!--

	function goPage(url) {
		parent.top.location.href = url;
	}

	function popoverImage(imgNum) {

		var objName = "popbt" + imgNum;
		var viewObjName = "mainpop" + imgNum;
		var scrollNum = parseInt(imgNum) - 1;
		var obj = document.getElementById(objName);
		var viewObj = document.getElementById(viewObjName);

		obj.src = "images/main/number_on_" + imgNum + ".gif";

		if(imgNum == "08") {
			poploop = 8;

		} else if(imgNum == "09") {
			poploop = 9;

		} else {
			poploop = parseInt(imgNum);
		}

		viewObj.style.visibility = "visible";

		for(var i = 1; i <= popObjCnt; i++) {
			if(i == poploop) continue;
			imgNum = "";

			if(i < 10) imgNum = "0";

			imgNum = imgNum + i;

			var tmpobjName = "popbt" + imgNum;
			var tmpviewObjName = "mainpop" + imgNum;
			var tmpobj = document.getElementById(tmpobjName);

			var tmpviewObj = document.getElementById(tmpviewObjName);
			tmpviewObj.style.visibility = "hidden";

			tmpobj.src = "images/main/number_off_" + imgNum + ".gif";
		}

		pMouseOver = true;
	}


	function popoutImage(imgNum) {

		if(pWait) {
			var objName = "popbt" + imgNum;
			var viewObjName = "mainpop" + imgNum;
			var obj = document.getElementById(objName);
			var viewObj = document.getElementById(viewObjName);
			var movingObj = document.getElementById("mainpop00");

			obj.src = "images/main/number_off_" + imgNum + ".gif";
			viewObj.style.visibility = "hidden";
			movingObj.style.visibility = "visible";

//			poploop = 1;

			pMouseOver = false;
			popchanging();
		}
	}

	function startpopchanging() {		// 스크롤 재시작
		pWait = true;
		popoutImage("01");
	}

	function stopscroll() {		// 스크롤 정지
		pWait = false;
	}
  
//-->

/* 관련사이트 새창 */
function getSiteGo (num) {
	var obj = document.getElementById ("connect"+num);
	
	if (obj.value != '') {window.open (obj.value);}
}





/* 롤오버 이미지 변경 */
function menuOn(imgEl) {
    imgEl.src = imgEl.src.replace("_off.png", "_on.png");
}

function menuOut(imgEl) {
    imgEl.src = imgEl.src.replace("_on.png", "_off.png");
}


//ImageRollOver
function ImageRollOver(DivName, fnName, DefaultMenu) {

	this.DivName = DivName;
	this.fnName = fnName;
	this.DefaultMenu = DefaultMenu;

	this.Start = function() {

		this.MenuBox = document.getElementById(this.DivName).getElementsByTagName("ul")[0].getElementsByTagName("li");

		// 메뉴의 갯수를 파악하는 부분
		this.MenuLength = this.MenuBox.length;
		
		// 메뉴의 링크부분에 마우스나 키보드의 반응을 넣는 부분
		for( var i=0; i<this.MenuLength; i++ ) {
			this.MenuLink = this.MenuBox.item(i).getElementsByTagName("a")[0];
			this.MenuLink.i = i;
			this.MenuLink.fnName = this.fnName;
			this.MenuLink.onmouseover = this.MenuLink.onfocus = function() {
				eval( this.fnName + ".fnMouseOver(" + this.i + ")" );
			}
			this.MenuLink.onmouseout = this.MenuLink.onblur = function() {				
				eval( this.fnName + ".fnMouseOver()" );
			}
			if( this.DefaultMenu != 0 ) {
				this.fnMouseOver( this.DefaultMenu - 1 );
			}
		}

		// 메뉴의 링크부분에 마우스나 키보드의 반응에 의해 실행하는 부분
		this.fnMouseOver = function(val) {			
			for( var i=0; i<this.MenuLength; i++ ) {
				this.MenuImg = this.MenuBox.item(i).getElementsByTagName("a")[0].getElementsByTagName("img")[0];
				if( i == val ) {					
					this.MenuImg.src = this.MenuImg.src.replace("_off.gif","_on.gif");
				} else {
					this.MenuImg.src = this.MenuImg.src.replace("_on.gif","_off.gif");
				}
			}
		};
	};
}


//ImageRollOver
function ImageRollOverPng(DivName, fnName, DefaultMenu) {

	this.DivName = DivName;
	this.fnName = fnName;
	this.DefaultMenu = DefaultMenu;

	this.Start = function() {

		this.MenuBox = document.getElementById(this.DivName).getElementsByTagName("ul")[0].getElementsByTagName("li");

		// 메뉴의 갯수를 파악하는 부분
		this.MenuLength = this.MenuBox.length;
		
		// 메뉴의 링크부분에 마우스나 키보드의 반응을 넣는 부분
		for( var i=0; i<this.MenuLength; i++ ) {
			this.MenuLink = this.MenuBox.item(i).getElementsByTagName("a")[0];
			this.MenuLink.i = i;
			this.MenuLink.fnName = this.fnName;
			this.MenuLink.onmouseover = this.MenuLink.onfocus = function() {
				eval( this.fnName + ".fnMouseOver(" + this.i + ")" );
			}
			this.MenuLink.onmouseout = this.MenuLink.onblur = function() {				
				eval( this.fnName + ".fnMouseOver()" );
			}
			if( this.DefaultMenu != 0 ) {
				this.fnMouseOver( this.DefaultMenu - 1 );
			}
		}

		// 메뉴의 링크부분에 마우스나 키보드의 반응에 의해 실행하는 부분
		this.fnMouseOver = function(val) {			
			for( var i=0; i<this.MenuLength; i++ ) {
				this.MenuImg = this.MenuBox.item(i).getElementsByTagName("a")[0].getElementsByTagName("img")[0];
				if( i == val ) {					
					this.MenuImg.src = this.MenuImg.src.replace("_off.png","_on.png");
				} else {
					this.MenuImg.src = this.MenuImg.src.replace("_on.png","_off.png");
				}
			}
		};
	};
}

// 시정백서

function open2008() {
	window.open("http://whitepaper.gm.go.kr/2008/gm.htm", "2008", "top=0,left=0,width=" + (screen.width - 10) + ",height=" + (screen.height - 30));
}

function open2006()
{
    window.open('http://whitepaper.gm.go.kr/2007_sijung/data/default1.html', 'newWin', 'width=1024, height=768, toolbar=no, scroll=no');
}

function open2004() {
	window.open("http://whitepaper.gm.go.kr/view/index.jsp?open=1&group_id=3", "2008", 'width=1024, height=720, toolbar=no, scroll=no');
}


// 광명GPS

 function O_go(url) {
    if (url != "") {
 
      if(url.indexOf("/user.tdf") > -1)
      {
	      var openhtml = window.open(url,'','left=0,top=0, width=800,height=500,scrollbars=yes');
	      openhtml.resizeTo(screen.width,screen.height);
      }
      else
      {
	      var openhtml = window.open(url);
	      openhtml.resizeTo(screen.width,screen.height);
      }
      
//      location.replace(url);
    }
  }
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}   
  
  function jsScrap() {
    scrapForm.target = "iframeScrapHidden";
    scrapForm.submit();
  }
 
  function jsGoLoginPage(){
    globalLoginForm.submit();
  }
 
  function openCBAWindow(){
 
    if( reqCBAForm.validate() ) {
        var CBA_window;
 
            CBA_window = window.open('', 'CbaWindow', 'width=410, height=450, resizable=0, scrollbars=no, status=0, titlebar=0, toolbar=0, left=300, top=200' );
            document.reqCBAForm.action = 'http://name.siren24.com/cba/jsp/cba_j10.jsp';                     // SCI 가상 식별 검증 URL
            document.reqCBAForm.target = 'CbaWindow';
            document.reqCBAForm.submit();
    }
  }

function goUrl( val ) {

	if( val == "" ) {
		alert("이동하실 사이트를 선택해주세요.");
		return false;
	}

	return true;

}


