// Flash publishing with Cross Browsing
/* function swfprint(furl,fwidth,fheight,transoption)	{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ fwidth +'" height="' + fheight +'" align="middle">');
	document.write('<param name="movie" value="'+ furl +'"/>');
	if (transoption == "t")	{
		document.write('<param name="wmode" value="transparent"/>');
	} else if	(transoption == "o")	{
		document.write('<param name="wmode" value="opaque"/>');
	}
	document.write('<!-- Hixie method -->');
	document.write('<!--[if !IE]> <-->');
	document.write('<object type="application/x-shockwave-flash" data="'+ furl +'" width="'+ fwidth +'" height="' + fheight +'"');
	if (transoption == "t")	{
		document.write(' wmode="transparent"');
	} else if	(transoption == "o")	{
		document.write(' wmode="opaque"');
	}
	document.write('></object>');
	document.write('<!--> <![endif]-->');
	document.write('</object>');
} */




//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();
}

//Popup
function wopen(url,name,w,h,s) {
    if(s==1)    {
        sOp = ",scrollbars=yes";
    } else  if(s==0)   {
        sOp = "";
    }
    winOptions = getCenterOption(w, parseInt(h, 10)) + ',width='+w+',height='+h+sOp;
    window.open(url, name, winOptions);
}
//Popup Close
function wclose()     {
    window.close();
}
//Popup Print
function wprint()     {
    window.print();
}
// 가로,세로 사이즈에 맞는 센터지점의 속성값을 반환한다.
function getCenterOption(winwidth, winheight) {
    var winx = Math.ceil((screen.availWidth - winwidth) / 2);
    var winy = Math.ceil((screen.availHeight - winheight) / 2);
    return "left=" + winx + ",top=" + winy;
}
//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 '';
}

// 스크롤바에 따라다니는 레이어 스크립트
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}
/* 이미지 로테이트 */
function rotatecontents(objectid){

    this.titleobject=null;
    this.titlesetbyrule=null;
    this.pagingobject=null;
    this.pagingstart='';
    this.pagingdelimiter='/';
    this.pagingend='';
    this.rotatemethod=null;
    this.maxzindex=1;
    this.speed=5;
    this.autoplay=true;
    this.autoplaytime=3;

    this.buttonobject=null;
    this.buttontype='text';
    this.buttononclassname='on';
    this.buttononimagename='';

    this.addtitle=function(title){
        titles.push(title);
    }

    var object=document.getElementById(objectid);
    var items=new Array(),itemsnum,titles=new Array();
    var btns=new Array(),btnsmover=new Array(),btnsmout=new Array();
    var speed,timer,nowno=0,canimove=true;
    var isie=(navigator.userAgent.toLowerCase().indexOf('msie')!=-1)? true : false;

    this.initialize=function(){
        var isfirst=true,removeobjs=new Array(),childs=object.childNodes;
        for(var i=0,j=-1,max=childs.length; i<max; i++){
            if(childs[i].nodeType==1){
                j++;
                if(this.titleobject){
                    if(this.titlesetbyrule=='alt'){
                        titles.push((childs[i].nodeName.toLowerCase()=='img')? childs[i].alt : childs[i].getElementsByTagName('img')[0].alt);
                    }else if(this.titlesetbyrule=='nextobject' && j%2){
                        titles.push(childs[i].innerHTML);
                        removeobjs.push(childs[i]);
                        continue;
                    }else if(this.titlesetbyrule=='prevobject' && j%2==0){
                        titles.push(childs[i].innerHTML);
                        removeobjs.push(childs[i]);
                        continue;
                    }
                }
                if(!isfirst) childs[i].style.display='none';
                items.push(childs[i]);
                if(this.rotatemethod=='overlap' || this.rotatemethod=='slide' || this.rotatemethod=='fadein'){
                    speed=this.speed;
                    object.style.position='relative';
                    with(childs[i].style){
                        position='absolute';
                        left='0px';
                        top='0px';
                        width=object.offsetWidth+'px';
                    }
                    if(this.rotatemethod=='fadein'){
                        setopacity(childs[i],(isfirst)? 100 : 0);
                    }
                }
                if(isfirst) isfirst=false;
            }
        }
        itemsnum=items.length;
        if(removeobjs[0]){
            for(var i=0,max=removeobjs.length; i<max; i++) object.removeChild(removeobjs[i]);
        }
        if(this.titleobject) this.titleobject=(titles[0])? document.getElementById(this.titleobject) : null;
        if(this.pagingobject) this.pagingobject=document.getElementById(this.pagingobject);
        this.settitlenpaging(nowno);
        object.style.width=object.offsetWidth+'px';
        object.style.height=object.offsetHeight+'px';
        object.style.overflow='hidden';
        object.onmouseover=function(){
            clearTimeout(eval(objectid).autoplaytimer);
        }
        object.onmouseout=function(){
            eval(objectid).autoplayaction();
        }
        if(this.buttonobject){
            this.buttonobject=document.getElementById(this.buttonobject);
            var childs=this.buttonobject.childNodes;
            for(var i=0,j=0,max=childs.length; i<max; i++){
                if(childs[i].nodeType==1){
                    childs[i].myno=j;
                    if(childs[i].onmouseover) btnsmover.push(childs[i].onmouseover);
                    if(childs[i].onmouseout) btnsmout.push(childs[i].onmouseout);
                    btns.push(childs[i]);
                    j++;
                }
            }
            if(items.length!=btns.length) this.buttonobject=null;
            else this.setbtns();
        }
        this.autoplayaction();
    }

    this.settitlenpaging=function(no){
        if(this.titleobject) this.titleobject.innerHTML=titles[no];
        if(this.pagingobject) this.pagingobject.innerHTML=this.pagingstart+(no+1)+this.pagingdelimiter+itemsnum+this.pagingend;
    }

    this.setzindex=function(no){
        for(var i=0; i<itemsnum; i++){
            if(i==no){
                items[i].style.zIndex=this.maxzindex+3;
                items[i].style.display='';
            }else if(i==nowno){
                items[i].style.zIndex=this.maxzindex+2;
            }else{
                items[i].style.zIndex=this.maxzindex+1;
                items[i].style.display='none';
            }
        }
    }

    this.setbtns=function(no){
        if(!no && no!==0) no=nowno;
        for(var i=0; i<itemsnum; i++){
            if(i==no){
                this.setbtnon(btns[i]);
                btns[i].onmouseover=null;
                btns[i].onmouseout=null;
            }else{
                this.setbtnoff(btns[i]);
                btns[i].onmouseover=function(){
                    eval(objectid).setbtnon(this);
                    if(btnsmover[this.myno]) btnsmover[this.myno]();
                }
                btns[i].onmouseout=function(){
                    eval(objectid).setbtnoff(this);
                    if(btnsmout[this.myno]) btnsmout[this.myno]();
                }
            }
        }
    }

    this.setbtnon=function(target){
        var classes,exist=false;
        if(this.buttontype=='image'){
            var btnimg=target.getElementsByTagName('img')[0];
            var btnimgexp=btnimg.src.substring(btnimg.src.lastIndexOf('.'));
            if(btnimg.src.indexOf(this.buttononimagename+btnimgexp)==-1) btnimg.src=btnimg.src.replace(btnimgexp,this.buttononimagename+btnimgexp);
        }
        classes=target.className.split(' ');
        for(var i=0; i<classes.length; i++) if(classes[i]==this.buttononclassname) exist=true;
        if(!exist) target.className=target.className+' '+this.buttononclassname;
    }

    this.setbtnoff=function(target){
        var classes;
        if(this.buttontype=='image'){
            var btnimg=target.getElementsByTagName('img')[0];
            var btnimgexp=btnimg.src.substring(btnimg.src.lastIndexOf('.'));
            if(btnimg.src.indexOf(this.buttononimagename+btnimgexp)!=-1) btnimg.src=btnimg.src.replace(this.buttononimagename+btnimgexp,btnimgexp);
        }
        if(target.className.indexOf(this.buttononclassname)!=-1){
            if(target.className.indexOf(' ')==-1) target.className=target.className.replace(this.buttononclassname,'');
            else{
                classes=target.className.split(' ');
                for(var i=0; i<classes.length; i++) if(classes[i]==this.buttononclassname) classes[i]='';
                target.className=classes.join(' ');
            }
        }
    }

    this.change=function(no){
        no=no-1;
        if(no!=nowno){
            if(this.rotatemethod=='overlap') this.moveaction('overlap',no,(no<nowno)? 'prev' : 'next');
            else if(this.rotatemethod=='slide') this.moveaction('slide',no,(no<nowno)? 'prev' : 'next');
            else if(this.rotatemethod=='fadein') this.fadeinaction(no);
            else this.hideitem(no);
            this.settitlenpaging(no);
            if(this.buttonobject) this.setbtns(no);
        }
    }

    this.prev=function(){
        var prevno=(nowno==0)? itemsnum-1 : nowno-1;
        if(this.rotatemethod=='overlap') this.moveaction('overlap',prevno,'prev');
        else if(this.rotatemethod=='slide') this.moveaction('slide',prevno,'prev');
        else if(this.rotatemethod=='fadein') this.fadeinaction(prevno);
        else this.hideitem(prevno);
        this.settitlenpaging(prevno);
    }

    this.next=function(){
        var nextno=(nowno==(itemsnum-1))? 0 : nowno+1;
        if(this.rotatemethod=='overlap') this.moveaction('overlap',nextno,'next');
        else if(this.rotatemethod=='slide') this.moveaction('slide',nextno,'next');
        else if(this.rotatemethod=='fadein') this.fadeinaction(nextno);
        else this.hideitem(nextno);
        this.settitlenpaging(nextno);
        if(this.buttonobject) this.setbtns(nextno);
    }

    this.autoplaytimer=null;
    this.autoplayaction=function(){
        if(!this.autoplay) return;
        this.autoplaytimer=setTimeout(objectid+'.next()',this.autoplaytime*1000);
    }

    this.hideitem=function(no){
        clearTimeout(this.autoplaytimer);
        for(var i=0; i<itemsnum; i++) items[i].style.display=(i==no)? '' : 'none';
        this.autoplayaction();
        nowno=no;
    }

    var getleft=function(no){
        var l = 0;
        if(items[no] != null)
        {
            l = parseInt(items[no].style.left);
        }
        return l;
    }

    var setleft=function(no,value){
        var l = "0px";
        if(items[no] != null)
        {
            l = items[no].style.left=value+'px';
        }
    }

    this.moveaction=function(method,no,direction){
        clearTimeout(this.autoplaytimer);
        if(canimove){
            canimove=false;
            setleft(no,(direction=='prev')? -(object.offsetWidth) : object.offsetWidth);
            this.setzindex(no);
            var now,snow,to=0,mv=0;
            var action=function(){
                clearTimeout(timer);
                now=getleft(no);
                if(method=='slide') snow=getleft(nowno);
                if(now!=to){
                    mv=(now-to)/speed;
                    setleft(no,(direction=='prev')? Math.ceil(now-mv) : Math.floor(now-mv));
                    if(method=='slide') setleft(nowno,(direction=='prev')? Math.ceil(snow-mv) : Math.floor(snow-mv));
                    setTimeout(action,10);
                }else{
                    eval(objectid+'.autoplayaction()');
                    clearTimeout(timer);
                    canimove=true;
                    nowno=no;
                }
            }
            action();
        }
    }

    var getopacity=function(target){
        return (isie)? parseInt(target.style.filter.match(/alpha\(opacity=([0-9]+)\)/)[1]) : target.style.opacity*100;
    }

    var setopacity=function(target,value){
        if(isie) target.style.filter='alpha(opacity='+value+')';
        else target.style.opacity=value/100;
    }

    this.fadeinaction=function(no){
        clearTimeout(this.autoplaytimer);
        if(canimove){
            canimove=false;
            setopacity(items[no],0);
            this.setzindex(no);
            var nowo,to=0;
            var action=function(){
                clearTimeout(timer);
                nowo=getopacity(items[no]);
                if(nowo!=100){
                    setopacity(items[no],Math.ceil(nowo+(100-nowo)/speed));
                    setTimeout(action,10);
                }else{
                    eval(objectid+'.autoplayaction()');
                    clearTimeout(timer);
                    canimove=true;
                    nowno=no;
                }
            }
            action();
        }
    }

}

function faqstyle(objid){

    this.titletype='text';
    this.titleonclass='on';
    this.titleonimagename='';
    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]);
        }
    }

}

/* function fnOpenLayer() {
	var obj = document.getElementById("mypersonal");
	if (obj.clientHeight == 60) {
		obj.style.height = "245px";
	} else {
		obj.style.height = "60px";
	}
} */

function MyOpen_Show() {
 var obj = document.getElementById("mypersonal");
 if (obj.clientHeight == 60) {
  obj.parentNode.className += ' open';
  obj.style.height = "245px";
  obj.getElementsByTagName("img").item(0).src = obj.getElementsByTagName("img").item(0).src.replace("open.gif", "close.gif");
 } else {
  obj.parentNode.className = obj.parentNode.className.replace('open', '');
  obj.style.height = "60px";
  obj.getElementsByTagName("img").item(0).src = obj.getElementsByTagName("img").item(0).src.replace("close.gif", "open.gif");
 }
}
