/***************************************************************************************************/
/** 외부참조파일초기화
* author: myshin
* update: 2008.05.08
* desc: 외부 참조 파일(*.css *.js)을 캐시에서 안불러오게 한다.
* Disable JavaScript 일 경우에 *.css 의 display: none; 으로 인한 콘텐츠를 이용할 수 없는 거 해결.
* ex) initNow(); initExternalRef();
*/
var nowString = "";//현재시각 전역변수
function initNow(){//현재시각 할당
	var now = new Date();
	nowString = now.toString();
	while(nowString.indexOf(" ")!=-1||nowString.indexOf(":")!=-1||nowString.indexOf("+")!=-1){
		nowString = nowString.replace(" ", "");
		nowString = nowString.replace(":", "");
		nowString = nowString.replace("+", "");
	}
}
initNow();//런칭후!!주석처리필수!!

function initExternalRef(){
	//*.css
	document.writeln('<link rel="stylesheet" type="text/css" href="/share/css/all.css?'+nowString+'">');
	document.writeln('<link rel="stylesheet" type="text/css" href="/share/css/board.css?'+nowString+'">');
	//*.js
	document.writeln('<script type="text/javascript" src="/share/js/topmenu.js?'+nowString+'"></'+'script>');//주메뉴
	document.writeln('<script type="text/javascript" src="/share/js/mfloater.js?'+nowString+'"></'+'script>');//날개플로팅
	document.writeln('<script type="text/javascript" src="/share/js/mposition.js?'+nowString+'"></'+'script>');//이전다음위치보기
}
initExternalRef();

/***************************************************************************************************/
//공용함수

//IE Flicker Bug 해결
(function(){
	/*Use Object Detection to detect IE6*/
	var  m = document.uniqueID /*IE*/
	&& document.compatMode  /*>=IE6*/
	&& !window.XMLHttpRequest /*<=IE6*/
	&& document.execCommand ;
	try{
		if(!!m){ m("BackgroundImageCache", false, true) /* = IE6 only */ }
	}catch(oh){};
})();

//보이기감추기 여러개
//ex) displayOn('id1','id2'); displayOff('id1','id2'); //인수 개수에 상관없다.
function displayOn() {//보이기
	var i,j,a=displayOn.arguments;
	for(var i=0;i<a.length;i++){
		var obj = document.getElementById(a[i]);
		if(obj){ obj.style.display = "block"; }
	}
}
function displayOff() {//감추기
	var i,j,a=displayOff.arguments;
	for(var i=0;i<a.length;i++){
		var obj = document.getElementById(a[i]);
		if(obj){ obj.style.display = "none"; }
	}
}

//하나만 보이기
//ex) displayOnly('id문자열공통부분',전체수,현재순번); //현재순번의 객체만 보여준다.
//전체수 인수를 받지 않고 조건에 만족하는 객체배열.length 로 계산할 수 있지만
//함수 실행시마다 배열을 생성하는 것은 성능저하를 초래하지 않을까?
//
function displayOnly(coId,num,curr) {
	for(var i=0;i<=num;i++){
		var obj = document.getElementById(coId+i);
		if(obj){ obj.style.display = "none"; }
	}
	var obj = document.getElementById(coId+curr);
	if(obj){ obj.style.display = "block"; }
}

//활성상태표시 v2008.04.02
//ex) activeOnly('id문자열공통부분',전체수,현재순번); //현재순번의 객체만 활성화(class 에 "on" 추가)
function activeOnly(coId,num,curr) {
	var aa=0;
	var re=/(^|\s)on$/;//정규표현식 "on", " on" 둘다 매칭. "onx", " onx", "xonx", "xon", "xon " 형태는 배제.
	for(var i=1;i<=num;i++){//off상태로초기화
		var obj = document.getElementById(coId+i);
		if(obj){ if(re.test(obj.className)) obj.className = obj.className.replace(re,"");	}
	}
	var obj = document.getElementById(coId+curr);
	if(obj){ obj.className = (obj.className)? obj.className+" on" : "on"; }
}

/** 셀렉트롤
* author : myshin
* update : 2008.08.08
* desc : <select><option> 처럼 동작. CSS로 디자인 가능. 이동버튼 없어도 접근성 우수함.
* 클릭시 option 메뉴 감춤.
* ex)
<div id="selectId">
<h3>관련 사이트 바로가기</h3>
<ul id="optionId">
<li><a href="http://naver.com" onclick="window.open(this.href); return false;" title="새 창에서 열림">네이버 [새 창]</a></li>
<li><a href="http://naver.com">네이버</a></li>
</ul>
</div>
<script type="text/javascript">initSelect("selectId","optionId");</script><noscript><p>JavaScript</p></noscript>
*/
function initSelect(selectId,optionId) { 
 	var selectEl = document.getElementById(selectId);
	var selectFirst = selectEl.getElementsByTagName("*")[0];
	if(selectFirst.tagName!="a")	selectFirst.innerHTML = "<a href='#'><span>"+selectFirst.innerHTML+"</span></a>";
	selectEl.innerHTML = "<div>"+selectEl.innerHTML+"</div>";
 	var selectD = selectEl.getElementsByTagName("div")[0];
	var selectAarr = selectEl.getElementsByTagName("a");
 	var optionEl = document.getElementById(optionId);
	optionEl.style.display = "none";//css 에서 "none"하면 접근성 문제 있어 js 로 처리.
	//selectEl.onmouseover = selectAarr[0].onfocus = function selectOver(){//마우스오버시활성
	selectAarr[0].onclick = optionEl.onmouseover = function selectOver(){//클릭시활성
		selectD.className = "on";
		optionEl.style.display = "block";
		//selectD.onmouseover = selectOver;
		return false;
	}
	selectEl.onmouseout = selectAarr[selectAarr.length-1].onblur = function selectOut(){//비활성
		selectD.className = "";
		optionEl.style.display = "none";
	}
	for(var i=1;i<=selectAarr.length-1;i++){// i=1부터 적용주의
		if(typeof selectAarr[i].onclick == "function") {
			selectAarr[i].oldonclick = selectAarr[i].onclick;//전역변수로지정
		}
		selectAarr[i].onclick = function(){
			selectAarr[0].innerHTML = "<span>"+this.innerHTML+"</span>";//선택된태그를표시
			if(this.oldonclick) {//onclick 이 있을 경우에만
				this.oldonclick();
				optionEl.style.display = "none";
				return false;
			}
		}
	}
}

/** 이벤트위치에보여주기
* amender : myshin
* update : 2008.04.07
* desc : 범용, 키보드 운용 필요.
* ex) objPop=document.getElementById("pop");eventOnOff(event);
*/
function eventOnOff(e) {
	var e=e?e:window.event;//event객체접근-크로스브라우저
	//alert(e.type);
	//objPop=document.getElementById("pop");
	var pn = new Array();
	var xOffset=yOffset=0;
	pn[pn.length]=objPop.parentNode;
	while(pn[pn.length-1].tagName!="BODY"){//tagName은 대문자 .getElementsByTagName("소문자") 주의.
		var isPosition = getStyle(pn[pn.length-1],'position');//함수필요(myshin.js)
		if(isPosition==("relative"||"absolute")) {
			xOffset += pn[pn.length-1].offsetLeft;
			yOffset += pn[pn.length-1].offsetTop;
		}
		pn[pn.length]= pn[pn.length-1].parentNode;
	}
	var posx=0,posy=0,scrollx=0,scrolly=0;
	posx = e.clientX;
	posy = e.clientY;
	scrollx = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
	scrolly = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	posx += scrollx;
	posy += scrolly;
	objPop.style.left=posx-xOffset+"px";
	objPop.style.top=posy-yOffset+"px";
	objPop.style.display = "block";
}

/** 글자크기
* amender : myshin
* update : 2008.07.16
* desc : 글자크기확대축소, 최대최소값고정.
* 확대축소영역 지정 추가. 이벤트는 스크립트에서 처리, 기본 크기 추가.
* ex) initFontZoom(document.getElementById("container")); setFontSize(+1); setFontSize(-1); setFontSize(0);
*/
function setFontSize(a,zoomArea){
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	if(!zoomArea){//확대축소영역 지정 없으면
		zoomArea = document.getElementById("body_content");//기본 확대축소영역은 서브 본문
		if(!zoomArea) zoomArea = document.getElementById("body");//메인일 경우
	}
	if(zoomArea){
		if(!a) zoomArea.style.fontSize = parseFloat(defaultFontSize)+"em";//기본값
		else {
			var objFontSize = zoomArea.style.fontSize;
			if (!objFontSize) objFontSize = parseFloat(defaultFontSize)+"em";
			var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a*2))/12;
			if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; zoomArea.style.fontSize = checkFontSize+"em"; alert("더 늘릴 수 없습니다."); }
			else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; zoomArea.style.fontSize = checkFontSize+"em"; alert("더 줄일 수 없습니다."); }
			else { zoomArea.style.fontSize = checkFontSize+"em"; }
		}
	}
}
function initFontZoom(zoomArea){
	zoomArea = (zoomArea)? zoomArea: null;//전역변수로지정
	var fzoomIn = document.getElementById("fontsize-larger");
	var fzoomOut = document.getElementById("fontsize-smaller");
	var fzoom0 = document.getElementById("fontsize-default");
	if(fzoomIn) fzoomIn.onclick = function(){ setFontSize(+1,zoomArea); return false; }
	if(fzoomOut) fzoomOut.onclick = function(){ setFontSize(-1,zoomArea); return false; }
	if(fzoom0) fzoom0.onclick = function(){ setFontSize(0,zoomArea);	 return false; }
}

/** 부모 클래스 할당
* author : myshin
* update : 2008.05.23
* desc : 퀵메뉴에 마우스오버하면 이미지가 변경되는 기능에 적용
* ex) initParentClass("qms1");
*/
function initParentClass(id){
  var obj = document.getElementById(id);
  var objUl = obj.getElementsByTagName("ul")[0];
  var objLis = obj.getElementsByTagName("li");
	for(var i=0;i<objLis.length;i++){
		var objLisA = objLis[i].getElementsByTagName("a")[0];
		if(objLisA){
			objLisA.onmouseover=function(){ this.parentNode.parentNode.className = this.parentNode.className; }
		}
	}
}

// 팝업
function openWin(url,wn,sc,ww,wh,le,to) {
	openwin = window.open(url,wn,"'" + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + sc + ",resizable=yes,width=" + ww + " ,height=" + wh + ",left=" + le + ",top=" + to + "'");
	return false;
}

// 플래시.20071011
function getflash(url,wid,hei,mode,tl,scale) //Flash8
{
document.writeln('<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="'+ wid +'" height="'+ hei +'">');//IE,Op
document.writeln('<param name="movie" value="'+ url +'" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="wmode" value="'+ mode +'" />');
document.writeln('<param name="salign" value="'+ tl +'" />');
document.writeln('<param name="scale" value="' + scale + '" />');
document.writeln('<!--[if !IE]> <-->');
document.writeln('<object type="application/x-shockwave-flash" data="'+ url +'" width="'+ wid +'" height="'+ hei +'">');//FF
document.writeln('<param name="movie" value="'+ url +'" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="wmode" value="'+ mode +'" />');
document.writeln('<param name="salign" value="'+ tl +'" />');
document.writeln('<param name="scale" value="' + scale + '" />');
document.writeln('Flash Player <a href="http://www.adobe.com/kr/products/flashplayer/">Download</a>');
document.writeln('<div></div>');
document.writeln('</object>');
document.writeln('<!--> <![endif]-->');
document.writeln('</object>');
}
//플래시대체콘텐츠.20071005
function flashAlt(eid,altid) {
	var objAlt = document.getElementById(eid).getElementsByTagName("div")[0];
	var altContents = document.getElementById(altid);
	objAlt.innerHTML = altContents.innerHTML;
	altContents.innerHTML="";
}

// 동영상
function getvodWMV7(murl,wid,hei) //WMPlayer ver7 이상.. 20071012
{
if(!wid)wid="320";if(!hei)hei="310";//값이없으면기본크기로설정
document.writeln('<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=6,4,7,1112"');//IE 전용 ActiveX
document.writeln(' id="player" width="'+ wid +'" height="'+ hei +'">');//IE : 크기를 %로 하면 마우스 오버해야 보임.
document.writeln('<param name="url" value="'+ murl +'" /> ');
document.writeln('<param name="autoStart" value="false" />');
document.writeln('<param name="uiMode" value="full" />');
document.writeln('<param name="stretchToFit" value="true" />');
document.writeln('<param name="fullScreen" value="false" />');
document.writeln('<!--[if !IE]>-->');//IE 조건주석문 - 없으면 IE6에서 2번 보임.
document.writeln('<object type="video/x-ms-wmv" data="'+ murl +'" width="'+ wid +'" height="'+ hei +'">') ;//FF,Op,Sf 사용.. parameter 미지원
document.writeln('<param name="autostart" value="false" />'); //Vista FF WMP11 만 지원
//document.writeln('<div><a tabindex="0" href="'+ murl +'">'+ "http://"+ document.domain + murl +'</a></div>');//대체콘텐츠
document.writeln('<div>동영상파일 : <a tabindex="0" href="'+ murl +'">'+ murl +'</a></div>');//대체콘텐츠
document.writeln('</object>');
document.writeln('<!--<![endif]-->');
document.writeln('');//여기에 대체콘텐츠를 두면 안됨
document.writeln('</object>');
}
/*
* 테스트
Win2000Pro WMP9: IE, FF, Op 정상동작, 키보드탐색가능
Vista WMP11 : IE 정상동작, FF 플러그인 설치 후 정상동작
Op 플러그인 C:\Program Files\Opera\program\plugins 폴더에 npds.zip npdsplay.dll npwmsdrm.dll 직접 복사 후 재생가능.. 화면 깨지는 현상발생.
Sf 플러그인 설치 후 플레이어 표시되지만 재생불가

* 동영상제어
player.fullScreen = true;
player.controls.play();
player.controls.stop();
player.controls.pause();
player.uiMode = "full"; //value="full|mini|none|invisible|custom"
player.controls.currentPosition += 10;
player.settings.volume += 10;
player.settings.volume -= 10;
player.settings.mute = true;
player.settings.mute = false;
player.style.width="220px";
player.style.height="45px";
*/

function getvodWMV(murl) //WMPlayer ver6.4 이하
{
document.writeln('<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"');//IE 전용 ActiveX
document.writeln(' id="player" width="320px" height="310px">');//IE : 크기를 %로 하면 마우스 오버해야 보임.
document.writeln('<param name="filename" value="'+ murl +'" /> ');
document.writeln('<param name="autoStart" value="false" />');
document.writeln('<!--[if !IE]> <-->');//IE 조건주석문 - 없으면 IE6에서 2번 보임.
document.writeln('<object type="video/x-ms-wmv" data="'+ murl +'" width="320px" height="310px">') ;//FF,Op,Sf 사용.. parameter 미지원
document.writeln('<param name="autostart" value="false" />'); //Vista FF WMP11 만 지원
//document.writeln('<div><a tabindex="0" href="'+ murl +'">'+ "http://"+ document.domain + murl +'</a></div>');//대체콘텐츠
document.writeln('<div>동영상파일 : <a tabindex="0" href="'+ murl +'">'+ murl +'</a></div>');//대체콘텐츠
document.writeln('</object>');
document.writeln('<!--> <![endif]-->');
document.writeln('</object>');
}

function getvodSeeVideo(sip,sport,murl) //H.264 참고 - http://www.seevideo.co.kr/
{
document.writeln('<object id="SeeLive" width="512px" height="451px" classid="clsid:68253470-5d4f-4cdf-8d9c-353c14a2f013" codebase="http://www.seevideo.co.kr/pub/seevideo2003/svporsche.cab#version=2,5,24,181">');
// height=451= 384+67
document.writeln('<param name="ServerIP" value="'+ sip +'" />'); //서버 IP
document.writeln('<param name="PortNum" value="'+ sport +' /">'); //포트 번호
document.writeln('<param name="NoTicket" value="1" />'); //티켓 사용 안함
document.writeln('<param name="MediaItem" value="'+ murl +'" />'); //미디어 ID
document.writeln('<param name="AutoPlay" value="1" />'); //자동 시작
document.writeln('<param name="EnableMessage" value="1" />'); //서버 메시지의 수신 여부
document.writeln('<div>브라우저가 H.264 동영상을 지원하지 않습니다.</div>');//FF, Op
document.writeln('</object>');
}
function getvodSanView(murl,mtitle) //H.264 참고 - http://www.sanview.co.kr/
{
document.writeln("<object id='S2MPlayer' name='S2MPlayer' width='100%' height='100%' classid='clsid:e76aae10-af57-4aea-b33d-c3edfa414dae' codebase='http://www.sanview.co.kr/cab_down/sanview/S2MPlayer.3.2.0.15.cab#version=3,2,0,15'>");
document.writeln("<param name='serverip' value='220.77.180.168:8090' />");
document.writeln("<param name='userid' value='anonymous' />");
document.writeln("<param name='moviefile' value='"+ murl +"' />");
document.writeln("<param name='movietitle' value='"+ mtitle +"' />");
document.writeln("<param name='autostart' value='1' />");
document.writeln("<param name='enablefullscreen' value='1' />");
document.writeln("<param name='fullscreenatstart' value='0' />");
document.writeln("<param name='enablecontextmenu' value='1' />");
document.writeln("<param name='showcontrolbar' value='0' />");
document.writeln("<param name='showstatusbar' value='0' />");
//document.writeln("<param name='topmost' value='1' />");
document.writeln("<div>브라우저가 H.264 동영상을 지원하지 않습니다.</div>");//FF, Op
document.writeln("</object>");
}
function getvod(murl) //WMV-비표준코드
{
//murl = "/data/wmv/"+murl;
document.writeln('<embed src="'+ murl +'" width="100%" height="100%" showcontrols="1" showstatusbar="1" showdisplay="0" showgotobar="0" autostart="1" playcount="0" />');
}
function getvodNoControl(murl) //WMV-비표준코드
{
//murl = "/data/wmv/"+murl;
document.writeln('<embed id="vodNoControl" src="'+ murl +'" width="100%" height="100%" showcontrols="0" />');
}

// 파노라마VR
function getpvrt(url,wf,w,h) // PVR180도.. 이거 사용안하고 JavaScript로 구현중..
{
document.writeln('<applet name="pano-advanced" code="advpanorama.class" width="'+ w +'" height="'+ h +'">');
document.writeln('<param name="panorama" value="'+ url +'" />');
document.writeln('<param name="speed" value="1" />');
document.writeln('<param name="delay" value="40" />');
document.writeln('<param name="fontsize" value="12" />');
document.writeln('<param name="bytes" value="108072" />');
document.writeln('<param name="logo" value="'+ wf +'" />'); //로딩중 이미지
document.writeln('<param name="buttons" value="n" />');
document.writeln('<param name="mode" value="4" />');
document.writeln('<param name="swap" value="y" />');
document.writeln('<param name="wait" value="'+ wf +'" />');
document.writeln('<div>Panorama VR 180도는 Java를 사용합니다.<br /><a tabindex="0" href="/data/viewer/jre-1_5_0_11-windows-i586-p-s.exe">J2SE Runtime Environment</a>를 설치하십시오.</div>');
document.writeln('</applet>');
}

function getpvr(url,wf,w,h) // PVR360도.. url(파노라마 이미지)은 같은 서버에 있어야 됩니다..(2007.10.15.다른서버도가능)
{
document.writeln('<applet id="ptviewer" name="ptviewer" code="ptviewer.class" archive="ptviewer.jar" width="'+ w +'" height="'+ h +'">');
document.writeln('<param name="file" value="ptviewer:0" />');
document.writeln('<param name="view_x" value="0" />');
document.writeln('<param name="view_y" value="0" />');
document.writeln('<param name="view_width" value="'+ w +'" />');
document.writeln('<param name="view_height" value="'+ h +'" />');
document.writeln('<param name="wait" value="'+ wf +'" />'); //로딩중 이미지
document.writeln('<param name="pano0" value="{file='+ url +'}" />');
document.writeln('<param name="pan" value="0" />');
document.writeln('<param name="quality" value="10" />');
document.writeln('<param name="antialias" value="true" />');
document.writeln('<param name="bgcolor" value="FFFFFF" />');
document.writeln('<param name="auto" value="0.3" />');
document.writeln('<param name="tilt" value="0" />');
document.writeln('<param name="fov" value="90.0" />');
document.writeln('<param name="pan" value="30.0" />');
document.writeln('<param name="tilt" value="0" />');
document.writeln('<param name="cursor" value="move" />');
document.writeln('<param name="frame" value="" />');
document.writeln('<param name="barcolor" value="000000" />');
document.writeln('<param name="bar_x" value="35" />');
document.writeln('<param name="bar_y" value="300" />');
document.writeln('<param name="bar_width" value="460" />');
document.writeln('<param name="bar_height" value="3" />');
document.writeln('<div>Panorama VR 360 Java Setup : <a tabindex="0" href="/data/viewer/jre-1_5_0_11-windows-i586-p-s.exe">J2SE Runtime Environment</a></div>');
document.writeln('</applet>');
var ptviewer = document.getElementById("ptviewer");
ptviewer.stopAutoPan();//정지된 상태에서 제공
}

/***************************************************************************************************/
// Menu //
function c0000() { location.href="../main/index.html"; }