function initTabMenu(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", ".gif");
				} else {
					currentmenu.parentNode.parentNode.className = currentmenu.parentNode.parentNode.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.parentNode.parentNode.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function flashWrite(url,w,h,vars,bg,win){
	
	var id=url.split("/")[url.split("/").length-1].split(".")[0]; //id ϸ 
	if(vars==null) vars='';
	if(bg==null) bg='#FFFFFF';
	if(win==null) win='transparent';


	// ÷ ڵ 
	var flashStr= "	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		flashStr+="			codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0'";
		flashStr+="			width='"+w+"'";
		flashStr+="			height='"+h+"'";
		flashStr+="			id='"+id+"'";
		flashStr+="			align='middle'>";

		flashStr+="		<param name='allowScriptAccess' value='always' />";
		flashStr+="		<param name='movie' value='"+url+"' />";
		flashStr+="		<param name='FlashVars' value='"+vars+"' />";
		flashStr+="		<param name='wmode' value='"+win+"' />";
		flashStr+="		<param name='menu' value='false' />";
		flashStr+="		<param name='quality' value='high' />";
		flashStr+="		<param name='bgcolor' value='"+bg+"' />";
	
	
		flashStr+="		<embed src='"+url+"'";
		flashStr+="		       flashVars='"+vars+"'";
		flashStr+="		       wmode='"+win+"'";
		flashStr+="		       menu='false'";
		flashStr+="		       quality='high'";
		flashStr+="		       bgcolor='"+bg+"'";
		flashStr+="		       width='"+w+"'";
		flashStr+="		       height='"+h+"'";
		flashStr+="		       name='"+id+"'";
		flashStr+="		       align='middle'";
		flashStr+="		       allowScriptAccess='always'";
		flashStr+="		       type='application/x-shockwave-flash'";
		flashStr+="		       pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		flashStr+=" </object>";

	// ÷ ڵ 
	document.write(flashStr);
}

function redefineFlashWH_main(w, h){
	var parentObj  = document.getElementById('mainFlash');
	var targetObj  = document.getElementById('main');
	
	var fixWidth   = 980; //ּ λ
	

	var userWidth  = document.documentElement.clientWidth;	

	var widthBool  = false;	

	if(w == undefined) { w = fixWidth; }	

	if(w <= fixWidth) if(userWidth <= fixWidth) widthBool = true;	

	if(widthBool) {
		targetObj.width = fixWidth;
		parentObj.style.width = fixWidth + "px";
	} else {
		targetObj.width = userWidth;
		parentObj.style.width = userWidth + "px";
	}	
}
function redefineFlashWH_sub(w, h){
	var parentObj  = document.getElementById('sub_gnb');
	var targetObj  = document.getElementById('headArea');
	
	var fixWidth   = 980; //ּ λ
	

	var userWidth  = document.documentElement.clientWidth;	

	var widthBool  = false;	

	if(w == undefined) { w = fixWidth; }	

	if(w <= fixWidth) if(userWidth <= fixWidth) widthBool = true;	

	if(widthBool) {
		targetObj.width = fixWidth;
		parentObj.style.width = fixWidth + "px";
	} else {
		targetObj.width = userWidth;
		parentObj.style.width = userWidth + "px";
	}	
}

function regInterval(){ // ũ ػ üũϴ ۾ Ŵ Լ
	if(document.getElementById('mainFlash')) intervalVariable = setInterval("redefineFlashWH_main()",50);
	if(document.getElementById('sub_gnb')) intervalVariable = setInterval("redefineFlashWH_sub()",50);
}

window.onload = function() {
	regInterval();
}

function fixedPositionForIE6(type,length){ //type:fixedSide or fixedBottom,  length:fixedSide=topCss or  fixedBottom:objHeight 
	var viewportScroll = (document.documentElement) ? document.documentElement.scrollTop : document.body.scrollTop;	
	var viewportHeight = (document.documentElement) ? document.documentElement.clientHeight : document.body.clientHeight;

	if(type == "fixedSide"){		
		var objTop = length;
		return objTop + viewportScroll + "px";
	} else if( type == "fixedBottom"){				
		var objHeight = length;
		var objTop = viewportHeight - objHeight;		
		return objTop + viewportScroll + "px"
	}
}

function getStyle(el, style) {
	var value = el.style[style];
	if(!value)	{
		if(document.defaultView && document.defaultView.getComputedStyle) {
			var css = document.defaultView.getComputedStyle(el, null);
			value = css ? css[style] : null;
		} 
		else if (el.currentStyle) value = el.currentStyle[style];
	}
	return value == 'auto' ? null : value;
}

// 탑버튼 스크립 ========================================================================= 
function initMoving(target, topPosition, topLimit, btmLimit) {
	var topBtnContainer = document.getElementById('gotop');
	var topBtn = topBtnContainer.getElementsByTagName("img")[0];
	topBtn.onclick = function(){
		window.scrollTo(0,0);
	};

	if (!target)
		return false;
	
	var obj = target;
	obj.initTop = topPosition;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	
	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}
	obj.move = setInterval(function() {
		pos = obj.getTop() + obj.getHeight() - 150;
		//pos = obj.getTop() + topPosition;
		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 showGotop(){
	var contents = document.getElementById('contents');
	var topBtnContainer = document.getElementById('gotop');
	if (!contents) {
		topBtnContainer.style.display = "none";
	} 
	else {
		var contentsHeight = contents.offsetHeight;
		if (contentsHeight < 600) topBtnContainer.style.display = "none";
	}
	return false;
}

    // 공백체크
    function CheckSpaces(strValue) {
        var flag = true;

        if (strValue != "") {
            for (var i = 0; i < strValue.length; i++) {
                if (strValue.charAt(i) != " ") {
                    flag = false;
                    break;
                }
            }
        }
        return flag;
    }




