/*
³Ý½º6.0 ÀÌ»ó ÀÍ½º 5.0 ÀÌ»óÀ¸·Î Á¦ÀÛ
Microsoft Internet Explorer 5.0 1999 DOM1 (2) JavaScript 1.3 (JScript 5.0) - ECMA
Netscape Navigator 6 2000 DOM1/DOM2 (1) (2) JavaScript 1.5(1) - ECMA
* script by IEZN
* ¸¶Áö¸· ¼öÁ¤ÀÏ : 2002.7.17
*/
// Browser Detection for DOM IE 5/ NS 6
var userAgent = navigator.userAgent;
var ie = (document.all && document.getElementById) ? true : false;
var ns = (!document.all && document.getElementById) ? true : false;
//¿ì¼± ÀÍ½º¸¸ Áö¿ø ¤Ñ,.¤Ñ
if(ie==false) {
	//location.href='/ieznApp/app/lib/old_browser.php';//ºê¶ó¿ìÁ®°¡ ¹öÀüÀÌÇÏ¸é ¹öÀü ¾÷±×·¹ÀÌµå ±Ç°í ÆäÀÌÁö·Î ÀÌµ¿ÇÑ´Ù.
	//exit;
	// && ns==false
}
//ÄíÅ°°ü·Ã
var nowTime = new Date();
nowTime.setTime(nowTime.getTime() + 365 * 24 * 60 * 60);
function SetCookie(name, value, expires, path, domain){ 
	document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : "; expires=" + nowTime.toGMTString()) + ((path == null)    ? "" : "; path=" + path) + ((domain == null)  ? "" : "; domain=" + domain);
}
function delCookie (name) {
  if (getCookie(name)) {
    document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function getCookie(name) {
var arg = name+"=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }
   return null;
}
function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return unescape (document.cookie.substring(offset, endstr));
}
function getX(obj){return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent));}
function getY(obj){return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );}
function page_width(){return (ns) ? innerWidth  : document.body.clientWidth;}
function page_height(){return (ns) ? innerHeight : document.body.clientHeight;}
function centerX(){return (ie)? page_width()/2 - 145 + document.body.scrollLeft:page_width()/2 - 170 + window.pageXOffset;}
function centerY(){return (ie)? page_height()/2 - 145 + document.body.scrollTop:page_height()/2 - 170 + window.pageYOffset;}
function scrollTop(){return (ie)? document.body.scrollTop:window.pageYOffset;}
function scrollLeft(){return (ie)? document.body.scrollLeft:window.pageXOffset;}
//defult status
window.defaultStatus = top.document.title;
var openPop = new Array();//ÆË¾÷¹è¿­»ý¼º
//ÆË¾÷ÀÌº¥Æ®Á¦¾î
function ieznInit(e){
	if(openPop.length>0){
		for(i=0;i<openPop.length;i++){
			if(openPop[i].closed==false){
				openPop[i].focus();
			}else{
				openPop[i]='';
			}
		}
    }else{
   		if(document.addEventListener){//ns
 			document.removeEventListener("focus",ieznInit, true);
 		}else if(document.detachEvent){//ie
 			document.detachEvent("onmousedown",ieznInit);
			window.detachEvent("onfocus",ieznInit);
		}	
	}
}
function cPop() {
	if(openPop.length>0){
		for(i=0;i<openPop.length;i++){
			if(openPop[i].closed==false){
				openPop[i].self.close();
			}else{
				openPop[i]='';
			}
		}
		if(document.addEventListener){//ns
			document.removeEventListener("focus",ieznInit, true);
		}else if(document.detachEvent){//ie
			document.detachEvent("onmousedown",ieznInit);
			window.detachEvent("onfocus",ieznInit);
		}
	}
}
//
//À©µµ¿ì ¿ÀÇÂ ÇÔ¼ö
//
// popup_link ÆË¾÷¸µÅ©
// popup_name ÆË¾÷ÀÌ¸§
// w          ÆË¾÷À©µµ¿ì Æø
// h          ÆË¾÷À©µµ¿ì ³ôÀÌ
// scroll     ÆË¾÷À©µµ¿ì ½ºÅ©·Ñ »ç¿ëÀ¯¹«
function open_window(popup_link, popup_name, w, h,scroll,x,y) {
	//À©µµ¿ì Áß¾ÓÁ¤·Ä
	var x =(!x)? (screen.width - w) / 2:x;
	var y =(!y)? (screen.height - h) / 2:y;
	wp = 'height='+h+',width='+w+',left='+x+',top='+y+',scrollbars='+scroll+',resizable=no';
	n=openPop.length;
	openPop[n] = window.open(popup_link, popup_name, wp);
	if(openPop.length==1){
		if(document.addEventListener){//ns
			document.addEventListener("focus",ieznInit,true);
		}else if(document.attachEvent){//ie
			document.attachEvent("onmousedown",ieznInit);//ie5ÀÇ ºÎ¸ðÃ¢Å¬¸¯Á¦¾î
			window.attachEvent("onfocus",ieznInit);
		}
	}
}
//µÎ¹øÀÌ»ó Å¬¸¯½Ã ÇöÀçÀ§Ä¡°í¼ö
function openBoxPosition(id_name){
	document.getElementById(id_name).style.posLeft = centerX();
	document.getElementById(id_name).style.posTop = centerY();	
}
//»ç¿ëÀÚ Á¤º¸º¸±â
function userInfo(v){
	if(v.length==0 || v=='0'){
		return;
	}
	thisLayer(v+"userInfo","/ieznApp/app/lib/board_whois.php?m_num="+v);
}
//Æû¸ÞÀÏº¸³»±â
function formmailWrite(m_nick,m_email){
	value='';
	if(m_email) value +=m_emial;
	value=m_nick+','+m_email;
	open_window("/ieznApp/app/lib/iezn_formmail_write.php?value="+value, 'formmail',408, 448, 'no');
	//thisLayer("message"+value,"/ieznApp/app/lib/iezn_formmail_write.php?value="+value);
}
function article_move(mNum){
	value=mNum;
	thisLayer("articleMove"+value,"/ieznApp/app/lib/board_article_move.php?value="+value);
}
//¸µÅ© ÂÊÁö º¸³»±â
function messageWrite(v){
	if(getCookie('ld')!=1){
		alert('·Î±×ÀÎ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
		return;
	}
	open_window("/ieznApp/app/modules/message/message_popup_write.php?m_num="+v, 'fmessage',320,300, 'no');
}
//ÂÊÁöº¸³»±â Æû Á¡°Ë
function messageSend(){
	obj=document.messageF;
	if(!check_blank('¾ÆÀÌµð',obj.m_id)) return false;
	if(!check_length('¾ÆÀÌµð',obj.m_id,2,12)) return false;
	if(!check_null('Á¦¸ñ',obj.subject)) return false;
	if(!check_length('Á¦¸ñ',obj.subject,2,100)) return false;
	if(!check_null('³»¿ë',obj.contents)) return false;
	if(!check_length('³»¿ë',obj.contents,2,300)) return false;
}
function loadJs(file){
	script = document.createElement('script');
	script.src = file;
	script.type = 'text/javascript';
	script.id = 'loadScript';
	document.body.appendChild(script)
}
// ·¹ÀÌ¾î ¸ÖÆ¼»ý¼º DOM CREATE //
function setLayer(id,scriptSrc){
	add_position = add_position+10;//Æ÷Áö¼ÇÀÌµ¿
	id_name = id;
	script_id = id_name+"Js";//½ºÅ©¸³Æ® ¾ÆÀÌµð
	this.lay = document.createElement('DIV');//·¹ÀÌ¾î»ý¼º
	this.lay.setAttribute('id',id_name);
	this.lay.style.position = 'absolute';
	this.lay.style.left =  (nowClientX!=0)? centerX() + scrollLeft() +12 + add_position : centerX() + add_position+ scrollLeft()+12;
	this.lay.style.top = (nowClientY!=0)? centerY() +12 + add_position : event.clientY + scrollTop() +12;
	this.lay.style.width = '250px'; 
	this.lay.style.height = '100px';
	this.lay.style.display = 'inline';
	this.lay.style.backgroundColor = '#ffffff';
	this.lay.style.overflow='visible';
	//this.lay.style.borderColor = "#2B90FF #001DA1 #001ACF #001ACF";
	//this.lay.style.borderStyle="solid";
	//this.lay.style.borderWidth="2px";
	this.lay.style.padding="0px";
	this.lay.style.zIndex=DragObj.zIndex+1;
	document.body.appendChild(this.lay);	
	//½ºÅ©¸³Æ®»ý¼º
	this.sc = document.createElement('script');
	this.sc.id = script_id;
	this.sc.src= scriptSrc+"&layId="+id_name+"&n=" + nowTime.getTime();
	document.body.appendChild(this.sc);
}
var LayObj = new Object();
var LayObj_realHeight = Array();
function thisLayer(id,scriptSrc){
	if(!LayObj[id]){
		LayObj[id] = new setLayer(id,scriptSrc);
	}else{
		//À§Ä¡ÀÌµ¿
		document.getElementById(id).style.left =  (nowClientX!=0)? centerX() + scrollLeft() +12 + add_position : centerX() + scrollLeft()+12;
		document.getElementById(id).style.top = (nowClientY!=0)? centerY() +12 + add_position : event.clientY + scrollTop() +12;
		//ÀÎµ¦½ºÁõ°¡
		document.getElementById(id).style.zIndex = ++DragObj.zIndex;
	}
}
//·¹ÀÌ¾î ´Ý±â
function thisLayerHide(id){
	//DOM °´Ã¼»èÁ¦ÇÏ±â
	LayObj[id]='';
	document.body.removeChild(document.getElementById(id));
}
//·¹ÀÌ¾î Ãà¼Ò
function thisLayerCompact(id){
	document.getElementById(id).style.overflowY='hidden';
	LayObj_realHeight[id] = document.getElementById(id).style.height;//±âÁ¸³ôÀÌ ÀúÀå
	document.getElementById(id).style.height='29px';
}
//·¹ÀÌ¾î È®Àå
function thisLayerExtend(id){
	document.getElementById(id).style.overflowY='visible';
	if(LayObj_realHeight[id]) document.getElementById(id).style.height=LayObj_realHeight[id];//³ôÀÌ º¹±¸
}
//µå·¹±× ¿ÀºêÁ§Æ® »ý¼º
var DragObj = new Object();
DragObj.zIndex = 1;
var add_position=0;
var nowClientX = 0;
var nowClientY = 0;
//±×·¹±× ½ÃÀÛ
function dragStart(obj) {
	DragObj.node = obj;
	DragObj.x = parseInt(window.event.clientX  + document.body.scrollLeft,10);
	DragObj.y = parseInt(window.event.clientY  + document.body.scrollTop,10);
	DragObj.left = parseInt(DragObj.node.style.left,10);
	DragObj.top = parseInt(DragObj.node.style.top,10);
	//ÀÌº¥Æ® obj zIndex top
	DragObj.node.style.zIndex = ++DragObj.zIndex;
	//ÀÌº¥Æ® obj ¾ËÆÄ°ªÁÖ±â
	//DragObj.node.style.filter = 'alpha(opacity=50)';
	document.attachEvent("onmousemove", dragMove);
	document.attachEvent("onmouseup", dragStop);
	window.event.cancelBubble = true;
	window.event.returnValue = false;
}
//µå·¹±× ÀÌµ¿
function dragMove(event) {
	x = event.x + document.body.scrollLeft;
	y = event.y + document.body.scrollTop;
	DragObj.node.style.left = (DragObj.left + x -DragObj.x) + "px";
	DragObj.node.style.top = (DragObj.top + y - DragObj.y) + "px";
	window.event.cancelBubble = true;
	window.event.returnValue = false;
}
//µå·¹±× ÀÌº¥Æ® ÇØÁ¦
function dragStop(event) {
	//ÀÌº¥Æ® obj ÇÊÅÍÇØÁ¦
	//DragObj.node.style.filter = '';
	document.detachEvent("onmousemove", dragMove);
	document.detachEvent("onmouseup", dragStop);
}
//ÀÚµ¿·Î±×ÀÎ ÇÁ·Î±×·¥¿¡ ÀÇÇÑ Àü¼Û Á¦ÇÑ
var KeyPress;
function autoPubDeny(){
	KeyPress = getCookie('PHPSESSID');
}
//confirm ÈÄ ¸µÅ©ÀÌµ¿
function confirm_alert_location_href(alert,href){
	if(confirm(alert)){
		location.href=href;
	}
}
//move
function go(link){
	location.href=link;
}
function move(add_url){
	location.href='/ieznApp/index.php?g_num='+g_num+'&gs_num='+gs_num+'&'+add_url;
}
//whois service
function whois(val){
	open_window('/ieznApp/app/lib/whois.php?value='+val,'whoisW', '380','330','no');
}
//textarea resize
function resize_textarea(obj,row,min_rows,max_rows) {
	if(obj.rows + row >= min_rows && obj.rows + row <= max_rows){
		obj.rows += row;
	}
}
function contentsFix(){
	if(document.writeform.contents_fix.checked==true){
		if(window.iView){
			SetCookie('contentsFixHeight', document.all['iView'].style.height);
		}else{
			SetCookie('contentsFixHeight', document.all['sView'].style.height);
		}
	}else{
		delCookie('contentsFixHeight');
	}
}
function resize_contents(ns){
	ns = ns * 1;
	if(window.iView){
		str = new String(document.all['iView'].style.height);
	}else{
		str = new String(document.all['sView'].style.height);
	}
	now_ns = str.substr(0,str.length-2);
	Cheight =  now_ns*1 + ns;	
	if(Cheight > 100){
		if(window.iView){
			document.all['iView'].style.height = Cheight;	
			document.all['sView'].style.height = Cheight;
		}else{
			document.all['sView'].style.height = Cheight;
		}
	}
}
//°øÅëÀ¸·Î »ç¿ëµÉ ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö 
//ÀÎÅ¬·çÆ® ÇÁ·ÎÅØÆ® ´ÙÀ½ ¸µÅ©
//¸Þ¼¼Áö Ã¼ÀÎÁö
function waitBoxView(msg){
	if(ie){
		document.getElementById("waitBox").style.posLeft = page_width()/2 - 145 + document.body.scrollLeft;
		document.getElementById("waitBox").style.posTop = page_height()/2 - 44 + document.body.scrollTop;
	}else{
		document.getElementById("waitBox").style.left = page_width()/2 - 170 + window.pageXOffset;
		document.getElementById("waitBox").style.top = page_height()/2 - 44 + window.pageYOffset;		
	}
	layerShow('waitBox');
	document.getElementById("waitBoxMsg").innerHTML = msg;
}
//·¹ÀÌ¾î ÇÏÀÌµå
function layerHide(lay){document.getElementById(lay).style.display = "none";}
//·¹ÀÌ¾î ¼î¿ì
function layerShow(lay){document.getElementById(lay).style.display = "inline";}
//ÀÌ¹ÌÁö »õÃ¢À¸·Î º¸±â
function open_img(img){window.open('/ieznApp/app/lib/thumb.php?file='+img,'IMG','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=10,height=10')}
//Å° ÀÌº¥Æ® Ä¸Ãç
var KeyPress;
function capturekey() {
	var tag = event.srcElement.tagName;
	KeyPress = top.PHPSESSID;
	if(tag=='TEXTAREA' || tag=='TEXT'){	
		//textarea check
		if (event.keyCode == 10) {
			if(!blank_check_null('³»¿ë',event.srcElement,2,102400))return false;
			if(!wordFilter('³»¿ë',event.srcElement)) return false;
			if(getCookie('ld')==1){
				event.srcElement.form.submit();//crtl + enter = submit 
			}
		}
	}
}
document.onkeypress = capturekey;
//ÀÚ½ººê¶ó¿ìÁ®¿¡·¯Á¦¾î
function f(){
	return true;
}
//window.onerror = f;
//ÂÊÁö»èÁ¦
function messageDelete(key,now){
	if(confirm('ÂÊÁö¸¦ »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
		if(document.getElementById('tr'+key)) document.getElementById('tr'+key).style.display='none';
		iframe.location.href='/ieznApp/app/modules/message/message_delete.php?key='+key+'&now='+now;
	}
}
//ÂÊÁöÃë¼Ò
function messageCancel(key){
	if(confirm('ÂÊÁöÀü¼ÛÀ» Ãë¼ÒÇÏ½Ã°Ú½À´Ï±î?')){
		document.all['tr'+key].style.display='none';
		iframe.location.href='/ieznApp/app/modules/message/message_delete.php?key='+key+'&now=sendbox&mode=cancel';
	}
}
//ÂÊÁö¹Ú½º ºñ¿ì±â
function messageBox_empty(now){
	if(confirm('ÂÊÁöÇÔÀ» ºñ¿ì½Ã°Ú½À´Ï±î')){
		iframe.location.href='/ieznApp/app/modules/message/messageBox_empty.php?now='+now;
	}
}
//
//ÆË¾÷·¹ÀÌ¾î·Î ¸Þ¼¼Áö º¸ÀÌ±â »õ·Î¿îÂÊÁö µµÂø => ÀÚ±â ¾ÆÀÌµð
//
var newMsgNo=0;
function messageShow(v,img_path){
	if(getCookie('ld')==1){//·Î±×ÀÎÇÑ »ç¿ëÀÚ Ã¼Å© 
		existMessage = true;
		if(img_path=='new'){
			thisLayer("MessageShow"+v+"y"+newMsgNo,"/ieznApp/app/modules/message/read.php?id="+v+"&img_path="+img_path);
			newMsgNo++;
		}else{
			thisLayer("MessageShow"+v+"y","/ieznApp/app/modules/message/read.php?id="+v+"&img_path="+img_path);
		}
	}
}
//ÆË¾÷·¹ÀÌ¾î·Î ¸Þ¼¼Áö º¸ÀÌ±â => °ü¸®¸ðµå Å°°ª
function messageRead(v,img_path,now){
	existMessage = true;
	thisLayer("messageShow"+v+"y","/ieznApp/app/modules/message/read.php?key="+v+"&img_path="+img_path+"&now="+now);
}
document.write("<div id='waitBox' style=display:none;padding:4px>");
document.write("<table cellpadding='2' cellspacing='3' align='center' bgcolor='#ffffff' width=300>");
document.write("<tr>");
document.write("<td align='right'>");
document.write("<a href=javascript:location.reload()><img src='./images/btn_close.gif' id=closeBtn alt='close'></a>");
document.write("</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td align='center'><img src='./images/loading.gif' id='loadingImg' class='img'></td>");
document.write("</tr>");
document.write("<tr><td align='center' style='padding:4' nowrap><div id='waitBoxMsg'></div></td></tr>");
document.write("</table>");
document.write("</div>");
