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_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_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_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}
//-->

// document.domain = "idea.jb.go.kr";
// Main Menu Layer
var se = document.location.search.substr(1); 
var qa = {}; // query array 
se.replace(/([^=]+)=([^&]*)(&|$)/g, function(){ 
     qa[arguments[1]] = arguments[2]; 
     return arguments[0]; 
});
var leftMenuID = qa['menuCd'];
var MenuIDNo = 0; 

// 이미지 오버 함수
// Image Roll-over
function imageOver(idx) {
    objImg=document.getElementById("menu"+idx);
    objImg.src = objImg.src.replace("off", "on");
    if(idx >= 1 && idx <= 6)    {
        menuMouseOver(idx);
    }
}
function imageOut(idx) {
    var rtnT;
    if(idx >= 1 && idx <= 6)    {
        rtnT = setTimeout(function(){
                          menuMouseOut(idx);
                     }, 3000);

//    } else if(idx >= 11 && idx <= 14)    {
    } else {
        objImg=document.getElementById("menu"+idx);
        objImg.src = objImg.src.replace("on", "off");
    }
    leftMenuNow();
}
function leftMenuNow() {
    switch(leftMenuID) {
        case 'NL01001000000':    MenuIDNo = 11;    break;

    }
    if(MenuIDNo != 0) {
//        imageOver(MenuIDNo);
        objImg=document.getElementById("menu"+MenuIDNo);
        objImg.src = objImg.src.replace("off", "on");
    }
}

// Menu Control
	function chgHeadingTab(el) {
		if (!document.getElementsByTagName) return false;
		var tabtag = el;
		var headings = new RegExp("[h1-6]","i");
		while (!headings.test(tabtag.tagName)) {
			tabtag = tabtag.parentNode;
		}
		if (!headings.test(tabtag.tagName)) return false;
		var tabparent = tabtag.parentNode;
		tabtag = tabtag.tagName;
		var clickedtab = el;
		while (clickedtab.tagName != tabtag) {
			clickedtab = clickedtab.parentNode;
		}
		var tabitems = tabparent.getElementsByTagName(tabtag);
		for (var i=0; i<tabitems.length; i++) {
			var tabimg = tabitems[i].getElementsByTagName("IMG")[0];
			var tabcont = tabitems[i].nextSibling;
			while (tabcont.nodeType != 1) {
				tabcont = tabcont.nextSibling;
			}
			if (tabitems[i] == clickedtab) {
				tabimg.src = tabimg.src.replace("_off","_on");
				tabcont.style.display = "block";
			} else if (tabitems[i] != clickedtab) {
				if (tabimg.src.indexOf("_on") != -1) {
					tabimg.src = tabimg.src.replace("_on","_off");
				}
				tabcont.style.display = "none";
			}
		}
		return false;
	}

	function overImg(obj) {
		obj.src = obj.src.replace( 'off', 'on' );
	}
	function outImg(obj) {
		if (chkContOn(obj)) return false;
		obj.src = obj.src.replace( 'on', 'off' );
	}
	function chkContOn(el) {
		var tab = el;
		var headings = new RegExp("[h1-6]","i");
		while (!headings.test(tab.tagName)) {
			tab = tab.parentNode;
		}
		if (!headings.test(tab.tagName)) return false;
		var tabcont = tab.nextSibling;
		while (tabcont.nodeType != 1) {
			tabcont = tabcont.nextSibling;
		}
		return tabcont.style.display != "none" ? true : false;
	}

//
//*펼침 메뉴 *//
function leftMenu(menuIdx){
	for(i=1 ; i<=54 ; i++){
		try{
			objLayer = document.getElementById("sub"+i);

			if (i<=9){
				objImg = document.getElementById("Lmenu0"+i);
			}else{
				objImg = document.getElementById("Lmenu"+i);
			}
			if(i == menuIdx){
			 	objImg.src = objImg.src.replace(i+"_off.png", i+"_on.png");
				objLayer.style.display = "block";
			}else{
				objImg.src = objImg.src.replace(i+"_on.png", i+"_off.png"); 
				objLayer.style.display = "none"; 
			} 
		}catch(e){ }  
	} 
}

function menuMouseOver(idx){
	try{
		for(i=1 ; i<=7 ; i++){
			
			objImage = document.getElementById("menu"+i);
			objLayer = document.getElementById("tab_0"+i);
			if(i == idx){
				objImage.src = objImage.src.replace(i+"_off", i+"_on");
				objLayer.style.display = "block";
			}else{
				objImage.src = objImage.src.replace(i+"_on", i+"_off");
				objLayer.style.display = "none";
			}
		}
	}catch(err){
	
	}
} 

function menuMouseOut(menuIdx){
	try{
		for(i=1 ; i<=7 ; i++){
			
			objImage = document.getElementById("menu"+i);
			objLayer = document.getElementById("tab_0"+i);
			if(i == menuIdx){
				objImage.src = objImage.src.replace(i+"_on", i+"_off");
				objLayer.style.display = "none";
			}
		}
	}catch(err){
	
	}
} 

//Popup
function WinPop(url,name,w,h,s)    {
    if(s!==0)    {
        sOp = ",scrollbars=yes";
    } else    {
        sOp = "";
    }
    winOptions = 'width='+w+',height='+h+sOp;
    window.open(url,name,winOptions);
}

function showProductWin( url, w, h )    {
    var theOptions = 'width='+w+',height='+h+",toolbar,status,location,directories,menubar,titlebar=0,resizable=1,scrollbars=1";
    window.open(url,'product',theOptions);
}

function MM_openBrWindow( url, win, option )    {
    window.open(url,win,option);
}


//Popup Close
function closeWin()     {    window.close();	}


//▼ 탭 메뉴 스크립트 /////////////
function tap_Lay(target, tlength, gubun){

	var tapLength = tlength ; // 탭 갯수
	var layLink = ";";

	for (i=0;i<tapLength;i++){
		if(gubun=='S'){
			objBtn = document.getElementById("menu2" + i);
			objLay = document.getElementById("movie" + i);
		}else{
			objBtn = document.getElementById("menu1" + i);
			objLay = document.getElementById("board_sub" + i);
		}
		if(target == i){
			objBtn.src = objBtn.src.replace( 'off.', 'on.' );
		} else {
			objBtn.src = objBtn.src.replace( 'on.', 'off.' );
		}
		objLay.className = "listH" ; 
		target == i ?  objLay.className = "listS"  :  objLay.className = "listH" ;  
	}
	
}
//▲ 탭 메뉴 스크립트 /////////////

//▼ 이미지 크게 보기 스크립트 /////////////
var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) 
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

//crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext"><a href="javascript:closepreview()">Close</a></span>&nbsp;</div><img src="'+which+'">'
crossobj.innerHTML='<a href="javascript:closepreview()"><img src="'+which+'"></a>'
crossobj.style.visibility="visible"
return false
}
else
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
//▲ 이미지 크게 보기 스크립트 /////////////


function rd_check(){
	var f = document.rd_search;
	f.submit();
}

//▼ 서울신용평가 실명인증 스크립트 /////////////
var CBA_window; 
function openCBAWindow(){ 
	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 = 'https://name.siren24.com/vname/jsp/vname_j10.jsp';                     // 가상식별 실명확인서비스 URL
	document.reqCBAForm.target = 'CbaWindow';
	document.reqCBAForm.submit();
}
//▲ 서울신용평가 실명인증 스크립트 /////////////

//▼ 지난공모 페이지 이동 스크립트 /////////////
function movesite(url){ 
	location.href=url;
}
//▲ 지난공모 페이지 이동 스크립트 /////////////
