// Dreamweaver //

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
	var p,i,x;	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function initContentTabMenu(d)
{
	ctab4MenuCurr = document.getElementById("ctab4m" + d);
	ctab4MenuCurrA = ctab4MenuCurr.getElementsByTagName("a")[0];
	ctab4MenuCurrImg = ctab4MenuCurr.getElementsByTagName("img")[0];
	if(ctab4MenuCurr){
		ctab4MenuCurrA.style.color="#fff";
//		ctab4MenuCurrA.style.background="#6295ca";
//		ctab4MenuCurr.style.borderColor="#6295ca";
			ctab4MenuCurr.style.backgroundPosition="0 -100px";
			ctab4MenuCurrA.style.backgroundPosition="100% -100px";
		if(ctab4MenuCurrImg){
			ctab4MenuCurrImg.src = ctab4MenuCurrImg.src.replace(".gif", "on.gif");
		}
	}
}

function main_scroll(d) {
for(var i=0;i<10;i++) {
	if(i<10) { inn="0"+i; } else { inn=""+i; }
	div = document.getElementById("cont04"+inn);
	anchorImg = document.getElementById("num"+inn);
	if(anchorImg) {	anchorImg.src = "/img/main/num" +inn+".gif"; }
	if(div) { div.style.display = "none"; }
}
if(d<10) dnn="0"+d; else dnn=""+d;
div = document.getElementById("cont04"+dnn);
anchorImg = document.getElementById("num"+dnn);
if(anchorImg) { anchorImg.src = "/img/main/num" +dnn+"on.gif"; }
if(div) { div.style.display = "block"; }
}

function imgOver(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "on.gif");
}
function imgOut(imgEl) {
	imgEl.src = imgEl.src.replace("on.gif", ".gif");
}
function menuOver() {
	this.src = this.src.replace(".gif", "on.gif");
}
function menuOut() {
	this.src = this.src.replace("on.gif", ".gif");
}

//ex) initImgRoll("containerId");
function initImgRoll(containerId) { 
 	imgEl = document.getElementById(containerId).getElementsByTagName("img");
	for (i=0; i<imgEl.length; i++) {
		var menuImg = imgEl[i]
		var where = menuImg.src.indexOf("on.gif",0)
		if (where==-1) {
				menuImg.onmouseover = menuOver;
				menuImg.onmouseout = menuOut;
		}
	}
}

function setFontSize(a) {
	defaultFontSize = "93%";
	obj = document.getElementById("container");
	var objFontSize = obj.style.fontSize;
	if (!objFontSize) { objFontSize = parseInt(defaultFontSize); }
	obj.style.fontSize =	parseInt(objFontSize)+ a+ "%";
}

function initSelect(selectId,optionId) { 
 	selectEl = document.getElementById(selectId);
 	optionEl = document.getElementById(optionId);
	selectEl.onmouseover = selectEl.getElementsByTagName("a")[0].onfocus = function selectOver() {
		selectEl.style.background = selectEl.style.background.replace(".gif", "on.gif");
		optionEl.style.display = "block";
	}
	option_last_index = selectEl.getElementsByTagName("a").length-1;
	selectEl.onmouseout = selectEl.getElementsByTagName("a")[option_last_index].onblur = function selectOut() {
		selectEl.style.background = selectEl.style.background.replace("on.gif", ".gif");
		optionEl.style.display = "none";
	}
}

//ex) displayToggle('t01');
function displayToggle(arg) {
	obj = document.getElementById(arg);
	if(obj.style.display == "block") obj.style.display = "none";
	else obj.style.display = "block";
}

//ex) displayOff('idName','idName'); displayOn('idName','idName');
function displayOn() {
	var i,j,a=displayOn.arguments;
	for(i=0;i<a.length;i++) {
		obj = document.getElementById(a[i]);
		if (obj) { obj.style.display = "block"; }
	}
}
function displayOff() {
	var i,j,a=displayOff.arguments;
	for(i=0;i<a.length;i++) {
		obj = document.getElementById(a[i]);
		if (obj) { obj.style.display = "none"; }
	}
}

function displayOnly(coId,num,curr) {
	for (i=1;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"; }
}

function activeOnly(coId,num,curr) {
	for (i=1;i<= num;i++) {
		var obj = document.getElementById(coId+i);
		if (obj) { obj.style.fontWeight = "normal"; }
	}
	var obj = document.getElementById(coId+curr);
	if (obj) { obj.style.fontWeight = "bold"; }
}

function eventOnOff(a) {
	eventX = event.x;
	eventY = event.y;
	obj = document.getElementById(a);
	obj.style.left = eventX;
	obj.style.top = eventY;
	obj.style.visibility = "visible";
}

function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}

//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){};
})();

function contentPrint() {
	var windowLeft = (screen.width-750)/2;
//	var windowTop = (screen.height-480)/2;
	var windowTop = 20;
	var printURL = "/share/inc/printpage.html";
	 window.open(printURL,"content",'width=750, height=620, menubar=yes, scrollbars=yes,status=no,resizable=yes,top=' + windowTop + ',left=' + windowLeft + '');
}

var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}

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('<div>이 콘텐츠는 Flash로 제작되었습니다.<br />이 콘텐츠를 보려면 <a tabindex="0" href="http://www.adobe.com/kr/products/flashplayer/">Flash Player</a>(무료)가 필요합니다.</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 getvodH264(murl,mtitle)
{
document.write("<object id='S2MPlayer' style='left: 0px; top: 0px' height='100%' width='100%' classid='clsid:e76aae10-af57-4aea-b33d-c3edfa414dae' codebase='/vodview/h264/S2MPlayer.3.2.0.15.cab#version=3,2,0,15' name='S2MPlayer'>");
document.write("<param name='serverip' value='220.77.180.168:8090' />");
document.write("<param name='userid' value='anonymous' />");
document.write("<param name='moviefile' value='"+ murl +"' />");
document.write("<param name='movietitle' value='"+ mtitle +"' />");
document.write("<param name='autostart' value='1' />");
document.write("<param name='enablefullscreen' value='1' />");
document.write("<param name='fullscreenatstart' value='0' />");
document.write("<param name='enablecontextmenu' value='1' />");
document.write("<param name='showcontrolbar' value='0' />");
document.write("<param name='showstatusbar' value='0' />");
//document.write("<param name='topmost' value='1' />");
document.write("</object>");
}

function getvodWMV(murl) //v7 http://www.alistapart.com/d/byebyeembed/hide2ndwmv2.html
{
//v6.4 clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95
//murl = "/data/wmv/"+murl;
document.write('<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" id="player" codebase="#version=7,0,0,1954" width="328px" height="288px">');//IE,Op
document.write('<param name="url" value="'+ murl +'" /> ');
document.write('<param name="autoStart" value="true" />');
document.write('<param name="uiMode" value="full" />');//value="full|mini|none|invisible|custom"
document.write('<param name="stretchToFit" value="true" />');//value="false|true"
document.write('<param name="fullScreen" value="false" />');//value="false|true"
document.write('<!--[if !IE]>-->');
document.write('<object type="video/x-ms-wmv" data="'+ murl +'" width="328px" height="288px" >');//FF
document.write('<div><a tabindex="0" href="'+ murl +'">movie</a></div>');
document.write('</object>');
document.write('<!--<![endif]-->');
document.write('</object>');
}

function viewMore(a,b) {
obj = document.getElementById(a);
obj.style.display=b;
}

// Png24 //
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 '';
    }
