// Flash Function(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드)
function flashWrite(url,w,h,id,bg,vars,win){
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='base' value='.'>"+
	
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' qinitTabMenu uality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/etflashplayer' />"+
	"</object>";
	document.write(flashStr);
}

// rollover
function menuOver(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
	imgEl.src = imgEl.src.replace(".png", "_on.png");
	imgEl.src = imgEl.src.replace(".jpg", "_on.jpg");
}
function menuOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
	imgEl.src = imgEl.src.replace("_on.png", ".png");
	imgEl.src = imgEl.src.replace("_on.jpg", ".jpg");
}

// 텍스트 인풋 이미지
function 
	clrImg(obj){
		obj.style.backgroundImage="";obj.onkeydown=obj.onmousedown=null;
	}

// 마우스 오버시 레이어 나오는거
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)


var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
 var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
 var parentEl=what.offsetParent;
 while (parentEl!=null){
  totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
  parentEl=parentEl.offsetParent;
 }
 return totaloffset;
}

function showhide(obj, e, visible, hidden){
 if (ie5||ns6)
  dropmenuobj.style.left=dropmenuobj.style.top=-540
 if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
  obj.visibility=visible
 else if (e.type=="click")
  obj.visibility=hidden
}

function iecompattest(){
 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
 var edgeoffset=0
 if (whichedge=="rightedge"){
 var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
  dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
 if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
  edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
 }
 else{
 var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
  dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
 if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
  edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
 }
 return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
 if (window.event) event.cancelBubble=true
 else if (e.stopPropagation) e.stopPropagation()
 if (typeof dropmenuobj!="undefined") //hide previous menu
  dropmenuobj.style.visibility="hidden"
  clearhidemenu()
 if (ie5||ns6){
  obj.onmouseout=delayhidemenu
  dropmenuobj=document.getElementById(dropmenuID)
 if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
  dropmenuobj.onmouseover=clearhidemenu
  dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
  showhide(dropmenuobj.style, e, "visible", "hidden")
  dropmenuobj.x=getposOffset(obj, "left")
  dropmenuobj.y=getposOffset(obj, "top")
  dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
  dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
 }
 return clickreturnvalue()
}

function clickreturnvalue(){
 if ((ie5||ns6) && !enableanchorlink) return false
 else return true
}

function contains_ns6(a, b) {
 while (b.parentNode)
 if ((b = b.parentNode) == a)
 return true;
 return false;
}

function dynamichide(e){
 if (ie5&&!dropmenuobj.contains(e.toElement))
  delayhidemenu()
 else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
 delayhidemenu()
}

function delayhidemenu(){
 delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
 if (typeof delayhide!="undefined")
  clearTimeout(delayhide)
}

// 동영상
function playIt(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
		MediaPlayer1.Play();
	}
}

function pauseIt(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {			
		MediaPlayer1.Pause();
	} 
}

function stopIt(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
		MediaPlayer1.Stop();
		MediaPlayer1.CurrentPosition=0;
	} 
}
function Wmv_View(URL,SizeX,SizeY,Flag,Astr)
{
    document.write('<object id="MediaPlayer1" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft?Windows?Media Player components..." type="application/x-oleobject" ' );
    document.write(' width="'+SizeX+'" height="'+SizeY+'" >'                                 );
	document.write('	<param name="transparentAtStart" value="True" />'	);
	document.write('	<param name="transparentAtStop" value="True" />'	);
	document.write('	<param name="AnimationAtStart" value="False" />'	);
	if ( Astr == null || Astr != 'F' ) {
		document.write('	<param name="AutoStart" value="true" />'	);
    } else {
		document.write('	<param name="AutoStart" value="false" />'	);
  	}	
	document.write('	<param name="AutoRewind" value="true" />'	);
	document.write('	<param name="DisplaySize" value="0" />'	);
	document.write('	<param name="AutoSize" value="false" />'	);
	document.write('	<param name="ShowDisplay" value="false" />'	);
	document.write('	<param name="ShowStatusBar" value="false" />'	);
	if ( Flag == null || Flag != 'F' ) {
       document.write('	<param name="ShowControls" value="true" />'	);
    } else {
        document.write('	<param name="ShowControls" value="false" />'	);
  	}	
	document.write('	<param name="EnableContextMenu" value="False" />'	);
	document.write('	<param name="FileName" value="'+URL+'" />'	);
	document.write('	<param name="Volume" value="0" />'	);
    document.write('	<embed src="'+URL+'"  displaysize=0 showcontrols=0 autostart=0 '	);
    document.write('	width="'+SizeX+'" height="'+SizeY+'"name="MediaPlayer1" '	);
    document.write('	type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" />'   );
    document.write('	</embed></object>	'	);
}

function Wmv_Lstn(URL,SizeX,SizeY)
{
    document.write('	<embed src="'+URL+'" loop=true playcount=infinite width="'+SizeX+'" height="'+SizeY+'"></embed>	'	);
}

function Wmv_Set( URL,Flag,Astr ) 
{
	document.all['MediaPlayer1'].Filename = URL;
	if ( Astr == null || Astr != 'F' ) {
		document.all['MediaPlayer1'].AutoStart = true;
    } else {
		document.all['MediaPlayer1'].AutoStart = false;
  	}	
	if ( Flag == null || Flag != 'F' ) {
		document.all['MediaPlayer1'].ShowControls = true;
    } else {
		document.all['MediaPlayer1'].ShowControls = false;
  	}	
}

/* 프린트 하기*/
function printPage() {
    if (window.print) {
        agree = confirm('현재 페이지를 프린트 하시겠습니까 ?');
    if (agree) window.print(); 
   }
}

// Tab Content
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.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".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();
}



//2010-05-27 _ hh function 추가 부분 확대 축소 스크립트 입니다.
var firstCall = true;
function changeFontsize(fSize, increment) {
	if (firstCall) {
		firstCall = false;
		if (increment != "") {
			changeFontsize('12', '');
		}
	}

	if (document.getElementsByTagName) {
		var getElement = document.getElementsByTagName("*");
		var eachElement, currentFontSize, fontIncrease, newFontSize;
		for (i=0; i<getElement.length; i++) {
			eachElement = getElement[i];
			if (increment != "") {
				currentFontSize = parseInt(eachElement.style.fontSize);
				fontIncrease = parseInt(increment);
				newFontSize = currentFontSize + fontIncrease;
			}
			else if (fSize != "") {
				newFontSize = parseInt(fSize);
			}
			if (getElement[i].tagName == "LI") {
				eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
			} else {
				eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
			}
			if (fSize != "") {
				switch(getElement[i].tagName) {
					case "H2": newFontSize += 3; break;
					case "H3": newFontSize += 2; break;
					case "H4": newFontSize += 1; break;
					case "H5": newFontSize += 1; break;
					case "H6": newFontSize += 1;
				}
			}
			eachElement.style.fontSize = newFontSize + "px";
			setCookie('fontSize', newFontSize);
		}
	}
	return false;
}

function setCookie(name,value,expires,path,domain,secure) {
//	if (!path) path = "/";
    document.cookie =   name + '=' + escape(value)         + ';'
        + ((expires) ? ' expires=' + expires.toGMTString() + ';' : '')
        + ((path)    ? ' path='    + path                  + ';' : '')
        + ((domain)  ? ' domain='  + domain                + ';' : '')
        + ((secure)  ? ' secure'                           + ';' : '');
}