/*
 * author     : Kang, Seung Moon
 * Created on  : 2008.11.06
*/
/*
ÇÃ·¡½Ã
*/
function swf(src,w,h,name,flashVar){
	html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"  width="'+w+'" height="'+h+'" name="'+name+'" id="'+name+'">';
	html += '<param name="movie" value="' + src + '">';
	html += '<param name="quality" value="high">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="allowScriptAccess" value="always">';
	html += '<param name="flashvars" value="'+flashVar+'">';
	html += '<embed src="'+src+'" FlashVars="'+flashVar+'"allowScriptAccess="always" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" name="'+name+'" id="'+name+'"></embed>';
	html += '</object>';
	document.write(html);
	
}

function swf02(src,w,h,name,flashVar){
	html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"  width="'+w+'" height="'+h+'" name="'+name+'" id="'+name+'">';
	html += '<param name="movie" value="' + src + '">';
	html += '<param name="quality" value="high">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="flashvars" value="'+flashVar+'">';
	html += '<embed src="'+src+'" FlashVars="'+flashVar+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" name="'+name+'" id="'+name+'"></embed>';
	html += '</object>';
	return html;
}

/*
ÅÇ
*/
function tab_change(id,t,n,c) {
	var t =t+1;
	for (i=1; i<t; i++) {
		
		if (i==n) {
			tabImgId = document.getElementById(id + i);
			imgexp="_on.gif";
			if (tabImgId != null) {
			(tabImgId.src.search(imgexp) != "-1")? "" : tabImgId.src = tabImgId.src.replace(".gif","_on.gif");
			}
			conId = document.getElementById(c + i);
			if (c != null) {
				if(conId != null) {
				conId.style.display="block";
			    }
			}
		} else {
			tabImgId = document.getElementById(id + i);
			imgexp="_on.gif";
			if (tabImgId != null) {
			(tabImgId.src.search(imgexp) != "-1")? tabImgId.src = tabImgId.src.replace("_on.gif",".gif") : "" ;
			}

			conId = document.getElementById(c + i);
			if (c != null) {
				if(conId != null) {
				conId.style.display="none";
				}
			}
		}
	}
}
function tab_change2(t,n,c) {
	var t =t+1;
	for (var i=1; i<t; i++) {	
		if (i==n) {
			if (c != null) {
			document.getElementById(c + i).style.display="block";
			}
		} else {			
			if (c != null) {
			document.getElementById(c + i).style.display="none";
			}
		}
	}
}
/*
Åõ¸í ÀÌ¹ÌÁö(png)
*/
function setPng(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng\b/i,'');

	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src=''; 
	return '';
}
/*
input box ¹é±×¶ó¿îµå ÀÌ¹ÌÁö(°í°´¼¾ÅÍ¸ÞÀÎ)
*/
function mainclearbg(id) {
	document.getElementById(id).style.backgroundImage="url(/imgs/center/main/m_search_bg.gif)";
}
function researchclearbg(id) {
	document.getElementById(id).style.backgroundImage="url(/imgs/research/main/m_search_bg.gif)";
}
/*
ÁÖ½Ä¼±¹°¿É¼Ç layer ³ôÀÌÁ¦¾î
*/
function layerSpread(box,minh,maxh,u,d) {
	var box = document.getElementById(box);
	var u = document.getElementById(u);
	var d = document.getElementById(d);
	if ( !d.style.display || d.style.display == "none") {
		u.style.display = "none";
		d.style.display = "block";
		box.style.height = ""+maxh+"px";
	} else {
		u.style.display = "block";
		d.style.display = "none";
		box.style.height = ""+minh+"px";
	}
	
}

function showDLayer(l){
	var obj = document.getElementById(l);
	obj.style.display="block";
	viewLayer = true;
}

function hideDLayer(l){
	var obj = document.getElementById(l);
	obj.style.display="none";
	viewLayer = false;
}

/*
±ÝÀ¶»óÇ°¸ô layer displayÁ¦¾î
*/
function layerView(layer) {
	var obj = document.getElementById(layer);
	if ( !obj.style.display || obj.style.display == "none" ) {
		obj.style.display = "block";
	} else {
		obj.style.display = "none";
	}
}

/*
layer¿¡ ÇÃ·¡½Ã ºÙÀÌ°í ´Ù½Ã Áö¿ì´Â ±â´É
*/
function  layerAdd(layer, isAdd, swfLoader, swf_width, swf_height ) {
	var obj = document.getElementById(layer);
	if ( isAdd == 'true' )
		obj.innerHTML = swf02(swfLoader, swf_width, swf_height);
	else
		obj.innerHTML = "";
}

/*
±ÝÀ¶»óÇ°¸ô ¸ÞÀÎ°Ë»ö
*/
function searchTypeVal(l,i,v) {
	obj_l = document.getElementById(l);
	obj_i = document.getElementById(i);
	obj_i.value = v;
	obj_l.style.display = "none";
}
/*
±ÝÀ¶»óÇ°¸ô ¸ÞÀÎ°øÁö»çÇ× ¿­±â
*/
function mbg_change(i)	{
	obj_i = document.getElementById(i);
	document.getElementById('content_bg').src = '/imgs/main/content_bg_on.png';	
}

function goUrl(url,target) {
  if(url != 0) { 
    window.open(url,target);
    }
}

/* GNB */
function menu_view(num){
	for(i=1; i<2; i++){
		var chk_layer = document.getElementById("depth"+i);
		var chk_img = document.getElementById("depthImg"+i);
		if(i==num){
			chk_layer.className="on";
			chk_img.src="/imgs/new/header/gnb0"+i+"_on.gif";
		}else{
			chk_layer.className="off";
			chk_img.src="/imgs/new/header/gnb0"+i+".gif";
		}
	}
}
function menu_hidden(){
	for(i=1; i<2; i++){
		var chk_layer = document.getElementById("depth"+i);
		var chk_img = document.getElementById("depthImg"+i);
		chk_layer.className="off";
		chk_img.src="/imgs/new/header/gnb0"+i+".gif";
	}
}

///È­¸é È®´ë Ãà¼Ò ½ÃÀÛ IE Àü¿ë  
var nowZoom = 100; // ÇöÀçºñÀ²
var maxZoom = 200; // ÃÖ´ëºñÀ²(500À¸·ÎÇÏ¸é 5¹è Ä¿Áø´Ù)
var minZoom = 80; // ÃÖ¼ÒºñÀ²

//È­¸é Å°¿î´Ù.
function zoomIn()
{
    if (nowZoom < maxZoom)
    {
        nowZoom += 10; //10%¾¿ Ä¿Áø´Ù.
    } 
    else
    {
        return;
    }
    document.body.style.zoom = nowZoom + "%";
}

//È­¸é ÁÙÀÎ´Ù.
function zoomOut()
{
    if (nowZoom > minZoom)
    {
        nowZoom -= 10; //10%¾¿ ÀÛ¾ÆÁø´Ù.
    } 
    else
    {
        return;
    }
    document.body.style.zoom = nowZoom + "%";
}


// image rollover/rollout
function imgOver(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function imgOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

function imgOver2(imgE2) {
	imgE2.src = imgE2.src.replace("_off", "_on");
}
function imgOut2(imgE2) {
	imgE2.src = imgE2.src.replace("_on", "_off");
}

// image rolling
var TINY={};

function rn(i){return document.getElementById(i)}
function pagn(e,p){return p.getElementsByTagName(e)}

TINY.slider=function(){
	function slide(n,p){this.n=n; this.init(p)}
	slide.prototype.init=function(p){
		var s=rn(p.id), u=this.u=pagn('ul',s)[0], c=pagn('li',u), l=c.length, i=this.l=this.c=0;
		if(p.navid&&p.activeclass){this.g=pagn('li',rn(p.navid)); this.s=p.activeclass}
		this.a=p.auto||0; this.p=p.resume||0; this.v=p.vertical||0; s.style.overflow='hidden';
		for(i;i<l;i++){if(c[i].parentNode==u){this.l++}}
		if(this.v){;
			u.style.top=0; this.h=p.height||c[0].offsetHeight; u.style.height=(this.l*this.h)+'px'
		}else{
			u.style.left=0; this.w=p.width||c[0].offsetWidth; u.style.width=(this.l*this.w)+'px'
		}
		this.pos(p.position||0,this.a?1:0)
	},
	slide.prototype.auto=function(){
		this.u.ai=setInterval(new Function(this.n+'.move(1,1)'),this.a*1000)
	},
	slide.prototype.move=function(d,a){
		var n=this.c+d, i=d==1?n==this.l?0:n:n<0?this.l-1:n; this.pos(i,a)
	},
	slide.prototype.pos=function(p,a){
		clearInterval(this.u.ai); clearInterval(this.u.si);
		var o=this.v?parseInt(this.u.style.top):parseInt(this.u.style.left),
		t=this.v?p*this.h:p*this.w, d=t>Math.abs(o)?1:-1; t=t*-1; this.c=p;
		if(this.g){for(var i=0;i<this.l;i++){this.g[i].className=i==p?this.s:''}}
		this.u.si=setInterval(new Function(this.n+'.slide('+t+','+d+','+a+')'),20)
	},
	slide.prototype.slide=function(t,d,a){
		var o=this.v?parseInt(this.u.style.top):parseInt(this.u.style.left);
		if(o==t){
			clearInterval(this.u.si); if(a||(this.a&&this.p)){this.auto()}
		}else{
			var v=o-Math.ceil(Math.abs(t-o)*.15)*d+'px';
			this.v?this.u.style.top=v:this.u.style.left=v
		}
	};
	return{slide:slide}
}();
