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) { //v3.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=MM_findObj(n,d.layers[i].document); 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() { //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_shLayer() { //v3.0
  var i,p,v,obj,args=MM_shLayer.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')?'block':(v='hide')?'none':v; }
    obj.display=v; }
}


// Æ÷Åä´º½º/¸¸Æò
var news_layers = new Array( "photo", "cartoon")
var news_objs = new Array( news_layers.length );
function news_getObjs() {
    var nObjMax = news_layers.length;
    for( nCount = 0; nCount < nObjMax; nCount++ ) {
        news_objs[nCount] = document.getElementById( news_layers[nCount] );
    }
}
function MenuChange( layerID ) {
    news_objs[0] != null ? "" : news_getObjs();
    if( layerID == news_objs[0].id ) {
        news_objs[0].style.display = "";
        news_objs[1].style.display = "none";
    } else if( layerID == news_objs[1].id ) {
        news_objs[0].style.display = "none";
        news_objs[1].style.display = "";
    }
}

// ÇÁ¸°Æ®
function PrintOpen(srcurl){
        printurl = "/service/print/Print.php?po="+srcurl;
        window.open(printurl, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=100,top=10,width=700,height=758');
}

//¾ÆÀÌ´º½º ½½¶óÀÌµå ½ÃÀÛ
function winpop(urls) {
     movie_pop = window.open(urls ,'movie_pop_win','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=617,height=450');
     movie_pop.focus();
}     

function window_open2(urls, widths, heights){
	window.open( urls, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+widths+',height='+heights);
}

function window_open3(urls, widths, heights){
	window.open( urls, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+widths+',height='+heights);
}
function window_slide(urls){
	window.open( urls, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=788,height=680');
}

function window_slide2(urls){
        window.open( urls, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=785,height=680');
}

function window_movie(urls){
	window.open( urls, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=610,height=400');
}
//¾ÆÀÌ´º½º ½½¶óÀÌµå ³¡

//±â»ç¸ÞÀÏº¸³»±â ÄíÅ° °ª
function TimetoString(date) {
    var year  = date.getFullYear();
    var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
    var day   = date.getDate();
    var hour  = date.getHours();
    var min   = date.getMinutes();
    var sec   = date.getSeconds();
    var rnd_val = Math.ceil(100*Math.random());

    if (("" + month).length == 1) { month = "0" + month; }
    if (("" + day).length   == 1) { day   = "0" + day;   }
    if (("" + hour).length  == 1) { hour  = "0" + hour;  }
    if (("" + min).length   == 1) { min   = "0" + min;   }
                if (("" + sec).length   == 1) { sec   = "0" + sec;   }
                if (("" + rnd_val).length   == 1) { rnd_val   = "0" + rnd_val;   }

    return ("" + year + month + day + hour + min + sec + rnd_val)
}

//±â»ç¸ÞÀÏº¸³»±â ÄíÅ° ¼³Á¤
function SetGisaMailCookie(name, value, expmimutes) {
  var todayDate = new Date();
  todayDate.setMinutes( todayDate.getMinutes() +  expmimutes);
  document.cookie = name + "=" + value + "; path=/; expires=" + todayDate.toGMTString() + ";domain=.hankooki.com";
}

//±â»ç¸ÞÀÏº¸³»±â ¸ÞÀÎ
function GisaMail(uid){
        var Cookievalue;
        var urls = location.host + location.pathname + location.search;
        Cookievalue = GetCookie('mlogin_cookie');
        if(Cookievalue == "") {
                alert("È¸¿ø·Î±×ÀÎÀ» ÇÏ¼Å¾ß º¼¼ö ÀÖ´Â ÆäÀÌÁö ÀÔ´Ï´Ù.");
                location.href="http://member.hankooki.com/member/login.php?path=0630&url=" + urls;
        }else{
                //Á¤»óÀûÀÎ ¹æ¹ýÀ¸·Î Ã¢À» ¶ç¿ü´ÂÁö È®ÀÎÇÏ±â À§ÇØ Äí±â ÀÌ¿ë
                tmp = new Date();
                cookval=TimetoString(tmp);
                SetGisaMailCookie('GisaMail',cookval,10);
                mailurl = "http://www.hankooki.com/common/GisaMail/GisaMailForm.php?uid="+uid+"&certify="+cookval;
                window.open(mailurl, 'WinGisaMail','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=100,top=10,width=602,height=390');
        }
}
