﻿function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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_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_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 open_popup(url, wid, hei, scroll, winName)
{
	var url = url;
	var posi = "width="+ wid +",height="+hei+",toolbar=no,location=no,status=no,menubar=no,top=10,left=50,scrollbars=" + scroll +",resizable=no" ;
	if (winName == "")
	{
		winName = popup;
	}
	window.open(url,winName,posi);
}

//이미지 url 알아오기 
function findImgUrl(str)
{
	var oldImgUrl = document.images[str].src;
	var findText = "/";
	var findTextNum = oldImgUrl.lastIndexOf(findText) + 1;
	return(oldImgUrl.substring(0,findTextNum));
}

//이미지 오버
function imgOver(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "on.gif";
}

//이미지 아웃
function imgOut(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "off.gif";
}

//***** 롤오버 *****
function imgOv(param) {
	param.src = param.src.replace("off.gif", "on.gif");
}
function imgOu(param) {
	param.src = param.src.replace("on.gif", "off.gif");
}


//링크 주변 점선 없애기
var myAnchors=document.all.tags("A"); 
function allblur() {
	for (i=0;i<myAnchors.length;i++) { 
		myAnchors[i].onfocus=new Function("myAnchors["+i+"].blur()");
	} 
}

// opener가 있는지 확인 후 이동
function openClosed(srt) {
	if (opener.closed) {
		window.open(nc_gwweb);
	} else {
		if (srt == null) {
			opener.window.location.href="/";
		} else {
			opener.window.location.href=srt;
		}
	}
}

// 플래시 object
function dispswf(swf,w,h,bg,id,tit)
{
	if ("https:" == document.location.protocol) 
	{
		return false;
	}
	else
	{
		 document.write('<object id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" align="middle" title="'+tit+'">');
		 document.write('<param name="allowScriptAccess" value="sameDomain" />');
		 document.write('<param name="movie" value="'+swf+'" />');
		 document.write('<param name="quality" value="high" />');
		 if(bg == ""){
		  document.write('<param name="wmode" value="transparent" />');
		  document.write('<param name="base" value="." />');
		  document.write('<embed name="'+id+'" src="'+swf+'" quality="high" wmode="transparent" width="'+w+'" height="'+h+'"  align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
		 }else{
		  document.write('<param name="bgcolor" value="'+bg+'" />');
		  document.write('<embed name="'+id+'" src="'+swf+'" quality="high" bgcolor="'+bg+'" width="'+w+'" height="'+h+'"  align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		 }
		 document.write('</object>');
	}
}


function addCommas(nStr) 
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1))
	{
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}



////tap 관련/////
function toggleLayers(showIds, hideIds)
{
    for(var i in hideIds)
        document.getElementById(hideIds[i]).style.display = 'none';
    for(var i in showIds)
        document.getElementById(showIds[i]).style.display = 'block';
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
////tap 관련/////


////////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 '';
}



var authw1 = "";
 var old_menu = '';
    var old_cell = '';
    function menuclick( submenu ,cellbar){
        if( old_menu != submenu ) {
            if( old_menu !='' ) {
                old_menu.style.display = 'none';
            }
                submenu.style.display = 'block';
                old_menu = submenu;
                old_cell = cellbar;
    } 
            else {
                submenu.style.display = 'none';
                old_menu = '';
                old_cell = '';
            }
    }

function GetParameter(val) {
    var strURL = val;
    var tmpParam = strURL.substring(1).split("&");

    var Params = new Array;
    Params = tmpParam[0].split("=");
    return Params[1];
}

/*
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf(";", offset);
    if (endstr == -1) endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) { //while open
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    } //while close
    return null;
}

function SetCookie(name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (2 < argc) ? argv[2] : null;
    var path = (3 < argc) ? argv[3] : null;
    var domain = (4 < argc) ? argv[4] : null;
    var secure = (5 < argc) ? argv[5] : false;
    document.cookie = name + "=" + escape(value) + ((expires == null) ? "": ("; expires=" + expires.toGMTString())) + ((path == null) ? "": ("; path=" + path)) + ((domain == null) ? "": ("; domain=" + domain)) + ((secure == true) ? "; secure": "");
}*/

//쿠키정보("쿠키명")
function GetCookie(name) {
	var nameSG = name + "=";
	var nuller = '';
	if (document.cookie.indexOf(nameSG) == -1)
		return nuller;

	var ca = document.cookie.split(';');
	for(var i=0; i<ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); 
	}
	return null; 
}

//쿠키 제거
function eraseCookie(name) {
	newCookie(name,"",1);
}

//쿠키생성
function SetCookie(name,value,days) {
	var days = 1;   // 쿠키저장 일수

	if (days) {
		var date = new Date();
		//date.setTime(date.getTime()+(days*24*60*60*1000));
		date.setDate(date.getDate()+(days));
		var expires = "; expires="+date.toGMTString(); }
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/"; 
}

// 페이지에서 로그인 체크해야 할때
function loginCheck(chk, str, return_url)
{
	if (chk == 'True')
	{
		location.href = '/Member/Member_Login.asp?'+return_url;
	}
	else
	{
		eval(str);
	}
}

// 카트페이지에서 로그인 체크해야 할때
function loginCheckCart(chk, str, return_url, isTrue)
{
	if (!isTrue)
	{
		alert("- 옵션 변경을 하지 않은 상품이 있거나\n- 승인되지 않은 상품이 있습니다.");
		return false;
	}

	if (chk == 'True')
	{
		location.href = '/Member/Member_Login.asp?'+return_url;
	}
	else
	{
		eval(str);
	}
}

function closeWin(obj) { 
	SetCookie( obj, 'done' , 1); // 1=하룻동안 공지창 열지 않음
	self.close(); 
}
// 셀렉트 박스 선택
// Select Box를 index가 아닌 value 값을 기준으로 선택하는 함수
function selectByVal(obj, val) {
    var i;

    for ( i = 0 ; i < obj.length ; i++ )
        if ( obj[i].value == val ) {
            obj.selectedIndex = i;
            return i;
        }

    return -1;
}

//나의 관심 카테고리
				function ShowM(){
				  var objLayer = document.getElementById('btn01');
				  var layerObjSize = objLayer.getBoundingClientRect();
				  var clientScrWidh = document.body.clientWidth
				
				  document.all['allM'].style.pixelLeft=layerObjSize.right - layerObjSize.left + ((layerObjSize.right - layerObjSize.left)/2+5)
				  document.all['allM'].style.visibility=''
				}
				function HideM(){
				  document.all['allM'].style.visibility='hidden'

				}

//오버이미지
function view(opt) {
  if(opt) {
     sub_layer.style.display = "block";
  }
  else {
     sub_layer.style.display = "none";
  }
}



//인증씰 스크립트

function viewsealinfo(seal)
{
window.open('http://info.anycert.com?seal='+seal,'viewipinfo2','width=730, height=633,scrollbars=yes,top=10,left=10');
}
//인증씰 스크립트



//sky 스크롤
var linktarget=""

function gone(){
    if (linktarget=="")
        location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    else if (linktarget=="_new")
        window.open(document.jumpy.example.options[document.jumpy.example.selectedIndex].value)
    else{
        targetobj=eval("window.parent."+linktarget)
        targetobj.location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    }
}
