﻿// MOUSE on/ff
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() { //v3.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_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_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 Layers_findObj(n, d) { //v4.0
	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=Layers_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function Layers_showHideLayers() { //v3.0
	var i,p,v,obj,args=Layers_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=Layers_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_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 SetbtnBarImage()
{
    if(document.all.left_TB_btn1.style.display == '')
    {
        document.all.left_TB_btn1.style.display = "none";
        document.all.left_TB_btn2.style.display = "";
        document.all.leftcashbag.style.display = "";
        document.all.leftspacebar.style.display = "";
    }
    else
    {
        document.all.left_TB_btn1.style.display = "";
        document.all.left_TB_btn2.style.display = "none";
        document.all.leftcashbag.style.display = "none";
        document.all.leftspacebar.style.display = "none";
    }
}

function MM_showHideLayers2() { //v1.0
    var obj, args=MM_showHideLayers2.arguments;
    if ((obj=MM_findObj(args[0]))!=null) 
    {
        if(obj.style.display =='none')
            obj.style.display = '';
        else 
            obj.style.display = 'none';
    }
    SetbtnBarImage();
}

// 윈도우 오픈(속성사용)
function openWin(win,name,si)
{
    window.open (win,name,si);
}
  
function openWin_air(win,name,si)
{
    window.open (win,name,si);
}  


// ActiveX 패치 관련
function ieActiveX(id)
{
	document.write(id.innerHTML.replace("<!--","<").replace("-->",">")); id.id="";
}


// 스크롤따라다니는 퀵메뉴
function scrollQuick(quick_name, quick_point) { 
	var top_point, start_point, end_point, timer; 
	
	var quick_layer = document.getElementById(quick_name);  // 레이어 오브젝트
	
	top_point   = quick_layer.style.top;
	start_point = parseInt(top_point, 10); 
	end_point   = document.body.scrollTop + quick_point; 
	limit_point = parseInt(window.document.body.scrollHeight) - parseInt(quick_layer.offsetHeight) -10; 
	
	if ( end_point > limit_point )  end_point = limit_point; 
	if ( end_point < top_point )    end_point = top_point; 
	
	if ( start_point != end_point ) 
	{ 
		scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 10 ); 
		quick_layer.style.top = parseInt(top_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
	} 
	timer = setTimeout ("scrollQuick('" + quick_name + "', " + quick_point + ");", 5); 
} 


//탭메뉴
function tab_action(obj1, obj2) {
	for(i=0;i<=(eval(obj1).length-1);i++){
		if(eval(obj1)[obj2-1] == eval(obj1)[i]){
			eval(obj1)[i].style.display="block";
		}
		else{
			eval(obj1)[i].style.display="none";
		}
	}
}

function tab_action2(obj3, obj4) {
	for(i=0;i<=(eval(obj3).length-1);i++){
		if(eval(obj3)[obj4-1] == eval(obj3)[i]){
			eval(obj3)[i].style.display="block";
		}
		else{
			eval(obj3)[i].style.display="none";
		}
	}
}

//상품평 탭메뉴
	function Show(LayerName){
		if(LayerName.style.display=='none'){
			LayerName.style.display='';
		}
		else {
			LayerName.style.display='none';;
		}
	}


// 카테고리 이동	
function open_ctg1() {  
CATEGORY.style.visibility="visible"; 
} 
 function close_ctg1() { 
CATEGORY.style.visibility="hidden"; 
}

// QNA 리스트 
function showhide(id,num, p_totcount)	{ 
	for (i=1; i<=p_totcount; i++)	{ 
		menu=eval("document.all."+id+i+".style"); 
		if (num==i )	{
			if (menu.display=="block")	{
				menu.display="none"; 
			}
			else	{
				menu.display="block";
			}
		}
		else	{
			menu.display="none"; 
		}
	}
} 

//상품 탭이동 아이프레임 자동 늘어나게 하기
function reSize() {
    try {
        var objBody = auto_iframe.document.body;
        var objFrame = document.all["auto_iframe"];
        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
        objFrame.style.height = ifrmHeight;
    }
        catch(e) {}
}


function goHome()
{
		document.location='/default.aspx';
}



function  goCT(chk)
{
        if (chk==1) {
			document.location  ='/CT/NewGD.aspx';//신상품
		} else if (chk==2) {
		    document.location  ='/CT/BigSale.aspx';//초특가
		} else if (chk==3) {
		    document.location = '/CT/BrandList.aspx'; //브랜드샵
		}
}

function  goCATE(Cate1CD)
{
        if (Cate1CD) {
			document.location  ='/CT/CTMain.aspx?Cate1CD='+Cate1CD;
		}
}

function  goCATE2(Cate1CD,Cate2CD)
{
        if (Cate1CD) {
			document.location  ='/CT/CTCate2.aspx?Cate1CD='+Cate1CD+'&Cate2CD='+Cate2CD;
		}
}

function  goDI(chk)
{
        if (chk==1) {
			document.location  ='/DI/AboutUs.aspx';//면세점소개
		} else if (chk==2) {
			document.location  ='/DI/DongwhaLocation.aspx';//
		} else if (chk==3) {
			document.location  ='/DI/DongwhaShop.aspx';//
		} else if (chk==4) {
			document.location  ='/DI/DutyFree24.aspx';//
		} else if (chk==5) {
			document.location  ='/DI/StoreMap.aspx';//
		} 
}

function  goET(chk)
{
        if (chk==1) {
			document.location  ='/ET/Customer.aspx';//
		} else if (chk==2) {
			document.location  ='/ET/Customer_guide01.aspx';//이용안내
		} else if (chk==3) {
			document.location  ='/ET/Customer_guide02.aspx';//
		} else if (chk==4) {
			document.location  ='/ET/Customer_guide03.aspx';//
		} else if (chk==5) {
			document.location  ='/ET/Customer_guide04.aspx';//
		} else if (chk==6) {
			document.location  ='/ET/Customer_infosafe.aspx';//
		} else if (chk==7) {
			document.location  ='/ET/Customer_member.aspx';//
		} else if (chk==8) {
			document.location  ='/ET/Customer_noticeview.aspx';//
		} else if (chk==9) {
			document.location  ='/ET/Customer_safe.aspx';//
		} else if (chk==10) {
			document.location  ='/ET/Customer1.aspx';// 고객센터 FAQ
		} else if (chk==11) {
			document.location  ='/ET/Customer2.aspx';//
		} else if (chk==12) {
			document.location  ='/ET/Customer3.aspx';//
		} else if (chk==13) {
			document.location  ='/ET/Customer5.aspx';// 문제해결
		} else if (chk==14) {
			document.location  ='/ET/NoticeList.aspx';// 공지
		}
}



function  goEV(chk)
{
        if ( chk==0 ) {
			document.location  ='/EV/SaleEvent.aspx';//이벤트
		} else if ( chk==2 ) {
		    document.location ='/EV/SaleCoupon.aspx'; //할인쿠폰
		}
}

function  goGU(chk)
{
        if (chk==1) {
			document.location ='#';
		} 
}

function  goMP(chk)
{
        if (chk==1) {
			document.location ='/MP/Login.aspx'; //로그인
		} else if (chk==2) {
			document.location ='/MP/Join1.aspx'; //회원가입
		} else if (chk==3) {
			document.location ='/MP/IDPWSearch.aspx'; //아이디/패스워드찾기
		} else if (chk==4) {
			document.location ='/MP/MySPOrder.aspx'; //스페셜오더 주문내역
		} else if (chk==5) {
			document.location ='/MP/MyCoupon.aspx'; //쿠폰 마일리지
		} else if (chk==6) {
			document.location ='/MP/MyWishList.aspx'; //관심상품
		} else if (chk==7) {
			document.location ='/MP/MyQnA.aspx'; //일대일문의
		} else if (chk==8) {
			document.location ='/MP/MyComment.aspx'; //상품평
		} else if (chk==9) {
			document.location ='/MP/MyInfoEdit.aspx'; //나의정보변경
		} else if (chk==10) {
			document.location ='/MP/MyExit.aspx'; //탈퇴
		} else if (chk==11) {
		    document.location ='/MP/MyPurchase.aspx'; //나의 주문 내역
		}
}

function  goPD(chk)
{
        if (chk==1) {
			document.location ='/PD/GDSearch.aspx'; //상세검색
		} 
}

function  goSH(chk)
{
        if (chk==1) {
			document.location ='#';
		} 
}

function  goSP(chk)
{
        if (chk==1) {
			document.location ='/SP/SPOrderInfo.aspx'; //스페셜오더
		} 
}

function  goETC(chk)
{
        if (chk==1) {
			document.location ='/DI/SiteMap.aspx';
		} else if (chk==2) {
			document.location ='/ET/NoticeDetail.aspx?Seq=20';
		} else if (chk==3) {
		    window.open('http://www.ondutyfree.com/web/','','');
		} else if ( chk==4 ) {
		    document.location ='/ET/Customer.aspx?FaqGbCD=06';
		}
}

function goEvent(chk)
{
        if (chk==1) {
			document.location ='/EV/EventDetail.aspx?EventType=GIFT&EventNo=G07060010';
		}
}

/// mail
function mail(chk)
{
		if (chk==1) {
			document.location = 'mailto:webmaster@dutyfree24.com';
		}
}

//숫자만 받기
function ConvertNumber(field)
{
  var strNumber = "";
  var s = new String(field.value);

  for(i=0; i < field.value.length; i++)
  {
    //    if(parseInt(field.value.slice(i,i+1))>=1 && parseInt(field.value.slice(i,i+1))<=9)
    if(parseInt(field.value.slice(i,i+1))>=0 && parseInt(field.value.slice(i,i+1))<=9)
      strNumber += field.value.slice(i,i+1);
  }
  
  if(s.substr(0,1) == "-")
    field.value = s.substr(0,1);  //+  //field.value = s.substr(0,1) + strNumber;
  else 
    field.value = strNumber;
 
  if(field.value == "")
    field.value = "1";
  
}


function OnlyNumber(field)
{
  var num1 = field.value.length;//숫자의 길이를 구한다.        

  var src1 = field.value.substr(0,1);//입력숫자의 첫번째를 잘라 낸다..
  var src2 = field.value.substr(1,num1);//'0'다음의 숫자를 잘라낸다.

  if(src1 == "0"){ //만약 숫자가 "0"으로 시작되면 앞에 '0'을 뺀 숫자만큼 리턴 한다........
    return src2;
  }
  // field.value = src2;

  var re = /^$|,/g; // "$" and "," 입력 제거 srcNumber 
  field.value = field.value.replace(re, ""); //콤마를 제거 해 준다....
  
  /*
  e = window.event; //윈도우의 event를 잡는것입니다. 그냥 써주심됩니당.

  //숫자열 0 ~ 9 : 48 ~ 57, 키패드 0 ~ 9 : 96 ~ 105 ,8 : backspace, 46 : delete -->키코드값을 구분합니다. 저것들이 숫자랍니다.
  if(e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode == 8 || e.keyCode == 46)
  {
      if(e.keyCode == 48 || e.keyCode == 96)//0을 눌렀을경우
      {
          if(field.value == "" ) //아무것도 없는상태에서 0을 눌렀을경우
              field.value = "1"; //e.returnValue = false; //-->입력되지않는다.
          else //다른숫자뒤에오는 0은
              return; //-->입력시킨다.
      }
      else //0이 아닌숫자
          return; //-->입력시킨다.
  }
  else //숫자가 아니면 넣을수 없다.
      e.returnValue = false;
  */
}



