 //플래시 ActiveX 오브젝트
function  viewFlash(sURL, sName, sFeatures,sTitle)
{ 

	 var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"; 
	 var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000"; 
	 var FLASHVER = "7,0,19,0"; 

	 var sFeature; 
	 var sWidth  = "100%"; 
	 var sHeight  = "100%"; 
	 var sTitle	=	"";
	 var pmBoolean = "false"; 
	 var sTempArray; 
	 var sParamTag = ""; 
	 var sParamTag2 = "";

	sFeature = sFeatures.split(/\s*,\s*/); 
	for (var i=0; i< sFeature.length ; i++) 
	{ 
		sTempArray = sFeature[i].split(/\s*=\s*/); 
		if (sTempArray[0].toLowerCase() == "width")
		{ 
			//넓이 
			sWidth = sTempArray[1]; 
		}
		else if (sTempArray[0].toLowerCase() == "height")
		{ 
			//높이 
			sHeight = sTempArray[1]; 
		}
		else
		{ 
			//기타 파라메터 처리 
			if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){ 
				pmBoolean = "true"; 
			}else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){ 
				pmBoolean = "false"; 
			}else{ 
				pmBoolean = sTempArray[1]; 
			} 
			sParamTag = "<PARAM NAME='"+sTempArray[0]+"' VALUE='" + pmBoolean + "'>\n"+sParamTag; 
			sParamTag2 = " " + sTempArray[0] +"='"+pmBoolean +"' "+ sParamTag2;
		} 
	} 

	document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' TITLE='"+sTitle+"'>"); 
	document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>"); 
	document.write(sParamTag); 
	document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"'"+ sParamTag2 +" TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />") 
	document.write("<NOEMBED> Netscape 나 Internet Explorer를 통해 볼 수 있습니다.</NOEMBED></EMBED>"); 
	document.write("<h2>이 콘텐츠는 Adobe Flash CS3로 제작되었습니다.<br/>이 콘텐츠를 보실려면 <a href=\"http://www.macromedia.com/go/getflashplayer\">Abode Flash Player</a>(무료)가 필요합니다.</h2>");
	document.write("</OBJECT>"); 
} 

//플래시 스크립트
function embedFlash(src, width, height, id, alt, img)
{
	var content ="";
	content="<object id=\""+id+"\" type=\"application/x-shockwave-flash\" data=\""+src+"\" alt=\""+alt+"\" height=\""+height+"\" width=\""+width+"\">"+
			"<param name=\"quality\" value=\"best\" />"+
			"<param name=\"movie\" value=\""+src+"\" height=\""+height+"\" width=\""+width+"\">"+
			"<param name=\"wmode\" value=\"transparent\" /> "+
			"<img id=\""+id+"\" src=\""+img+"\" alt=\""+alt+"\">"+
			"</object>";
	document.write(content);
}

//미디어 플레이어 오브젝트를 뿌려줍니다. 
//미디어 플레이어 버전은 7~10 버전에 호환되는 오브젝트ID를 사용합니다. 
function  viewMediaPlayer(sURL, sName, sFeatures)
{ 

	 var WMPCID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"; 

	 var sFeature; 
	 var sWidth  = "100%"; 
	 var sHeight  = "100%"; 
	 var pmBoolean; 
	 var sTempArray; 
	 var sParamTag = ""; 

	 sFeature = sFeatures.split(/\s*,\s*/);
	 for (var i=0; i< sFeature.length ; i++) 
	 { 
		sTempArray = sFeature[i].split(/\s*=\s*/); 
		if (sTempArray[0].toLowerCase() == "width")
		{ 
			//넓이 
			sWidth = sTempArray[1]; 
		}
		else if (sTempArray[0].toLowerCase() == "height")
		{ 
			//높이 
			sHeight = sTempArray[1]; 
		}
		else
		{ 
			//기타 파라메터 처리 
			if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){ 
				pmBoolean = "true"; 
			}else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){ 
				pmBoolean = "false"; 
			}else{ 
				pmBoolean = sTempArray[1]; 
			} 
			sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag; 
		}
	 }

	 document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+WMPCID+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' >"); 
	 document.write("<PARAM NAME='URL'VALUE='" + sURL + "'>"); 
	 document.write(sParamTag);
	 document.write("</OBJECT>");
}

//////////////////////  default 

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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

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_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_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 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 ""; 
}

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

function CopyClibboard(link)
{
    window.clipboardData.setData('Text', link);
    alert('RSS 주소가 복사되었습니다');
}

//페이지내용 프린트
function printPage(cssStr)
{
    printFrame.printContent ( document.getElementById("inner_content").innerHTML, cssStr );
    return;
}

//-->문자 byte체크
function nets_check(Obj,lsMax)
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	var utf_count;
	tcount = 0;
	utf_count=0;

	var aquery = Obj.value;

	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for(k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);

		if(escape(onechar).length > 4)
		{
			tcount += 2;
			utf_count+=3;
			//utf_count+=2;
		}
		else if(onechar!='\r')
		{
			if ( onechar.charCodeAt() == 10 ){
				tcount += 2;
				utf_count+=2;
			}
			else
			{
				tcount++;
				utf_count++;
			}
		}
		//if(tcount>lsMax)
		if(utf_count>lsMax)
		{
			tmpStr = tmpStr.substring(0,k);
			break;
		}
	}
	Obj.focus();
	Obj.value = tmpStr;
}
//-->문자 byte체크 호출
function doTextByteCheck(Obj, VMax, ObjName)
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	var utf_count;
	tcount = 0;
	utf_count=0;

	var crnr_chk=0;
	var aquery = Obj.value;

	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for (k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);
		//document.aa.b.value=escape(onechar);
		if ( k == 0 && onechar.charCodeAt() == 13 ) crnr_chk++;
		if ( k == 1 && onechar.charCodeAt() == 10 ) crnr_chk++;

		if ( crnr_chk == 2 )
		{
			alert("입력오류\r\n["+ObjName+"]의 첫라인을 공백으로 입력할 수 없습니다.");
			//Obj.value = "";
			return;
		}

		if (escape(onechar).length > 4)
		{
			tcount += 2;
			//utf_count +=2;
			utf_count +=3;
		}
		else if (onechar!='\r')
		{
			if ( onechar.charCodeAt() == 10 )
			{
				tcount += 2;
				utf_count +=2;
			}
			else
			{
				tcount++;
				utf_count ++;
			}
		}
	}

	//if(tcount>VMax)
	if(utf_count>VMax)
	{
		reserve = tcount-VMax;
		reserve = utf_count-VMax;
		alert(" "+ObjName+"은(는) "+VMax+"바이트 이상은 입력하실수 없습니다.\r\n 입력한 내용이 "+reserve+"바이트 초과되었습니다.\r\n 초과된 부분은 자동으로 삭제됩니다.");
		nets_check(Obj, VMax);
		return;
	}
}

/*TopMenu -submenu 보기: 현재메뉴활성*/
var preNaviID	= "";
var preOver		= "";
var preSub		= "";
function showTopSub(naviID) {
	var subMn	= document.getElementById(naviID);
	if(preNaviID != naviID || preNaviID == "") {
		if(preNaviID != "") {
			document.getElementById(preNaviID).style.visibility	= "hidden";
		}
		subMn.style.visibility	= "visible";
		preNaviID			= naviID;
	}
}


//로그인div
function fn_showLoginSheet(show,mnu_siteid){
	if (show == 1) 
	{
		var pntMouseY;
		var pntMouseX;

		var obj = document.getElementById("LinkLoginWrite");
		var posX=0;               
		var posY=0; 

		if(typeof(obj.offsetParent) != "undefined")
		{                  
			  for(var x=0, y=0;obj; obj=obj.offsetParent)
			  {                       
					x += obj.offsetLeft;                       
					y += obj.offsetTop;                   
			  }                   
			  pntMouseX=x;                   
			  pntMouseY=y; 
		}               
		else{                   
			
			  pntMouseX=obj.offsetLeft;                   
			  pntMouseY=obj.offsetTop;    
		} 

		document.getElementById('LoginHTML').style.position	= 'absolute';
		document.getElementById('LoginHTML').style.zIndex	= 1;
		document.getElementById('LoginHTML').style.left			= '250px';
		document.getElementById('LoginHTML').style.top			= (pntMouseY-300)+'px';
		document.getElementById('LoginHTML').style.display	= 'block';		
	}else {
	    document.getElementById("LoginHTML").style.display = 'none';
	}	
}

/* */
//실명인증 Open 창
function fnPopup(path)
{
	window.open('', 'popup','width=410, height=590');
	document.frmVar.var_path.value = path;
	document.frmVar.target = "popup";
	document.frmVar.action = "/message/vname_Input.php";
	document.frmVar.submit();
}

// G-PIN 인증창 Open
function fn_GPinAuth(path) {
/*
	var sThisURL = document.location +'';
	var arrayURL = sThisURL.split('/');
	var sNewURL = '';
	var sExp = '';
	if (arrayURL[2]!='80333.dnworks.co.kr' ) {
		if( confirm('G-PIN 인증 도메인으로 이동하시겠습니까? 이동후 다시 글쓰기를 눌러주세요') )
		{
			for(var i=0;i<arrayURL.length;i++){
				if (i == 0) 
					sExp = '';
				else 
					sExp = '/';				    
				
				if (i==2) 
					sNewURL += sExp + '80333.dnworks.co.kr';
				else
					sNewURL += sExp + arrayURL[i];
			}
			top.location.href= sNewURL ;	
		}
		return;
	}
*/
	var wX,wY,wWidth,wHight;

    wWidth = 360;
    wHight = 120;
    
    wX = (window.screen.width - wWidth) / 2;
    wY = (window.screen.height - wHight) / 2;
	path = path.replace(/&/g, "^"); 
    var w = window.open("/G-PIN/AuthRequest.php?path="+path, "gPinLoginWin", "directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
}


function setPosition(valueW, valueH)
{
	if(navigator.appVersion.indexOf("MSIE 7.0") > 0) {
		valueW = valueW;
		valueH = valueH + 21;
	} else {
		valueW = valueW;
		valueH = valueH - 1;
	}

	var height	= screen.height;
	var width	= screen.width;
	var leftpos = width / 2 - valueW / 2;
	var toppos	= height / 2 - valueH / 2;

	self.resizeTo(valueW, valueH);
	self.moveTo(leftpos, toppos);
	self.resizeTo(valueW, valueH);		// 이유없다 resize잘안되어서 한번더 call
}

//font-size
function getFontCookie() { 
	var fontSize = getCookie("font_size"); 
	try { 
		if ( fontSize == null ) return 12; 
		if ( fontSize.length ) return parseInt(fontSize); else return 16; 
	} catch (e) { 
		return 16; 
	} 
} 
var fontSize = getFontCookie(); 

function scaleFont(val) { 
	var content, lineHeight; 
	var oldContent = document.getElementById("oldCnt"); 
	content = document.getElementById("wrap"); 
	if (oldContent != null) 
		content = oldContent; 
		if(val	==	12){
			fontSize = val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		}else if (val > 0) { 
			if (fontSize <= 18) { 
				fontSize = fontSize + val; 
				lineHeight = fontSize+Math.round(1.1*fontSize); 
				content.style.fontSize = fontSize + "px"; 
			} 
		} else { 
			if (fontSize > 8) { 
				fontSize = fontSize + val; 
				lineHeight = fontSize+Math.round(1.1*fontSize); 
				content.style.fontSize = fontSize + "px"; 
			} else { 
				lineHeight = fontSize+Math.round(1.1*fontSize); 
				content.style.fontSize = fontSize + "px"; 
			} 
		} 
	var mydate = new Date; mydate.setDate(mydate.getDate()+1000); 
	setCookie("font_size", fontSize, mydate); 
}

//수동 탭메뉴 처리
var preTabpage = "";
function showTabPage(tabID) {
	var tabPage		= document.getElementById("tab_"+tabID);

	if(preTabpage != tabPage) {
		if(preTabpage != "") {
			preTabpage.style.display	= "none";
		}else{
			document.getElementById("tab_1").style.display	= "none";
		}
		tabPage.style.display	= "block";
		preTabpage					= tabPage;
	}
	/*
	else{
		preTabpage.style.display	= "none";
		preTabpage					= "";
	}
	*/
}


function getWindow(url,w,h)
{
		var position = "width="+w+",height="+h+",left=100,top=100,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0";
		window.open( url, '', position);
}

function fn_zipsearch(frmName,zip1,zip2,addr1,addr2)
{
		var i_url = "/message/member_zipcode_search.php?fm="+frmName+"&zip1="+zip1+"&zip2="+zip2+"&addr1="+addr1+"&addr2="+addr2;
		window.open(i_url,'openZipWindow','width=450,height=350,top=10,left=10,resizable=no,menubar=no,scrollbars=no');		
		return;
}

var old = "";
function viewMenu(e)
{
	if(old != e)
	{
		if(old != "")
		{
			document.getElementById(old).style.display = "none";
		}
		document.getElementById(e).style.display = "block";
		old = e;
	}
	else
	{
		document.getElementById(e).style.display = "none";
		old = "";
	}
}


// iframe auto resize
function resizeIFrame(ifrName) { 

	var min_h = 250;
	var oIFrame = document.getElementById(ifrName);

	try {          
	  
		var oDoc = oIFrame.contentDocument || oIFrame.contentWindow.document;        

		if (/MSIE/.test(navigator.userAgent)) {
			var frmHeight = oDoc.body.scrollHeight;
		} else {
			var s = oDoc.body.appendChild(document.createElement('DIV'))
			s.style.clear = 'both';

			var frmHeight = s.offsetTop;
			s.parentNode.removeChild(s);
		}

		if (frmHeight < min_h) 
			frmHeight = min_h;

		oIFrame.style.height = frmHeight+"px";

	} catch (e) { }
}


function checkLogData(frmObj) 
{
	var sUserId		= frmObj.mem_id.value;
	var sUerPass	= frmObj.mem_pass.value;
	var var_path	= frmObj.var_path.value;

	var var_referer		= document.frmVar.var_referer.value;
	var var_mnu_siteid= document.frmVar.var_mnu_siteid.value;
	var var_mnu_uid	= document.frmVar.var_mnu_uid.value;
	if(!var_path){
		var_path			= document.frmVar.var_path.value;
	}

	frmObj.var_referer.value			= var_referer;     
	frmObj.var_path.value				= var_path;        
	frmObj.var_mnu_siteid.value	= var_mnu_siteid;
	frmObj.var_mnu_uid.value		= var_mnu_uid;


	if(sUserId == "") {
		alert("[아이디]는  필수 입력 사항입니다.");	
		frmObj.mem_id.focus();
		return false;
	}

	if(sUerPass == "") {
		alert("[비밀번호]는 필수 입력 사항입니다");
		frmObj.mem_pass.focus();
		return false;
	}
	return true;
}
function checkLogSubmit(frmObj)
{
	if(checkLogData(frmObj))
		frmObj.submit();
}
