// Hide And Show Toggle
var cc=0
function hideShow(id) {
    if (cc==0) {
        cc=1
        document.getElementById(id).style.display="none";
    } else {
        cc=0
        document.getElementById(id).style.display="block";
    }
}

// Show And Hide Toggle
var cc=0
function showHide(id) {
    if (cc==0) {
        cc=1
        document.getElementById(id).style.display="block";
    } else {
        cc=0
        document.getElementById(id).style.display="none";
    }
}

// Local Navigation Toggle
function lnbToggle(id) {
	for(num=1; num<=3; num++) document.getElementById('D3MG'+num).style.display='none'; //D4MG1~D4MG3 까지 숨긴 다음
	document.getElementById(id).style.display='block'; //해당 ID만 보임
}

// IS
function chkIsKind(key, value) {
    showHide('selectOrder');
    xGetElementById('search_target'+key).checked = true;
    xInnerHtml('search_target_label', value);
}

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 msg_login() {
	alert("로그인이 필요한 서비스입니다.\n로그인 하시기 바랍니다.");
	return false;
}

// 플래시 쓰기
function flash_write(file_url,x_width,y_height) {
    flash_txt = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+x_width+'" height="'+y_height+'">';
    flash_txt += '<param name="movie" value="'+file_url+'" />';
    flash_txt += '<param name="quality" value="high" />';
    flash_txt += '<param name="wmode" value="transparent" /> ';
    flash_txt += '<embed src="'+file_url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+x_width+'" height="'+y_height+'"></embed>';
    flash_txt += '</object>';
    document.write(flash_txt);
}

// menu 선택
function menulink(sel) {

	var head = sel.substr(0,1);
	var num = sel.substr(1);

	if (head != null) {

		arr = {
				'a' : new Array('in_info','invt_qa','invt_faq','invt_news','invt_study','invt_tiptech'),
				'b' : new Array('in_pds','invt_down','invt_gallery','invt_lib','invt_link','invt_mov','invt_pds','adkpds'),
				'c' : new Array('in_comm','invt_notice','invt_free','invt_greet','invt_photo','wish'),
				'd' : new Array('invt_zone','invt_zone|17672','invt_zone|17674','invt_zone|17676','invt_zone|17678','invt_zone|17680','invt_zone|17682','invt_zone|17684','invt_zone|17686','invt_zone|17688','invt_zone|17690','invt_zone|17692'),
				'e' : new Array('go_shop','shop|401','shop|402','shop|403','shop|404','shop|405','shop|406')
		};

		if (arr[head][num] == null) {num=0};
		
		var menuitem = arr[head][num];
		var menuarr = menuitem.split("|");
		
		if (menuarr[1] == null) {
			location.href = '/' + arr[head][num];
		} else {
			location.href = '/' + menuarr[0] + '/category/' + menuarr[1];
		}

	} else {
		location.href = '/';
	}
}
