﻿
/************************************************************
*
*  JavaScript
*
************************************************************/
// Flash Patch

function swf_include(url,widthNum,hightNum,Access,bgColor,wMode,vars){
	var codeStr = "";
	codeStr += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96B8-444553540000\"";
	codeStr += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.47.0\" width=\""+widthNum+"\" height=\""+hightNum+"\">";
	codeStr += "<param name=\"allowScriptAccess\" value=\""+Access+"\" />";
	codeStr += "<param name=\"movie\" value=\""+url+"\" />";
	codeStr += "<param name=\"flashvars\" value=\""+vars+"\" />";
	codeStr += "<param name=\"menu\" value=\"false\" />";
	codeStr += "<param name=\"quality\" value=\"high\" />";
	codeStr += "<param name=\"wmode\" value=\""+wMode+"\" />";
	codeStr += "<param name=\"bgcolor\" value=\""+bgColor+"\" />";
	codeStr += "<embed src=\""+url+"\" flashvars=\""+vars+"\" allowScriptAccess=\""+Access+"\" menu=\"false\" quality=\"high\" wmode=\""+wMode+"\"";
	codeStr += "devicefont=\"true\" bgcolor=\""+bgColor+"\"  width=\""+widthNum+"\" height=\""+hightNum+"\" align=\"middle\" type=\"application/x-shockwave-flash\"";
	codeStr += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">";
	codeStr += "</embed>";
	codeStr += "</object>";
	document.write(codeStr);
}

function swf_includeObj(url,widthNum,hightNum,Access,bgColor,wMode,vars, id){
	var codeStr = "";
	codeStr += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96B8-444553540000\"";
	codeStr += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.47.0\" width=\""+widthNum+"\" height=\""+hightNum+"\" id=\""+id+"\">";
	codeStr += "<param name=\"allowScriptAccess\" value=\""+Access+"\" />";
	codeStr += "<param name=\"movie\" value=\""+url+"\" />";
	codeStr += "<param name=\"flashvars\" value=\""+vars+"\" />";
	codeStr += "<param name=\"menu\" value=\"false\" />";
	codeStr += "<param name=\"quality\" value=\"high\" />";
	codeStr += "<param name=\"wmode\" value=\""+wMode+"\" />";
	codeStr += "<param name=\"bgcolor\" value=\""+bgColor+"\" />";
	codeStr += "<embed src=\""+url+"\" flashvars=\""+vars+"\" allowScriptAccess=\""+Access+"\" menu=\"false\" quality=\"high\" wmode=\""+wMode+"\"";
	codeStr += "devicefont=\"true\" bgcolor=\""+bgColor+"\"  width=\""+widthNum+"\" height=\""+hightNum+"\" align=\"middle\" type=\"application/x-shockwave-flash\" id=\""+id+"\"";
	codeStr += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">";
	codeStr += "</embed>";
	codeStr += "</object>";
	document.write(codeStr);
}

function footerSwf(url,widthNum,hightNum,Access,bgColor,wMode,vars){
	var codeStr = "";
	codeStr += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96B8-444553540000\"";
	codeStr += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.47.0\" width=\""+widthNum+"\" height=\""+hightNum+"\" id=\"SMS_Utility\">";
	codeStr += "<param name=\"allowScriptAccess\" value=\""+Access+"\" />";
	codeStr += "<param name=\"movie\" value=\""+url+"\" />";
	codeStr += "<param name=\"flashvars\" value=\""+vars+"\" />";
	codeStr += "<param name=\"id\" value=\"SMS_Utility\" />";
	codeStr += "<param name=\"menu\" value=\"false\" />";
	codeStr += "<param name=\"quality\" value=\"high\" />";
	codeStr += "<param name=\"wmode\" value=\""+wMode+"\" />";
	codeStr += "<param name=\"bgcolor\" value=\""+bgColor+"\" />";
	codeStr += "<embed src=\""+url+"\" flashvars=\""+vars+"\" allowScriptAccess=\""+Access+"\" menu=\"false\" quality=\"high\" wmode=\""+wMode+"\"";
	codeStr += "devicefont=\"true\" bgcolor=\""+bgColor+"\"  width=\""+widthNum+"\" height=\""+hightNum+"\" align=\"middle\" type=\"application/x-shockwave-flash\" id=\"SMS_Utility\"";
	codeStr += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">";
	codeStr += "</embed>";
	codeStr += "</object>";
	document.write(codeStr);
}

function islandToday(today, currentDate, badUser){
	var codeStr = "";
	codeStr += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"740\" height=\"462\" id=\"IslandToday\" align=\"middle\">";
	codeStr += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	codeStr += "<param name=\"allowFullScreen\" value=\"false\" />";
	codeStr += "<param name=\"movie\" value=\"/swf/fun/iland.swf?today=" + today + "&currentDate=" + currentDate + "&badUser=" + badUser + "\"/>";
	codeStr += "<param name=\"quality\" value=\"high\" /> ";
	codeStr += "<param name=\"wmode\" value=\"transparent\" />";
	codeStr += "<param name=\"FlashVars\" value=\"xmlpath=xml/\" />";
	codeStr += "<embed src=\"/swf/fun/iland.swf?today=" + today + "&currentDate=" + currentDate + "&badUser=" + badUser + "\" FlashVars=\"xmlpath=xml/\" quality=\"high\" bgcolor=\"#ffe38a\" width=\"740\" height=\"462\" name=\"malling_ecoupon\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
	codeStr += "</object>";
	document.write(codeStr);
}




// DreamWeaver Script
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.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);
  if(!x && document.getElementById) x=document.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() { //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_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_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
  var obj=MM_findObj(objStr);
  if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}

/************************************************************
* Popup Script 시작
************************************************************/

// Dreamweaver's Popup Script
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//  화면 정중앙에 POPUP WINODOW OPEN
function popCwin( url, name, w, h, scroll) {

  var wl = (window.screen.width/2) - ((w/2) + 10);
  var wt = (window.screen.height/2) - ((h/2) + 50);

  var option = "height="+h+",width="+w+",left="+wl+",top="+wt+",screenX="+wl+",screenY="+wt+",scrollbars="+scroll + ", status=yes";

  commonPopWin = window.open( url, name, option );
  commonPopWin.focus();
}

// 원하는 위치에 POPUP WINODOW OPEN
function popUwin( url, name, w, h, wl, wt, scroll) {

  var option = "status=no,height="+h+",width="+w+",resizable=no,left="+wl+",top="+wt+",screenX="+wl+",screenY="+wt+",scrollbars="+scroll;

  commonPopWin = window.open( url, name, option );
  commonPopWin.focus();
}

/************************************************************
* Popup Script 끝
************************************************************/


/************************************************************
* Link Blur Script 시작 -- 링크 점선 테두리 없애기 **** 적용페이지 body 에 onload="allblur()" 추가.
************************************************************/

/*이미지 클릭시 점선 없애기
function allblur() {
  for (i = 0; i < document.links.length; i++) {
    var obj = document.links[i];
    if(obj.addEventListener) obj.addEventListener("focus", oneblur, false);
    else if(obj.attachEvent) obj.attachEvent("onfocus", oneblur);
  }
}
*/
function autoBlur(){
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}catch(e) {}
}
document.onfocusin=autoBlur;

function oneblur(e) {
  var evt = e ? e : window.event;
  if(evt.target) evt.target.blur();
  else if(evt.srcElement) evt.srcElement.blur();
}

/************************************************************
* Link Blur Script 끝
************************************************************/



/************************************************************
* GoTop
************************************************************/
function GoTop() {
	window.scrollTo(0,0);
}

/************************************************************
* Family Site
************************************************************/
function changeUrl(f){
 window.open(url.value);
}


/*************************************************************************
* viewContents
*************************************************************************/

ok=0; old_what="non";
function viewContents(what){
	if((old_what != "non") && (what != old_what)){
		ok=1;
		document.getElementById(old_what).style.display="none";

		document.getElementById(what).style.display="";
	}else{
		if(ok){
			ok=0;
			document.getElementById(what).style.display="none";
		}else{
			ok=1;
			document.getElementById(what).style.display="";
		}
	}
	old_what=what;
}



/*************************************************************************
* Tab View			ex) tabView(0);
*************************************************************************/
function tabView(j)
{
	obj = document.all.nowprice;

	for(i=0; i<obj.length ;i++) {
		obj[i].style.display = 'none';
	}

	obj[j].style.display = 'block';
}

function introView(j)
{
	obj = document.all.introBox;

	for(i=0; i<obj.length ;i++) {
		obj[i].style.display = 'none';
	}

	obj[j].style.display = 'block';
}



/*************************************************************************
* Scrolling Top Button				ex) InitializeStaticMenu();
*************************************************************************/
var stmnLEFT = 892; // 스크롤메뉴의 좌측 위치
var stmnGAP1 = 120; // 페이지 헤더부분의 여백
var stmnGAP2 = 120; // 스크롤시 브라우저 상단과 약간 띄움. 필요없으면 0으로 세팅
var stmnBASE = 120; // 스크롤메뉴 초기 시작위치 (아무렇게나 해도 상관은 없지만 stmnGAP1과 약간 차이를 주는게 보기 좋음)
var stmnActivateSpeed = 200; // 움직임을 감지하는 속도 (숫자가 클수록 늦게 알아차림)
var stmnScrollSpeed = 2; // 스크롤되는 속도 (클수록 늦게 움직임)
var stmnBOTTOMGAP = 200; // 풋터 영역 지정

var stmnTimer;

function RefreshStaticMenu() {

	var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

	stmnStartPoint = parseInt(topButton.style.top, 10);
	stmnEndPoint = document.body.scrollTop + stmnGAP2;
	stmnLimit = parseInt(window.document.body.scrollHeight) - parseInt(topButton.offsetHeight) - stmnBOTTOMGAP;

	if (stmnEndPoint > stmnLimit) stmnEndPoint = stmnLimit;
	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

	stmnRefreshTimer = stmnActivateSpeed;

	if ( stmnStartPoint != stmnEndPoint ) {
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		topButton.style.top = parseInt(topButton.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
		stmnRefreshTimer = stmnScrollSpeed;
	}

	stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

function InitializeStaticMenu() {
	topButton.style.left = stmnLEFT;
	topButton.style.top = document.body.scrollTop + stmnBASE;
	RefreshStaticMenu();
}


/* file download ex) fldown('filename') // <iframe name="filedownload" width="0" height="0"></iframe> */
function fldown(URL){
	document.all.filedownload.src=URL;
}



/* image border */
function imgBox_over(obj) {
	var dds = obj.parentNode.getElementsByTagName('div');
	var index=0;
	var i=0;

	if(obj == dds[i]){
		if (dispNum=='01050101')
		{
			dds[i].getElementsByTagName('div')[0].className="thumb_layer01050101_on";
		}
		else if (firstDepth=='01' ^ firstDepth=='12' ^ firstDepth=='13' ^ firstDepth=='10')
		{
			dds[i].getElementsByTagName('div')[0].className="thumb_layer01_on";
		}
		else if (firstDepth=='00' ^ dispNum=='0105')
		{
			dds[i].getElementsByTagName('div')[0].className="adPrintList_layer_on";
		}
	}
}

function imgBox_out(obj) {
	var dds = obj.parentNode.getElementsByTagName('div');
	var index=0;
	var i=0;

	if(obj == dds[i]){
		dds[i].getElementsByTagName('div')[0].className="";
	}
}

/* 레이어보더로 인해 FF계열 클릭안되는것 해결위한 함수 */
function goView(src) {
	window.document.location= src;
}


function change_idpassfind1(id)
{
    var idpassfind1_array = new Array('01', '02');
    for(var i = 0; i < 2; i++)
    {
        if(id == 'idpassfind1_'+idpassfind1_array[i]) {
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById('idpassfind1_'+idpassfind1_array[i]).style.display = 'none';
		}
    }
}
function change_idpassfind2(id)
{
    var idpassfind2_array = new Array('01', '02');
    for(var i = 0; i < 2; i++)
    {
        if(id == 'idpassfind2_'+idpassfind2_array[i]) {
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById('idpassfind2_'+idpassfind2_array[i]).style.display = 'none';
		}
    }
}

function change_joinType(id)
{
    var joinType_array = new Array('01', '02', '03');
    for(var i = 0; i < 3; i++)
    {
        if(id == 'joinType_'+joinType_array[i]) {
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById('joinType_'+joinType_array[i]).style.display = 'none';
		}
    }
}

function change_bestFAQ(id)
{
    var bestFAQ_array = new Array('all','skymall', 'product', 'sw','homepage','etc');
    for(var i = 0; i < 6; i++)
    {
        if(id == 'bestFAQ_'+bestFAQ_array[i]) {
			document.getElementById(id).style.display = '';
		} else {
			document.getElementById('bestFAQ_'+bestFAQ_array[i]).style.display = 'none';
		}
    }
}

//Element ID 불러쓰기
function dEI(elementID){
	return document.getElementById(elementID);
}
// Tab Content
function tabCheck(dotabid , tnum){
	var inum=parseInt(tnum)-1;
	var linkTab=dEI(dotabid).getElementsByTagName("a");
	for (i=0;i<linkTab.length;i++) {
		var tabimg = linkTab.item(i).getElementsByTagName("img").item(0);
		var tabContents= dEI(dotabid+(1+i));
		if (i==inum) {
			if(tabContents.style.display!="block"){
			tabimg.src=tabimg.src.replace(".gif", "on.gif");
			tabContents.style.display="block";
			}
		}else{
		tabimg.src=tabimg.src.replace("on.gif", ".gif");
		tabContents.style.display="none";
		}
	}
}

//openDrop Layer
function viewInfo(list,total,num){
var size = total;// list count +1
var id = list;
	for(i=1;i<size;i++){
		var liEI = document.getElementById(id+i);
		if(i==num){
			if(liEI.className == "open"){
				liEI.className = "";
			}else{
				liEI.className = "open";
			}
		}else{
			liEI.className = "";
		}
	}
}

//오픈다이어리
function faqstyle(objid){

    this.titletype='image';
    this.titleonclass='on';
    this.titleonimagename='_on';
    this.closeothers=true;
    this.autoopen=0;

    var obj=document.getElementById(objid);
    var objtitle=obj.getElementsByTagName("span")[2];
    var titles=new Array(),contents=new Array();

    this.initialize=function(){
        var nodeno=0,childs=obj.childNodes;
        for(var i=0,max=childs.length; i<max; i++){
            if(childs[i].nodeType==1 && !hasClass(childs[i],"private")){
                if((nodeno%2)==0){
                    childs[i].myno=nodeno/2;
                    mousesetting(childs[i]);
                    childs[i].onclick=function(){
                        eval(objid).action(this.myno);
                        return false;
                    }
                    childs[i].style.cursor='pointer';
                    titles.push(childs[i]);
                    this.setclassoff(childs[i]);
                }else{
                    childs[i].style.display='none';
                    contents.push(childs[i]);
                }
                nodeno++;
            }
        }
        if(this.autoopen) this.action(this.autoopen-1);
    }

    this.setclasson=function(target){
        var classes,exist=false;
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[2];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=(titleimg.src.indexOf(this.titleonimagename+titleimgexp)==-1)? titleimg.src.replace(titleimgexp,this.titleonimagename+titleimgexp) : titleimg.src;
        }
        classes=target.className.split(' ');
        for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) exist=true;
        if(!exist) target.className=target.className+' '+this.titleonclass;
    }

    this.setclassoff=function(target){
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[2];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=titleimg.src.replace(this.titleonimagename+titleimgexp,titleimgexp);
        }
        if(target.className.indexOf(this.titleonclass)!=-1){
            if(target.className.indexOf(' ')==-1) target.className=target.className.replace(this.titleonclass,'');
            else{
                classes=target.className.split(' ');
                for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) classes[j]='';
                target.className=classes.join(' ');
            }
        }
    }

    var mousesetting=function(target,remove){
        if(remove){
            target.onmouseover=null;
            target.onmouseout=null;
        }else{
            //target.onmouseover=function(){
             //   eval(objid).setclasson(this);
            //}
            target.onmouseout=function(){
                eval(objid).setclassoff(this);
            }
        }
    }

    this.action=function(no){
        for(var i=0,max=titles.length; i<max; i++){
            if(i==no){
                mousesetting(titles[i],true);
                this.setclasson(titles[i]);
                if(contents[i].style.display=='none') contents[i].style.display='';
                else{
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }else{
                if(this.closeothers){
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }
            if(contents[i].style.display=='none') mousesetting(titles[i]);
        }
    }

}
//message list open
function listopen(objid){

    this.titletype='image';
    this.titleonclass='on';
    this.titleonimagename='_on';
    this.closeothers=true;
    this.autoopen=0;

    var obj=document.getElementById(objid);
    var objtitle=obj.getElementsByTagName("span")[2];
    var titles=new Array(),contents=new Array();

    this.initialize=function(){
        var nodeno=0,childs=obj.childNodes;
        for(var i=0,max=childs.length; i<max; i++){
            if(childs[i].nodeType==1 && !hasClass(childs[i],"private")){
                if((nodeno%2)==0){
                    childs[i].myno=nodeno/2;
                    mousesetting(childs[i]);
                    childs[i].onclick=function(){
                        eval(objid).action(this.myno);
                        return false;
                    }
                    childs[i].style.cursor='pointer';
                    titles.push(childs[i]);
                    this.setclassoff(childs[i]);
                }else{
                    childs[i].style.display='none';
                    contents.push(childs[i]);
                }
                nodeno++;
            }
        }
        if(this.autoopen) this.action(this.autoopen-1);
    }

    this.setclasson=function(target){
        var classes,exist=false;
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[1];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=(titleimg.src.indexOf(this.titleonimagename+titleimgexp)==-1)? titleimg.src.replace(titleimgexp,this.titleonimagename+titleimgexp) : titleimg.src;
        }
        classes=target.className.split(' ');
        for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) exist=true;
        if(!exist) target.className=target.className+' '+this.titleonclass;
    }

    this.setclassoff=function(target){
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[1];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=titleimg.src.replace(this.titleonimagename+titleimgexp,titleimgexp);
        }
        if(target.className.indexOf(this.titleonclass)!=-1){
            if(target.className.indexOf(' ')==-1) target.className=target.className.replace(this.titleonclass,'');
            else{
                classes=target.className.split(' ');
                for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) classes[j]='';
                target.className=classes.join(' ');
            }
        }
    }

    var mousesetting=function(target,remove){
        if(remove){
            target.onmouseover=null;
            target.onmouseout=null;
        }else{
            //target.onmouseover=function(){
             //   eval(objid).setclasson(this);
            //}
            target.onmouseout=function(){
                eval(objid).setclassoff(this);
            }
        }
    }

    this.action=function(no){
        for(var i=0,max=titles.length; i<max; i++){
            if(i==no){
                mousesetting(titles[i],true);
                this.setclasson(titles[i]);
                if(contents[i].style.display=='none') contents[i].style.display='';
                else{
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }else{
                if(this.closeothers){
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }
            if(contents[i].style.display=='none') mousesetting(titles[i]);
        }
    }

}

//message list out
function listout(objid){

    this.titletype='image';
    this.titleonclass='on';
    this.titleonimagename='_on';
    this.closeothers=true;
    this.autoopen=0;

    var obj=document.getElementById(objid);
    var objtitle=obj.getElementsByTagName("span")[2];
    var titles=new Array(),contents=new Array();

    this.initialize=function(){
        var nodeno=0,childs=obj.childNodes;
        for(var i=0,max=childs.length; i<max; i++){
            if(childs[i].nodeType==1){
                if((nodeno%2)==0){
                    childs[i].myno=nodeno/2;
                    mousesetting(childs[i]);
                    childs[i].onclick=function(){
                        eval(objid).action(this.myno);
                        return false;
                    }
                    childs[i].style.cursor='pointer';
                    titles.push(childs[i]);
                    this.setclassoff(childs[i]);
                }else{
                    childs[i].style.display='none';
                    contents.push(childs[i]);
                }
                nodeno++;
            }
        }
        if(this.autoopen) this.action(this.autoopen-1);
    }

    this.setclasson=function(target){
        var classes,exist=false;
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[0];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=(titleimg.src.indexOf(this.titleonimagename+titleimgexp)==-1)? titleimg.src.replace(titleimgexp,this.titleonimagename+titleimgexp) : titleimg.src;
        }
        classes=target.className.split(' ');
        for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) exist=true;
        if(!exist) target.className=target.className+' '+this.titleonclass;
    }

    this.setclassoff=function(target){
        if(this.titletype=='image'){
            var titleimg=target.getElementsByTagName('img')[0];
            var titleimgexp=titleimg.src.substring(titleimg.src.lastIndexOf('.'));
            titleimg.src=titleimg.src.replace(this.titleonimagename+titleimgexp,titleimgexp);
        }
        if(target.className.indexOf(this.titleonclass)!=-1){
            if(target.className.indexOf(' ')==-1) target.className=target.className.replace(this.titleonclass,'');
            else{
                classes=target.className.split(' ');
                for(var j=0; j<classes.length; j++) if(classes[j]==this.titleonclass) classes[j]='';
                target.className=classes.join(' ');
            }
        }
    }

    var mousesetting=function(target,remove){
        if(remove){
            target.onmouseover=null;
            target.onmouseout=null;
        }else{
            //target.onmouseover=function(){
             //   eval(objid).setclasson(this);
            //}
            target.onmouseout=function(){
                eval(objid).setclassoff(this);
            }
        }
    }

    this.action=function(no){
        for(var i=0,max=titles.length; i<max; i++){
            if(i==no){
                mousesetting(titles[i],true);
                this.setclasson(titles[i]);
                if(contents[i].style.display=='none') contents[i].style.display='';
                else{
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }else{
                if(this.closeothers){
                    this.setclassoff(titles[i]);
                    contents[i].style.display='none';
                }
            }
            if(contents[i].style.display=='none') mousesetting(titles[i]);
        }
    }

}
//imageOver
function imageOver(objImg) {	objImg.src = objImg.src.replace("off.gif", "on.gif");}
function imageOut(objImg) {	objImg.src = objImg.src.replace("on.gif", "off.gif");}

// Embeded function image Over
function menuOver() {	this.src = this.src.replace("_off.gif", "_on.gif");}
function menuOut() {	this.src = this.src.replace("_on.gif", "_off.gif");}

// Layer Show-Hide
function showLayer(tgtEl)    {    document.getElementById(tgtEl).style.display = "block";    }
function hideLayer(tgtEl)    {    document.getElementById(tgtEl).style.display = "none";    }

// Tabbed menu
function initTabMenu(menuElId) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	if(tabMenu.length > 0){
		for(i=0; i<tabMenu.length; i++) {
			thismenu = tabMenu.item(i);
			thismenu.menuContainer = document.getElementById(menuElId);
			thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
			thismenu.targetEl.style.display = "none";
			if(thismenu.getElementsByTagName("img").length>0)	{
				thismenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
				thismenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			}
			thismenu.onclick = tabMenuClick;
		}
		initmenu = tabMenu.item(0);
		initmenu.menuContainer = document.getElementById(menuElId);
		initmenu.targetEl = document.getElementById(initmenu.href.split("#")[1]);
		initmenu.targetEl.style.display = "block";
		initmenu.className = "activate";
		if(initmenu.getElementsByTagName("img").length>0)	{
			initmenu.getElementsByTagName("img").item(0).onmouseover();
			initmenu.getElementsByTagName("img").item(0).onmouseover = null;
			initmenu.getElementsByTagName("img").item(0).onmouseout = null;
		}
		initmenu.menuContainer.current = initmenu;
	}
}
function tabMenuClick() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		currentmenu.className = null;
		if(currentmenu.getElementsByTagName("img").length>0)	{
			currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
			currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			currentmenu.getElementsByTagName("img").item(0).onmouseout();
		}
		this.targetEl.style.display = "block";
		this.className = "activate";
		if(this.getElementsByTagName("img").length>0)	{
			this.getElementsByTagName("img").item(0).onmouseover = null;
			this.getElementsByTagName("img").item(0).onmouseout = null;
		}
		this.menuContainer.current = this;
	}
	return false;
}


function initTabMenuClick(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "off");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function tabChange(obj,num,imgId,total) {
    for (i=1; i<=total; i++)    {
        var imgIds = document.getElementById(imgId+i);
        var imgSrc = imgIds.getAttribute("src");
        if (i==num)    {
            document.getElementById(obj+i).style.display = '';
            imgIds.setAttribute("src",imgSrc.replace("_off","_on"));
        }
        else {
            document.getElementById(obj+i).style.display = 'none';
            imgIds.setAttribute("src",imgSrc.replace("_on","_off"));
        }
    }
}


// div popup
function prdLyrView(lid,n,total) {
    var ht = document.body.clientHeight; // if DTD is xhtml, document.documentElement.clientHeight;
    var target = document.getElementById(lid+n);

    if (total != 0)    {
        for (var i=1; i<=total; i++) {
            document.getElementById(lid+i).style.display = (i==n ? 'block':'none');
        }
    } else {
        target.style.display = 'none';
    }
}
// tree menu
function menuOpenClose(id, target) {
	var root = document.getElementById(id);
	var menu_item = root.getElementsByTagName("dl");
	for (var i = 0; i < menu_item.length; i++) {
		if (menu_item[i] === target) {
			target.className = "open";
		} else {
			menu_item[i].className = "close";
		}
	}
}


// Input Click
function schInput(obj,chknum) {
    if (chknum == 1) {
        obj.className = 'imgin';
    }
    else {
        if (obj.value == '') {
            obj.className = 'imgin';
            obj.value = '';
        }
    }
}
// Input Click
function schInput2(obj,chknum) {
    if (chknum == 1) {
        obj.className = 'imgnon';
    }
    else {
        if (obj.value == '') {
            obj.className = 'imgnon';
            obj.value = '';
        }
    }
}

// Radio
/*
function viewpall(n, txt, count){
  var txtn;
  var view;
  var count2 = parseInt(count)+1;
  for(i=1;i<count2;i++){
	txtn = txt+eval(i);
	view = eval("this.viewp"+txt+i);
	if(n==txtn){
	   view.style.display = "";
	}
	else{
	   view.style.display = "none";
	}
  }
}
*/

function viewpall(elm, s_id, c_check) {
	var elm_name = elm.getAttribute("name");
	var elm_value = elm.getAttribute("value");
	var inputs = elm.parentNode.getElementsByTagName("input");
	var conts = [];
	for (var i = 0, cont_id; i < inputs.length; i++) {
		cont_id = elm_name + inputs[i].getAttribute("value");
		conts[i] = document.getElementById(cont_id);
		conts[i].style.display = "none";
	}
	conts[(elm_value - 1)].style.display = "";
	if (s_id && !window.c_check) {
		new Selectbox(s_id, {fontSize:11,optTxtColor:'#666',optTxtHover:'#000',optBgHover:'#DEDEE0'});
		window.c_check = true;
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function hasClass(element, value) {
	var re = new RegExp("(^|\\s)" + value + "(\\s|$)");
	return re.test(element.className);
}

function winOpen(url,args,width,height,winName,sc)
{
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2.3;
	var open = window.open(url + args,winName,"width=" + width + ",height=" + height + ",scrollbars=" + sc + ",status=yes,left=" + left + ",top=" + top + ",toolbar=no,status=no");
	open.focus();
}


function LoginPop() {
	var url = "http://member.isky.co.kr/login.sky";
	var msg = "로그인을 하셔야 이용하실 수 있습니다. \n로그인 하시겠습니까?";

	if (confirm(msg)) {
		var win = window.open(url,"LOGIN", 'scrollbars=no,status=no,resizable=yes,width=510,height=400');
		win.focus();
	} else {
		return;
	}
}

function returnLoginPop(){
	var url = "http://member.isky.co.kr/login.sky";
	var msg = "로그인을 하셔야 이용하실 수 있습니다. \n로그인 하시겠습니까?";
	var ans = confirm(msg);
	if(ans == true){
		var win = window.open(url,"LOGIN", 'scrollbars=no,status=no,resizable=yes,width=510,height=400');
	}else{
		history.back();
	}
}
/***********************************************************************************************
	로그인 변경
***********************************************************************************************/

//로그인 체크(컨펌) LoginConfirm(parent.current_url)
function LoginConfirm(returnUrl){
	
	var url = "http://www.isky.co.kr/login.sky";
	var defaultUrl = "http://www.isky.co.kr";

	if(returnUrl != null && returnUrl != ""){
		url += ("?p_url=" + returnUrl);
	}else{
		url += "?p_url=" + defaultUrl;
	}

	var msg = "로그인을 하셔야 이용하실 수 있습니다. \n로그인 하시겠습니까?";
	var ans = confirm(msg);
	if(ans == true){		
		if(parent){
			parent.location.href = url;
		}else{
			location.href = url;
		}
	}
}

//로그인 체크(컴펌, 히스토리백)
function LoginConfirmReturn(returnUrl){
	
	var url = "http://www.isky.co.kr/login.sky";
	var defaultUrl = "http://www.isky.co.kr";

	if(returnUrl != null && returnUrl != ""){
		url += ("?p_url=" + returnUrl);
	}else{
		url += "?p_url=" + defaultUrl;
	}

	var msg = "로그인을 하셔야 이용하실 수 있습니다. \n로그인 하시겠습니까?";
	var ans = confirm(msg);
	if(ans == true){		
		if(parent){
			parent.location.href = url;
		}else{
			location.href = url;
		}
	}else{
		history.back();
	}
}

/***********************************************************************************************

***********************************************************************************************/

function LoginPopNoMessgae() {
	var url = "http://member.isky.co.kr/login.sky";

	var win = window.open(url,"LOGIN", 'scrollbars=no,status=no,resizable=yes,width=510,height=400');
	win.focus();
}


function footerOpen() {
	document.getElementById("footer2").className = "Open";
}
function footerClose() {
	document.getElementById("footer2").className = "Close";
}


function flashPaymentPop() {
 var url = "http://message.isky.co.kr/payment/flashPayreq.sky";

 var win = window.open(url,"PAYMENT", 'scrollbars=no,status=no,resizable=yes,width=678,height=260');
 win.focus();
}


/*** 덧글 중복등록 방지(20초 후에 등록가능) ***/
var writeCookieName = "UserWrite";
var writeCookieValue = "Yes";
var writeCookieSec = 20;
var writeCookieMsg = "20초 후 덧글 등록이 가능합니다.";
var writeCookieDomain = ".isky.co.kr";

function setCookieWrite() {
   var tt = new Date(); 
   tt.setSeconds( tt.getSeconds() + writeCookieSec ); 

//   document.cookie = writeCookieName +"=" + escape(writeCookieValue) + "; path=/; domain=" + writeCookieDomain + "; max-age=" + writeCookieSec + "; expires=" + today.toGMTString() + ";"
   

   document.cookie = writeCookieName +"=" + escape(writeCookieValue) + "; path=/; domain=" + writeCookieDomain + "; expires=" + tt.toGMTString() + ";" 

} 

function getCookieWrite() { 
   var nameOfCookie = writeCookieName + "=";    
   var x = 0;      
   while ( x <= document.cookie.length ) 
   { 
		   var y = (x+nameOfCookie.length); 
		   if ( document.cookie.substring( x, y ) == nameOfCookie ) { 
				   if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
						   endOfCookie = document.cookie.length; 
				   return unescape( document.cookie.substring( y, endOfCookie ) ); 
		   } 
		   x = document.cookie.indexOf( " ", x ) + 1; 
		   if ( x == 0 ) 
				   break; 
   } 
   return ""; 
}

function cookieWriteMsg(){
	alert(writeCookieMsg);
}