// Copyright (C) idoo.net, some right reserved.
// 저작권 (C) idoo.net
// 무단 추출, 열람, 참조 금지 // 무단 열람시 형사처벌됨을 유의하시기 바랍니다.

/* ****************
 * AJAX 기본 모듈 *
 **************** */

var AjaxEngine=function(){
	this.Socket=this.createSocket();
	AjaxEngine.Socket=this.Socket;
}

AjaxEngine.prototype.createSocket=function() {
	if(window.ActiveXObject){ 
		try {return new ActiveXObject('Msxml2.XMLHTTP');} catch(e){}
		try {return new ActiveXObject("Microsoft.XMLHTTP");} catch(e) {}
	}
	else if(window.XMLHttpRequest){ 
		try{return new XMLHttpRequest();}catch(e){}
	}
	return false;
}

AjaxEngine.prototype.requestXML=function(url,returnto,type){
	if(!this.Socket) return;
	if(type==undefined) type="GET";
	var Socket=this.Socket;

	AjaxEngine.returnto=returnto;

	Socket.onreadystatechange=function(e){
		if(Socket.readyState==4) {
			if (Socket.status==200){
				xml=Socket.responseXML;
				eval(AjaxEngine.returnto);
			}
		}
	}
	Socket.open(type, url ,true);
	Socket.send(null);

	
}


AjaxEngine.prototype.requestText=function(url,returnto){
	if(!this.Socket) return;
	var Socket=this.Socket;
	AjaxEngine.returnto=returnto;

	Socket.onreadystatechange=function(e){
//		document.title+=Socket.readyState+"("+Socket.status+")";
		if(Socket.readyState==4) {
			if (Socket.status==200){
				xml=Socket.responseText;
				eval(AjaxEngine.returnto);
			}
		}
	}
	Socket.open("GET", url ,true);
	Socket.send();
}


AjaxEngine.prototype.sendPost2Text=function(url,returnto,text){
	if(!this.Socket) return;
	var Socket=this.Socket;
	AjaxEngine.returnto=returnto;
	Socket.onreadystatechange=function(e){
		if(Socket.readyState==4) {
			if (Socket.status==200){
				xml=Socket.responseText;
				eval(AjaxEngine.returnto);
			}
		}
	}
	Socket.open("POST",url,true);
	Socket.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Socket.send("text="+encodeURIComponent(text));
}


/* *************
 * 가벼운 기능 *
 ************* */


/* *************************
 * HEDWIG : 쪽지 기능 모듈 *
 ************************* */


function resizeiframe(target,div,width,height){
	var h=getLimitHeight(target.scrollHeight)+(PageMenu=="oiku" || PageMenu=="10log"?40:20);
	target.style.height=h;
}

function getLimitHeight(h){
	h=Math.abs(h);
	if(h>400) h=400;

	return h;
}

function ShowMessage(no){
	document.getElementById("message"+no).style.display='';
	resizeiframe(document.getElementById("msginmsg"+no),document.getElementById("message"+no),365,500);

	MessagePage=no;
}

function PrevNextMessage(where){
	if ((MessagePage==1 && where==-1)) return false;
	if (MessagePage==MessageNum && where==1) { closeMessage(0); return false; }
	document.getElementById("message"+MessagePage).style.display='none';;
	ShowMessage((MessagePage+where));
}

function closeConfirm(auto){
	try{
	var t=document.getElementById("layer_confirm");
	t.style.cssText='';
	t.innerHTML='';
	document.getElementById('Carpet').style.display='none';
	if(auto==1)window.setTimeout("layer_confirm.style.display='none';",500);
	else t.style.display='none';
	}catch(x){}

	top.hiddenframe.location.replace("about:blank");

}

function closeMessage(conf){
	var clearmessage;
	if(conf==1) {
		if(confirm("받은 메세지를 모두 지울까요?")) clearmessage=true;
	} else clearmessage=true;

	if (clearmessage==true){
		layer_message.innerHTML='';
		var AJAX=new AjaxEngine;
		AJAX.requestText("/_do/message/clear?atc[num]="+MessageNum,"closeMessage_do(xml)");
	}
	layer_message.style.display='none';
}

function deleteMessage(n){
	if(n==1) {
		var AJAX=new AjaxEngine;
		AJAX.requestText("/_do/message/delete?atc[num]="+MessagePage,"closeMessage_do(xml)");
	}

	if (MessagePage==MessageNum){
		document.getElementById("message"+MessagePage).innerHTML='';
		layer_message.style.display='none';
	} else {
		for(i=MessagePage;i<MessageNum;i++) document.getElementById("message"+i).innerHTML=document.getElementById("message"+(i+1)).innerHTML;
		document.getElemenById("message"+MessageNum).innerHTML='';
	}
	MessageNum--;
}
function closeMessage_do(xml){
	AlertMsg(xml==1?"받은 메세지를 모두 지웠습니다":"메세지 삭제에 실패했습니다<br>("+xml+")");
}
function openConfirm(url){
	hiddenframe.location.href="/_gohidden?"+url;
}

/* **************
 * 쿠키 및 기타 *
 ************** */

function ap_stopAll() {}
function ap_registerPlayers() {}

function Set_Cookie(name,value,expires,path,domain,secure) { 
if(expires) {
var now=new Date();
now.setSeconds(expires);
expires=now;
}
var cookieString = name + "=" +escape(value) + 
( (expires) ? ";expires=" + expires.toGMTString() : "") + 
( (path) ? ";path=" + path : "") + 
( (domain) ? ";domain=" + domain : "") + 
( (secure) ? ";secure" : ""); 

	document.cookie = cookieString; 

} 


function setPng24(obj) {
	//alert(1);
} 


/* *************************
 * 각종 레이아웃 구현 모듈 *
 ************************* */

function Lonresize(){
if(Lnickname.scrollWidth+document.getElementById('Lfeelingbox').scrollWidth>=280) Lenter.style.display=''; else Lenter.style.display='none';
}

function clearInput(){
	if(clearInput.arguments[0]) var t=clearInput.arguments[0];
	else {
		if(notIE) t=event.srcElement;
		t=window.event.srcElement;
	}

	if(!t.getAttribute('CHECKCLEAR')) {
		t.CHECKCLEAR=true; 
		t.value="";
		var n="";
		
		if(clearInput.arguments[1]) {
			n=clearInput.arguments[1];
			if(n.indexOf("Password")>-1) {
				var newO=document.createElement('input');
				newO.setAttribute('type','password');
				newO.setAttribute('name',t.getAttribute('name'));
				newO.setAttribute('id',t.getAttribute('id'));
				newO.setAttribute('style',t.getAttribute('style'));
				newO.className=t.className;
				newO.onblur=t.onblur;
				newO.onmouseover=t.onmouseover;
				newO.onmouseout=t.onmouseout;
				newO.onkeydown=t.onkeydown;
				newO.onkeyup=t.onkeyup;
				newO.onkeypress=t.onkeypress;
				t.parentNode.replaceChild(newO,t);
				t=newO;
				t.style.fontFamily='Tahoma';
				t.focus();
			}
			if(n.indexOf("Class")>-1) t.className=t.className+" "+t.className+"On";
		}
		if(!n && !t.getAttribute('NOCOLORCHANGE')) t.style.color='#333333'; 
	}


	t.focus();
}

document.preloadimg=new Array();

function fonLoad(){
f=document.getElementsByTagName("IMG");
for(i=0;i<f.length;i++){
if(f[i].getAttribute("iPUSH")!=null) {
f[i].onmousedown=fd;
f[i].onmouseout=fu;
f[i].onmouseup=fu;
f[i].ondblclick=f[i].onclick;
}
if(f[i].getAttribute("iOVER")!=null) {
document.preloadimg[i]=newImage(f[i].src.replace(".gif",".on.gif"));
f[i].onmouseover=lon;
f[i].onmouseout=loff;
}
}
var l=document.getElementsByTagName("SELECT");
for(var ii=0;ii<l.length;ii++) eva.initSelectboxes(l[ii]);//eva.
}

function fd(){
event.srcElement.style.position='relative';
event.srcElement.style.pixelTop=1;
}
function fu(){
event.srcElement.style.position='relative';
event.srcElement.style.pixelTop=0;
}

var _e_target;

function lon(e){
try {
	if(e.src) f = e;
	else {
		if(!e) f=lon.arguments[0]?lon.arguments[0]:event.srcElement;
		else f = e.target;
	}
}
catch(a) {
	if(!e) f=lon.arguments[0]?lon.arguments[0]:event.srcElement;
	else f = e.target;
}
if(f.src.indexOf(".on")<0) f.src=f.src.replace(".gif",".on.gif");
}

function loff(e){
try {
	if(e.src) f = e;
	else {
		if(!e) f=loff.arguments[0]?loff.arguments[0]:event.srcElement;
		else f = e.target;
	}
}
catch(a) {
	if(!e) f=loff.arguments[0]?loff.arguments[0]:event.srcElement;
	else f = e.target;
}
if(f.src.indexOf(".on")>0) f.src=f.src.replace(".on.gif",".gif");
}

function lpon(){
try{
	f=lon.arguments[0]?lon.arguments[0]:event.srcElement;
}catch(err){
	try{
		f=lon.arguments[0]?lon.arguments[0]:e.target;
	}catch(err){
		return;
	}
}
f=f.filters.item("DXImageTransform.Microsoft.AlphaImageLoader");
if(f.src.indexOf(".on")<0) f.src=f.src.replace(".png",".on.png"); 

}
function lpoff(){
try{
	f=lon.arguments[0]?lon.arguments[0]:event.srcElement;
}catch(err){
	try{
		f=lon.arguments[0]?lon.arguments[0]:e.target;
	}catch(err){
		return;
	}
}
f=f.filters.item("DXImageTransform.Microsoft.AlphaImageLoader");
if(f.src.indexOf(".on")>0) f.src=f.src.replace(".on.png",".png");
}

var dTg=function(e,p){
if(p=="delay") {
	dTg.timeout=window.setTimeout("document.getElementById('"+e.id+"').style.display='none';",200);
}
else {
	if(dTg.timeout!=undefined) window.clearTimeout(dTg.timeout);
	e.style.display=p!=undefined?'block':'none';
}
return true;
}

function vTg(e,p){
e.style.visibility=p!=undefined?'visible':'hidden';
return true;
}

function pOver(e){
backup_color=e.style.color;
e.style.backgroundColor=menu_overcolor;
e.style.color='#FFFFFF';
}
function pOut(e){
e.style.backgroundColor='';
e.style.color=backup_color;
}

function newImage(arg) {
if (document.images) {
rslt=new Image();
rslt.src=arg;
return rslt;
}
}

function changeImages() {
if (document.images) for (var i=0; i<changeImages.arguments.length; i+=2) document[changeImages.arguments[i]].src=changeImages.arguments[i+1];
}


/* ****************************************************
 * 이미지, 트랙백주소 등 info confirm레이어 관련 모듈 *
 **************************************************** */

function popImgProperties(pn){
	url=pn.src;while(url.indexOf("&")!=-1){url=url.replace("&","-%and%-");}
	hiddenframe.location.replace("/_gohidden?menu=imgproperties&url="+url);
}

function popImage(){
	if(popImage.arguments[0]) {var pn=new Image;	pn.src=popImage.arguments[0];	} else var pn=event.srcElement;
	if (event.ctrlKey) { popImgProperties(pn); return; }
	var top=screen.width/4;
	if(top>100) top=100;
	
	var left=screen.height/4;
	var pWindow = window.open("" ,"","toolbar=no,scrollbars=no,resizable=yes,statusbar=yes,width=10,height=10,top="+top+",left="+left);

	if(pWindow != null){
		var htmlString = "<html><head><title>10대 독립 아이두</title></head>"
		htmlString+="<script language=javascript>\n<!--\n";
		htmlString+="var s,p,s2,p2,t,t2;\n"
		htmlString+="document.title=opener.ServiceName;\n"
		htmlString+="document.domain='"+document.domain+"';\n";
		htmlString+="function resize()\n {\n var w=img1.width;\n var h=img1.height;\n var sw=screen.width-20;\n var sh=screen.height-20;\n if (h>sh) h=sh;\n if (w>sw) w=sw;\n h+=4;\n if(window.navigator.userAgent.indexOf('SV1')!=-1) h+=29; h+=25; \n window.resizeTo(w+12,h);\n s=document.body.clientWidth;s2=document.body.clientHeight;p=s-img1.width+3;p2=s2-img1.height+3;t=s;t2=s2;img1.style.cursor=(p!=3||p2!=3)?'move':'pointer';img1.style.left=0;img1.style.top=0;";
		
		htmlString+="window.moveTo((screen.width/2)-(w/2),(screen.height/2)-(h/2));}\n";
		htmlString+="function gotit(){if(document.body.clientWidth<100 || document.body.clientHeight<100) {return false;}\nif(t!=document.body.clientWidth || t2!=document.body.clientHeight) resize();\n if(img1.height<document.body.clientHeight) return; if(p*-1<=3&&p2*-1<=3)return; try{	if(p!=3) img1.style.left=event.x/s*p;if(p2!=3)img1.style.top=event.y/s2*p2;";
		htmlString+="}catch(d){}}\n"
		htmlString+="//-->\n</script>";
		htmlString += "<body bgcolor=black leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 ONCONEXTMENU=\"return false\" ONMOUSEMOVE=\"gotit()\">"
		htmlString += "<img src=\"" + pn.src + "\" style=\"position:absolute; cursor:hand;cursor:pointer;\" ONCLICK=\"window.close()\" alt=\"닫기\" onload=\"resize();\" id=\"img1\">"
		htmlString += "</body></html>"
		pWindow.document.open()
		pWindow.document.write(htmlString);
	}
	if(pWindow != null) pWindow.focus()

	return pWindow
}

function trackbackurlcopy(){	
	if(typeof(trackbackurlcopy.arguments[0])=="string"){
			window.clipboardData.setData("text",trackbackurlcopy.arguments[0]);
	}
	else if(typeof(trackbackurlcopy.arguments[2])!="undefined") {	
			window.clipboardData.setData("text",trackbackurlcopy.arguments[0].innerHTML);
	} else {
		var target=trackbackurlcopy.arguments[0]?trackbackurlcopy.arguments[0]:event.srcElement;
	
		text = document.body.createTextRange();
		text.moveToElementText(target);
		text.execCommand("Copy");
	}
	alert((trackbackurlcopy.arguments[1]?trackbackurlcopy.arguments[1]:"트랙백 URL이")+" 클립보드에 복사되었습니다");
}	

function resizeImage(event){
	if(!notIE) event=window.event;

	try{
		var i=new Image();
		i.src=event.srcElement.src;
		var v=i.width;
		var v2=event.srcElement.getAttribute("WIDTH");

		if(v<=v2){
			chgIMGsize(event.srcElement,resizeLimit,0);
			if(event.srcElement.style.visibility!='visible') event.srcElement.style.visibility="visible";
		}
	}catch(x){};

}


function changeIMGsize(w,h){
	var photo=changeIMGsize.arguments[3]?changeIMGsize.arguments[3]:window.event.srcElement;
	try{	if(photo.style.display=='none') photo.style.display='block';}catch(e){}
	var i=new Image();

	i.src=photo.src;
	owidth=i.width; oheight=i.height;

	if(h==-1){
		if (owidth<oheight) { var px=parseInt(w * (owidth/oheight)); var py=w;}
		else { var py=parseInt(w * (i.height/i.width)); var px=w;}
		photo.width=px; photo.height=py;
	} else{
		if((owidth>w || owidth==0)&&w!=0) photo.width=w;	
		if(h!=0 && photo.height>h) photo.height=h;
	} 

}

function chgIMGsize(photo,w,h,t){
	if(t==undefined) t="";
	var i=new Image();
	i.src=photo.src;
	owidth=i.width; oheight=i.height;

//	try{ photo.style.display='none';}catch(e){}

	if(w>0) {
		if(owidth>w || photo.width>w){
			photo.width=w;
			photo.height=parseInt(w*oheight/owidth);
		}
	}
	if(h>0) {
		if(oheight>h || photo.height>h){
			var pw=parseInt(h*owidth/oheight);
			if(t=="h" || pw<=w) {
				photo.height=h;
				photo.width=pw;
			}
		}
	} 
	try{ if(photo.style.display=='none') photo.style.display='block';}catch(e){}
}

function openNation(na,ad){
	gohidden('/_gohidden?menu=friend&sub=confirm_nation&atc[code]='+na+(ad!=undefined?'&atc[address]='+ad:''));
}

function togglemore(e){
	e.style.display=e.style.display=='block'?'none':'block';
}

function chat(channel,title,type){
	if(!channel) channel='';
	if(!title) title='';
	if(!type) type='chet';
	url=type=='chet'?'/SAmodules/chet/?':'http://www.idoo.net/?menu=chat&';

	window.open(url+(channel?'channel='+channel:'')+(title?'&title='+title:''),'chat','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=700,height=497');
}



/* *********************
 * 각종 박스 실행 모듈 *
 ********************* */


function go(url){	window.location.href=url; }
function goblank(url){	window.open(url,'NewWin_idoo',''); }
function gohidden(url){ hiddenframe.location.replace(url); }
function goMy(user_id) { window.location.href='http://'+(user_id==undefined?pMyid:user_id)+'.10log.net/';}

/* ********************
 * 오브젝트 생성 모듈 *
 ******************** */

function createPlayer2(url,autoplay,id,x){
	url=url.split("#");
	url=url[0];
	url=url.replace('http://data.idoo.net/','/data/').replace('http://static.idoo.net/','/data/');
	if(id==null) id = "swfplayer_"+parseInt(Math.random() * 10000000000)
	var FlashVars="playerID=1&bg=0xf8f8f8&leftbg=0xeeeeee&lefticon=0x666666&rightbg=0xcccccc&rightbghover=0x999999&righticon=0x666666&righticonhover=0xffffff&text=0x666666&slider=0x666666&track=0xFFFFFF&border=0x666666&loader=0x9FFFB8&soundFile="+url;
	var txt='<OBJECT ONCLICK="return false" STYLE="margin:5px 0;" TYPE="application/x-shockwave-flash" WIDTH="290" HEIGHT="24" ID="'+id+'">';

	txt+='<PARAM NAME="movie" VALUE="/component/player.swf" /><PARAM NAME="FlashVars" VALUE="'+FlashVars+'" /><PARAM NAME="quality" VALUE="high" /><PARAM NAME="menu" VALUE="false" /><PARAM NAME="wmode" VALUE="transparent" /></OBJECT>';
	if(x==1) {
		document.write(txt);
		//document.getElementById(id).FlashVars=FlashVars;

	}
	else return txt;
}

function createPlayer(url,autoplay,id,x,autosize,fm,size,uiMode,bord){
	if(uiMode=="") uiMode=null;
	if(id==null) id = "mplayer_"+parseInt(Math.random() * 10000000000);
	if(PageAutoplay=="false" && autoplay=='true') autoplay='false';
	if(autoplay=='') autoplay='false';

	if(url.indexOf("#FLASH")>0) txt=createPlayer2(url,autoplay,id);
	else {
		var txt='<OBJECT ID='+id+' type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#VERSION=6,4,7,1112" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '+(size!=""?size:"")+(autosize==1?'':' HEIGHT=45')+(bord!=null && bord!=""?' STYLE="border:'+bord+'"':'')+'>';
		if(autosize==1) txt+='<param name="AutoSize" value="true">';
		txt+='<param name="EnableContextMenu" value="false"><param name="uiMode" value="'+(uiMode!=null?uiMode:"full")+'"><param name="URL" value="'+url+'"><param name="autostart" value="'+autoplay+'"><param name="stretchToFit" value="true"></OBJECT>';
		if(autosize==1 && fm!=1){
			txt+='<script for="'+id+'" event="PlayStateChange()" type="text/javascript">\n<!--\n';
			txt+='objPlayer = document.'+id+';\n';
			txt+='if(objPlayer.PlayState==3 ) {\n';
			txt+='objPlayer.width=parseInt(objPlayer.currentMedia.imageSourceWidth);\n';
			txt+='objPlayer.height=parseInt(objPlayer.currentMedia.imageSourceHeight)+60;\n';
			txt+='}\n';

			txt+="//-->\n</SCRIPT>";
		}
	}
	if(x==1) return txt;
		else document.write(txt);

}


function createFlashObject(url,bord,id,towhere,width,height,stop){
	if(id==null) id = "swfobj_"+parseInt(Math.random() * 10000000000)
	if(width==null) width=300;
	if(height==null) height=300;

	var txt='<object '+(bord!=""?'style="border:'+(bord==1?'1px solid #ccc;':bord)+'" ':'')+'type="application/x-shockwave-flash" data="'+url+'" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'" />'+(stop==1?'<param name="play" value="false" />':'')+'</object>';
	if(towhere==1) return txt;
		else document.write(txt);
}

function createDaumPlayer(movieId,mainImgUrl){
	var code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="' + movieId + '" name="' + movieId + '" width="402px" height="324px" align="middle"><param name="mainImage" value="' + mainImgUrl + '" /><param name="movie" value="http://flvs.daum.net/flvPlayer.swf?vid=' + movieId + '" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://flvs.daum.net/flvPlayer.swf?vid=' + movieId + '" quality="high" bgcolor="#ffffff" width="402px" height="324px" swLiveConnect=true name="' + movieId + '" id="' + movieId + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><\/object>';
	document.write(code);
}
function createSlide(id,u){
//	alert(u);
	t=eval('Slide'+id);
	var x=u.split("|");
	t.copyright=x[0];
	x[2]=x[2].split("/");
	var items=new Array;
	var j=0;
	for(i=3;i<x.length-1;i+=2) {
		items[j]=x[i];
		items[j+1]=x[i];
		items[j+2]=x[i+1];
		j+=3;
	}
	var xx=x[1].split(",");
	t.Generate(id,x[2][0]==1?0:1,xx[0],xx[1],1);

	t.ItemAdd(items);
	t.Show();

}

function createSrc(src){
    document.write(src); 
}


/* *************************
 * 각종 레이아웃 표시 모듈 *
 ************************* */

function makeBallon(t,msg,margy,margx){
	var rh=t.scrollHeight;
	var rw=t.scrollWidth;
	if(margy==undefined) margy=8;
	if(margx==undefined) margx=0;
	var tid=t.getAttribute("initBallon");
	if(tid==null) {
		tid = "Ballon_"+parseInt(Math.random() * 10000000000)
		var box="<DIV ID=\""+tid+"\" STYLE=\"position:absolute;z-index:999999;display:block;margin:"+(parseInt(rh)+margy)+"px "+margx+";\" ONMOUSEOVER=\"this.style.display='block'\" ONMOUSEOUT=\"this.style.display='none'\">";
		box+="<DIV STYLE=\"padding:0 14px;margin-top:-8px;position:absolute;\"><IMG SRC=\"http://i2.idoo.net/ui/layout/box4_arr.gif\" WIDTH=8 HEIGHT=9></DIV>";
		box+="<DIV ID=\""+tid+"msg\" STYLE=\"position:absolute;margin:2px 2px;padding:0 6px;text-align:center;white-space:nowrap\" class=\"BallonMessage\">";
		box+=msg;
		box+="</DIV>";

		box+="<DIV ID=\""+tid+"t1\" STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_t1.gif') top left no-repeat; height:5px;overflow:hidden\">";
		box+="<DIV STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_t2.gif') top right no-repeat;height:5px;overflow:hidden\">";
		box+="<DIV STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_t0.gif') top repeat-x;margin:0 6px 0 5px;height:5px;overflow:hidden\">";
		box+="</DIV></DIV></DIV>";
		box+="<DIV STYLE=\"background:#FCF0D2\">";
		box+="<DIV STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_m1.gif') left repeat-y;\">";
		box+="<DIV ID=\""+tid+"m1\" STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_m2.gif') right repeat-y;\">";
		box+="</DIV></DIV></DIV>";
		box+="<DIV ID=\""+tid+"b1\" STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_b1.gif') bottom left no-repeat;height:6px; overflow:hidden\">";
		box+="<DIV STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_b2.gif') bottom right no-repeat;height:6px;overflow:hidden\">";
		box+="<DIV STYLE=\"background:url('http://i2.idoo.net/ui/layout/box4_b0.gif') top repeat-x;margin:0 6px 0 5px;height:6px;overflow:hidden\">";
		box+="</DIV></DIV></DIV>";


		t.insertAdjacentHTML("beforeBegin", box);
		var rxw=document.getElementById(tid+"msg").scrollWidth+17;
		var rxh=document.getElementById(tid+"msg").scrollHeight-4;
		if(rxw<36){
			rxw=msg.replace(/<[^>]+>/g, "").length*13;
		}
		if(rxh>200) rxh=18;

		document.getElementById(tid+"t1").style.width=rxw;
		document.getElementById(tid+"m1").style.width=rxw;
		document.getElementById(tid+"b1").style.width=rxw;
		document.getElementById(tid+"m1").style.height=rxh;
		
		t.setAttribute("initBallon",tid);
		t.onmouseout=function(){killBallon(this);}

	} else {
		document.getElementById(tid).style.display='block';
	}

}
function makeBallonTag(t,user_no,nick,csstype,sty){
	if(csstype==undefined) csstype="";
	if(sty==undefined) sty="";
	makeBallon(t,'<DIV CLASS="'+csstype+'" STYLE="'+sty+'"><A HREF="javascript:popup(\''+user_no+'\')" STYLE="color:'+PageGroupColor+';'+sty+'">'+nick+'</A></DIV>');
}
function killBallon(t){
	document.getElementById(t.getAttribute("initBallon")).style.display='none';
}


function round(w,c,t,fill) {	// 동그란 상자 만들기

if(t=="t") {
html="<table cellpadding=0 cellspacing=0 border=0 style='width:"+w+";margin:0px;padding:0px;' class=fixed>";
html+="<tr style='height: 1px;'><td rowspan=4 style='width:1px;' class=bin></td><td rowspan=3 style='width:1px;' class=bin> </td>";
html+="<td rowspan=2 style='width:1px;' class=bin> </td><td style='width:1px;' class=bin> </td><td bgcolor="+c+" class=bin> </td>";
html+="<td style='width:1px;' class=bin></td><td rowspan=2 style='width:1px;' class=bin> </td><td rowspan=3 style='width:1px;' class=bin> </td>";
html+="<td rowspan=4 style='width:1px;' class=bin> </td></tr>";
html+="<tr style='height:1px;'><td bgcolor="+c+" class=bin> </td>";
html+="<td "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td bgcolor="+c+" class=bin> </td></tr>";
html+="<tr style='height: 1px;'><td bgcolor="+c+" class=bin> </td><td colspan=3 "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td>";
html+="<td bgcolor="+c+" class=bin> </td></tr>";
html+="<tr style='height:2px;'><td bgcolor="+c+" class=bin> </td>";
html+="<td colspan=5 "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td bgcolor="+c+" class=bin> </td></tr></table>";
} else {
html="<table cellpadding=0 cellspacing=0 border=0 style='width:"+w+";margin:0px;padding:0px;' class=fixed>";
html+="<tr style='height: 2px;'><td rowspan=4 width=1 class=bin> </td><td width=1 bgcolor="+c+" class=bin> </td><td style='width:1px;' "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td>";
html+="<td style='width:1px;' "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td width=1 "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td>";
html+="<td style='width:1px;' "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td style='width:1px;' bgcolor="+c+" class=bin> </td><td rowspan=4 style='width:1px;' class=bin> </td></tr>";
html+="<tr style='height: 1px;'><td rowspan=3 class=bin> </td><td bgcolor="+c+" class=bin> </td><td colspan=3 "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td>";
html+="<td bgcolor="+c+" class=bin> </td><td rowspan=3 class=bin> </td></tr>";

html+="<tr style='height:1px;'><td rowspan=2 class=bin> </td>";
html+="<td bgcolor="+c+" class=bin> </td><td "+(fill!=""?"style='background:"+fill+"'":"")+" class=bin> </td><td bgcolor="+c+" class=bin> </td><td rowspan=2 class=bin> </td></tr>";

html+="<tr style='height: 1px;' class=bin><td class=bin> </td><td bgcolor="+c+" class=bin> </td><td class=bin> </td></tr></table>";
}
document.write(html);
}
function CarpetShow(c,t){
	try{
	if(t==undefined) t=document;
	if(c=="red") t.getElementById("Carpet").style.backgroundColor='#900';
	else if(c=="blue") t.getElementById("Carpet").style.backgroundColor='#003';
	else t.getElementById("Carpet").style.backgroundColor='#030';
	t.getElementById("Carpet").style.display='block';
	}catch(e){}
}

function AlertShow(msg,t,dofunc){
	var color='red';
	var tcolor='900';
	var bcolor='ff0';
	if(t=='blue') {
		color=t;
		tcolor='009';
		bcolor='9cf';
		t='';
	}
	if(t==undefined || t=='') t=document;
	CarpetShow(color,t);

	var g=t.getElementById("layer_confirm");
	if(g==undefined) {
		alert(msg);
		if(dofunc!=undefined) eval(dofunc);
	} else {
		g.style.cssText='border:0px;';
		if(dofunc==undefined || dofunc=='') dofunc="closeConfirm();";
		g.innerHTML='<DIV STYLE="background:#'+bcolor+'" ONCLICK="'+dofunc+'"><DIV STYLE="border:4px dashed #000"><DIV ONSELECTSTART="return false;" CLASS=hand STYLE="background:white;padding:10px 20px;"><TABLE><TD WIDTH=45><IMG SRC="http://i2.idoo.net/common/alerticon.gif" WIDTH=31 HEIGHT=24></TD><TD STYLE="font-size:14pt;font-weight:bold;letter-spacing:-1px;color:#'+tcolor+';font-family:맑은 고딕,돋움;" NOWRAP>'+msg+'</TD></TABLE><DIV STYLE="text-align:center;color:#b0b0b0;padding:5px 0 0 0" CLASS="ksmall"><SPAN STYLE="border:1px solid #ccc;border-width:0 0 1px 0">확인</SPAN></DIV></DIV></DIV></DIV>';
		g.style.display='block';
		eval('t.getElementById("Carpet").onclick=function(){'+dofunc+'}');
		top.setTimeout(dofunc,3000);
	}

}


function AlertMsg(msg,bg){

document.getElementById("Layer_RightMsg").innerHTML=msg;
document.getElementById("Layer_RightMsg").style.visibility='visible';
if(msg.indexOf("[에러")<0) setTimeout("document.getElementById('Layer_RightMsg').style.visibility='hidden';",1000);

}

/* *************************
* 로그인 상자 박스 채우기 *
************************* */

function getBoxItem(part,lid){
	var boxid="box_my"+part+(lid==1?"_p":"");
        dTg(document.getElementById(boxid),1);
	if(document.getElementById(boxid).getAttribute("ckd")==1) return;

	var AJAX=new AjaxEngine;

	AJAX.requestXML("/_getBoxItem?user_no="+pMyno+"&part="+part,"getBoxItem_do('"+part+"','"+lid+"',xml)");
}

function getBoxItem_do(part,lid,oXML){
	var boxid="box_my"+part+(lid==1?"_p":"");
	document.getElementById(boxid).style.display='block';

//document.title=document.getElementById("box_my"+part+(lid==1?"_p":"")).offsetTop;

	var sources=oXML.selectNodes("/idoo/items/"+part+"/item");

	var sHTML='';
	for(i=0;i<sources.length;i++) {
		var d=sources[i];
		switch(part){
			case "album":

	var rPhotoAlbumno=d.selectSingleNode("albumno").text;
	var rPhotoTitle=d.selectSingleNode("title").text;
	var rPhotoPhoto=d.selectSingleNode("photo").text;
	sHTML+='<A HREF="http://www.idoo.net/?menu=photo&sub=my&user_no='+pMyno+'&albumno='+rPhotoAlbumno+'" STYLE="color:#a97">'+rPhotoTitle+' <FONT CLASS=small COLOR=#C0C0C0>('+rPhotoPhoto+')</FONT></A><BR>';

			break;
			case "blog":

	var rBlogType=d.getAttribute("type");
	var rBlogTableid=d.selectSingleNode("tableid").text;
	var rBlogTableno=d.selectSingleNode("tableno").text;
	var rBlogTitle=d.selectSingleNode("title").text;
	var rBlogMaxUser=d.selectSingleNode("maxuser").text;

	var rBlogComment=d.selectSingleNode("comment").text;
	rBlogComment=rBlogComment.substring(0,(rBlogType.indexOf("_s")>0?25:40)-rBlogTitle.length)
	var rBlogSecretimg=d.getAttribute("secret")=='s'?'<IMG SRC="http://i2.idoo.net/common/secret.gif" BORDER=0 WIDTH=12 HEIGHT=7 STYLE="position:absolute;margin-top:4px;">     ':'';
	var rBlogNewitem=d.getAttribute("new")=='1'?'<IMG SRC="http://i2.idoo.net/common/new2.gif" BORDER=0 WIDTH=28 HEIGHT=11 STYLE="position:absolute;margin-top:2px;">         ':'';
	var rBlogPapers=d.selectSingleNode("papers").text;
	var rBlogColorT="666666";
	var rBlogColorC="999999";
	switch(rBlogType){
		case "blog":
			var rBlogColor=rBlogMaxUser<2?"2597A1":"1CC6D5";
			break;
		case "blog_s":
			var rBlogColor=rBlogMaxUser<2?"91A91E":"A8BE1C";
			var rBlogColorT=rBlogMaxUser<2?"777777":"999999";
			break;
	}

	if(orBlogMaxUser<2 && rBlogMaxUser>=2) sHTML+='<DIV STYLE="background:url(\'http://i2.idoo.net/common/dot_1.gif\'); height:1px; overflow:hidden;margin:4px 0;" CLASS="hr none"> </DIV>';
	else if(orBlogType!=undefined && orBlogType.indexOf("_s")<0 && rBlogType.indexOf("_s")>0) sHTML+='<DIV STYLE="border:3px double #dcdcdc; border-width:3px 0 0 0; height:3px;overflow:hidden;margin:4px 0" CLASS="hr none"> </DIV>';

	sHTML+='<div class=ksmall ID="bss'+rBlogType.substring(0,1)+rBlogTableno+'"><A HREF="http://'+rBlogTableid+'.idoo.net">';
	sHTML+='<FONT CLASS="type0 b" COLOR='+rBlogColor+' FACE=Tahoma>['+rBlogTableid+']</FONT> ';
	sHTML+='<B><FONT COLOR=#'+rBlogColorT+'>'+rBlogTitle+'</FONT></B>';
	sHTML+=' - <FONT COLOR=#'+rBlogColorC+'>'+rBlogComment+'</FONT>';
	sHTML+=' <FONT CLASS=small2 COLOR=#A0A0A0 STYLE="font-weight:normal">('+rBlogPapers+')</FONT> '+rBlogSecretimg+' '+rBlogNewitem+'</B></A>';
	if(rBlogType.indexOf("_s")>0) sHTML+=" <FONT CLASS=\"u hand\" ONCLICK=\"if(confirm('정말 구독을 끊으실건가요?'))gohidden('http://"+rBlogTableid+".idoo.net/_do/"+rBlogType.replace("_s","")+"/"+(rBlogType=="blog_s"?"blog_subscript_delete":"favorite_del")+"?atc[hidden]=y&tableno="+rBlogTableno+"')\" COLOR=#D0D0D0>삭제</FONT>";
	sHTML+='</div>';
	var orBlogMaxUser=rBlogMaxUser;
	var orBlogType=rBlogType;

			break;
			case "ring":
			case "club":
			case "ringclub":
	var rType=d.getAttribute("type");
	if(orType=="r" && rType=="c") sHTML+='<DIV CLASS="hr none" STYLE="background:url(\'http://i2.idoo.net/common/dot_1.gif\'); height:1px; overflow:hidden;margin:4px 0"> </DIV>';

	if(rType=='r') {
	var rRingTableid=d.selectSingleNode("tableid").text;
	var rRingTableno=d.selectSingleNode("tableno").text;
	var rRingTitle=d.selectSingleNode("title").text;
	var rRingMember=d.selectSingleNode("member").text;
	sHTML+='<A HREF="#" ONCLICK="openring(\''+rRingTableno+'\',\'\')"><B><FONT CLASS="type0" COLOR=#F59813 FACE=Tahoma>['+rRingTableid+']</FONT></B> '+rRingTitle+'</A><FONT COLOR=#AAAAAA CLASS=small2>('+rRingMember+')</FONT><BR>';
	} else {
	var rClubid=d.selectSingleNode("clubid").text;
	var rClubno=d.selectSingleNode("clubno").text;
	var rClubTitle=d.selectSingleNode("title").text;
	var rClubMember=d.selectSingleNode("member").text;
	sHTML+='<A HREF="http://www.idoo.net/?menu=agit&sub=club&clubno='+rClubno+'"><B><FONT CLASS="type0" COLOR=#A781E0 FACE=Tahoma>['+rClubid+']</FONT></B> '+rClubTitle+'</A> <FONT COLOR=#AAAAAA CLASS=small2>('+rClubMember+')</FONT><BR>';
	}
	
	var orType=rType;
			break;
		}
	}
	document.getElementById(boxid+"inner").innerHTML=sHTML;
	document.getElementById(boxid).ckd=1;
	document.getElementById(boxid).style.width=document.getElementById(boxid).scrollWidth+20;
	var mover=document.getElementById(boxid).onmouseover;
	var mout=document.getElementById(boxid).onmouseout;

	var n=document.getElementById(boxid).getElementsByTagName('DIV');
	for(i=0;i<n.length;i++) {
		if(n[i].className=='hr none') n[i].className='hr';
	}
}


/* ******************************
 * LUNAR : 닉네임 클릭 팝업메뉴 *
 ****************************** */


var target_user,backup_color,onEditor;

document.onclick=MouseDown;
document.oncontextmenu=RightClick;

var popByNon=0;

var menu_name="member_popup";
var menu_overcolor="#999999";



var popMenuEngine=function(){
	this.menu_name="member_popup";
	this.menu_overcolor="#999999";
	
	this.Items=new Array;
	this.subItems=new Array;
	this.Width=77;
}


popMenuEngine.prototype.generate=function(){
	var popup_style="border:1px solid #C0C0C0;background:#EAEAEA;padding:2px; filter:progid:DXImageTransform.Microsoft.Shadow(color='#DDDDDD', Direction=135, Strength=1)";

	var popFriendType=false;

	document.write('<DIV id="'+this.menu_name+'" style="position:absolute;display:none;z-index:998; filter:alpha(opacity=100);'+popup_style+'">');
	document.write('<TABLE WIDTH="'+this.Width+'" CELLSPACING="0" CELLPADDING="0" BGCOLOR=#FFFFFF>');

	var y=-17;
	for(i=0;i<this.Items.length;i++){
	y += this.Items[i][0]=="-" ? 1 : 20;
	if(this.Items[i][0]=="-") 
			document.write('<TR><TD COLSPAN=3 BGCOLOR=#EAEAEA HEIGHT=1></TD></TR>');
	else {
			document.write('<TR><TD NOWRAP HEIGHT=19 ONCLICK="run(\''+this.Items[i][1]+'\');"');
			document.write(' ONMOUSEOUT="pOut(this);'+(this.subItems[this.Items[i][1]]!=undefined?'member_popup_sub_'+this.Items[i][1]+'.style.display=\'none\'':'')+'"');
			document.write(' ONMOUSEOVER="pOver(this);'+(this.subItems[this.Items[i][1]]!=undefined?' OpenSub(\'member_popup_sub_'+this.Items[i][1]+'\','+y+')':'')+'"');
			document.write(' STYLE="'+(this.Items[i][2]!=undefined?this.Items[i][2]:'')+'; cursor:hand; line-height:150%; padding:1px 0 0 6px;"');
			document.write(' ID=popupSub'+this.Items[i][1]+'>');
			document.write(this.subItems[this.Items[i][1]]!=undefined?'<IMG SRC="http://i2.idoo.net/common/popup_arrow.gif" WIDTH=7 HEIGHT=13 ALIGN=RIGHT>':'');
			document.write(this.Items[i][0]);
			document.write('</TD></TR>');
		}
	}
	document.write('<!--[ADDON]-->');
	document.write('</TABLE></DIV>');

	for(i=0;i<this.Items.length;i++)
		if(this.Items[i][0]!="-" && this.subItems[this.Items[i][1]]!=undefined) {
			sPopItem=this.subItems[this.Items[i][1]];

			document.write('<DIV ID="member_popup_sub_'+this.Items[i][1]+'"');
			document.write(' STYLE="position:absolute;display:none;z-index:999;filter:alpha(opacity=100);'+popup_style+'"');
			document.write(' ONMOUSEOVER="this.style.display=\'\';" ONMOUSEOUT="this.style.display=\'none\';">');
			document.write('<TABLE WIDTH="70" CELLSPACING="0" CELLPADDING="0">');

		for(j=0;j<sPopItem.length;j++)
				if(sPopItem[j][0]=='-')
					document.write('<TR><TD COLSPAN=3 BGCOLOR=#BBBBBB HEIGHT=1><IMG SRC="http://i2.idoo.net/common/spacer.gif" HEIGHT=1></TD></TR>');
		else {
					document.write('<TR><TD NOWRAP HEIGHT=19 bgcolor=#ffffff onclick="run(\''+sPopItem[j][1]+'\');"');
					document.write(' onmouseout="pOut(this);" onmouseover="pOver(this);"');
					document.write(' STYLE="color:#000;cursor:hand;padding:1px 0 0 6px;'+(sPopItem[j][2]!=undefined?sPopItem[j][2]:'')+'">');
					document.write(sPopItem[j][0]);
					document.write('</TD></TR>');
				}
		document.write('</TABLE></DIV>');
		}
}

popMenuEngine.prototype.setPosition=function(){
	screen_height=window.document.body.offsetHeight;screen_width=window.document.body.offsetWidth;
	pos_x=window.document.body.scrollLeft+event.clientX-10;pos_y=event.clientY+window.document.body.scrollTop;
	if (screen_height > event.y) pos_y=event.clientY+window.document.body.scrollTop; else pos_y=event.clientY+window.document.body.scrollTop;
	if (event.y < 0) pos_y=event.clientY+window.document.body.scrollTop;
	eval(menu_name+".style.display=\"\"");eval(menu_name+".style.pixelLeft ="+pos_x);eval(menu_name+".style.pixelTop ="+pos_y);
}

popMenuEngine.prototype.Close=function(){
	document.getElementById(popupMenu.menu_name).style.display = 'none';
	for(i=0;i<popupMenu.Items.length;i++) if(popupMenu.Items[i][0]!='-' && popupMenu.subItems[popupMenu.Items[i][1]]!=undefined)
		document.getElementById('member_popup_sub_'+popupMenu.Items[i][1]).style.display = 'none';
}

function MouseDown(e) {
	try{
		if(typeof(notIE)=="undefined") return;
	}catch(x){};
	if(notIE) return;

	if(popByNon==1) {popByNon=0;return} else popupMenu.Close();
	//if(e==undefined) e=window.event;


	//if (!e) var e = window.event;
	//_target = (!e.target)?e.srcElement:e.target;
	//if(_target.nodeType == 3){
	//	_target = _target.parentNode;
	//}

	//var eventobj=e.srcElement;
	var eventobj=window.event.srcElement;

	e=eventobj.toString();

	if(e.indexOf("javascript:popup('")==0){
		if(e.ctrlKey) {
			ev=e.replace("javascript:popup('","");
			ev=ev.replace("')","");
			openbox(ev,'home');
		} else if(e.altKey) {
			ev=e.replace("javascript:popup('","");
			ev=ev.replace("')","");
			openbox(ev,'interview');
		}
	}
	if (!e.indexOf("javascript:popup(") && popupMenu.menu_name != "none"){
		popupMenu.setPosition();
	}
	if(eventobj.tagName=="BODY") closeConfirm();
	if(onEditor==1) try{MouseDownEditor(eventobj);}catch(eee){}
}

function RightClick(e){
try{
	var eventobj=event.srcElement;
}catch(e){
	try{
		var eventobj=e.target;
	}catch(e){
		return;
	}
}
	e=eventobj.toString();

	if(e.indexOf("javascript:popup('")==0) {
		ev=e.replace("javascript:popup('","");
		ev=ev.replace("')","");

		openbox(ev,'home');
	}
//	return false;
}
function popup(d){

/*
if (!e) var e = window.event;
	_target = (!e.target)?e.srcElement:e.target;
if(_target.nodeType == 3){
	_target = _target.parentNode;
}*/

	if (parseInt(d)==0) popupMenu.Close();

	try{
		if(event.srcElement.tagName != 'A'){
			popupMenu.setPosition();
			popByNon=1;
		}
	}catch(e){}

	target_user=d;
	var AJAX=new AjaxEngine;
	AJAX.requestXML("/_getBoxItem?user_no="+target_user+"&myno="+pMyno+"&part=blog&frombox=1","popup_do('"+target_user+"',xml)");
}

function popup_do(target_user,oXML){
	var sources=oXML.selectNodes("/idoo/items/blog/item");
	var sHTML='', sPHTML='',mmfriend=0;
	for(i=0;i<sources.length;i++) {
		var d=sources[i];

	var rBlogType=d.getAttribute("type");
	popFriendType=false;
	switch(rBlogType){
		case "friend":
			var rFriendType=d.selectSingleNode("type").text;
			popFriendType=rFriendType;
			if(rFriendType=="ban") {
				document.getElementById('popupSubsub3').style.color='#bbb';
				document.getElementById('popupSubsub3').innerText='차단풀기';
			}
			else {
				document.getElementById('popupSubsub3').style.color='#099';
				document.getElementById('popupSubsub3').innerText='관계수정';
/*
this.subItems['sub3']=[
	['관계수정','profileInterview'],
	['관계끊기','profileBGM'],
	['스크랩','profileScrap']
];
*/

			}
			mmfriend=1;
			break;
		case "photo":
			var rPhotoAlbumno=d.selectSingleNode("albumno").text;
			var rPhotoTitle=d.selectSingleNode("title").text;
			var rPhotoPhoto=d.selectSingleNode("photo").text;
			sPHTML+='<tr><TD NOWRAP HEIGHT=19 bgcolor=#ffffff onclick="run(\'run:http://www.idoo.net/?menu=photo&sub=my&user_no='+target_user+'&albumno='+rPhotoAlbumno+'\');" onmouseout="pOut(this)" onmouseover="pOver(this)" style="color:#F59813; cursor:hand; line-height:150%; padding-left:6px; padding-right:6px; padding-top:1px">'+rPhotoTitle+' <FONT CLASS=small COLOR=#C0C0C0>('+rPhotoPhoto+')</FONT></TD></TR>';
			break;
		default:

			if(d.getAttribute("secret")=='s' && pMyno!=target_user) break;

			var rBlogTableid=d.selectSingleNode("tableid").text;
			var rBlogTableno=d.selectSingleNode("tableno").text;
			var rBlogTitle=d.selectSingleNode("title").text;
			var rBlogSecretimg=d.getAttribute("secret")=='s'?'<IMG SRC="http://i2.idoo.net/common/secret.gif" BORDER=0 WIDTH=12 HEIGHT=7>':'';
			if(orBlogType=="blog" && rBlogType=="diary") sHTML+="<TR><TD COLSPAN=3 BGCOLOR=#eaeaea HEIGHT=1><IMG SRC=\"http://i2.idoo.net/common/spacer.gif\" HEIGHT=1></TD></TR>";
			sHTML+='<tr><TD NOWRAP HEIGHT=19 bgcolor=#ffffff onclick="run(\'run:http://'+rBlogTableid+'.idoo.net\');" 	onmouseout="pOut(this)" onmouseover="pOver(this)" style="color:'+(rBlogType=='blog'?'#188A9C':'#18C7D6')+'; cursor:hand; line-height:150%; padding-left:6px; padding-right:6px; padding-top:1px">'+rBlogTitle+' <FONT CLASS=small COLOR=#C0C0C0><FONT COLOR=#E0E0E0> | </font>'+rBlogTableid+'</FONT></TD></TR>';
		break;
	}
	var orBlogType=rBlogType;
	}
	try{
		if(mmfriend==0) {
			document.getElementById('popupSubsub3').innerText='친구맺기';
			document.getElementById('popupSubsub3').style.color='#333';
		}
	}catch(e){};
	document.getElementById("member_popup_sub_sub2").innerHTML='<TABLE cellspacing="0" cellpadding="0">'+sHTML+'</TABLE>';
	document.getElementById("member_popup_sub_sub5").innerHTML='<TABLE cellspacing="0" cellpadding="0">'+sPHTML+'</TABLE>';
}

popMenuEngine.prototype.init=function(){
	this.Items=[
		['프로필','sub1','font-weight:bold'],
		['블로그','sub2','color:#07a'],
		['마이앨범','sub5','color:#a70']
	];

	if(typeof(pMyno)!="undefined"&&pMyno!=0)
	this.Items=[
		['프로필','sub1','font-weight:bold'],
		['블로그','sub2','color:#07a'],
		['마이앨범','sub5','color:#a70'],
		['-'],
		['친구맺기','sub3'],
		['초대하기','sub4','color:#7a0'],
		['-'],
		['쪽지 보내기','submsg','color:#999']
	];


	this.subItems['sub1']=[
		['인터뷰','profileInterview'],
		['뮤직박스♬','profileBGM'],
		['친구시선','profileFriendEyes'],
		['포토엘범','profileAlbum'],
		['스크랩','profileScrap']
	];

	this.subItems['sub2']=[['로딩중']];

	this.subItems['sub5']=[['로딩중']];

	this.subItems['sub4']=[
		['교환일기','inviteDiary','color:#1B8A99'],
		['아지트','inviteAgit','color:#754Fc2'],
		['RING!','inviteRing','color:#a70']
	];
}


var popupMenu=new popMenuEngine;
popupMenu.init();
popupMenu.generate();


/* ********************************
 * 닉네임 클릭 팝업메뉴 실행 모듈 *
 ********************************** */

function run(post) {

	if(target_user==0) return false;

	switch(post) {
		case "friendAdd":		friendAdd(target_user);
		break;
		case "profileBGM":		bgmbox(target_user);
		break;
		case "sub1":			openbox(target_user,'home');
		break;
		case "profileInterview":	openbox(target_user,'interview');
		break
		case "profileFriendEyes":	openbox(target_user,'friend_eyes');
		break;
		case "profileAlbum":		openbox(target_user,'album');
		break;
		case "profileScrap":		openbox(target_user,'article_scrap');
		break;
		case "sub5":			go('http://www.idoo.net/?menu=photo&sub=my&user_no='+target_user);
		break;
		case "sub3":			
			switch(popFriendType){
				case 'ban': 	gohidden('http://www.idoo.net/?menu=friend&sub=act&mode=act&type=friend_delete&atc[friend_no]='+target_user+'&atc[fromban]=Y');
				break;
				case false: 	friendAdd(target_user); break;
				default:	friendModify(target_user); break;
			}
		break;
		case "submsg":			msg(target_user);
		break;
		case "inviteDiary":		gohidden('/_gohidden?menu=blog&sub=confirm_box_user_invite&mode=act&friend_no='+target_user);
		break;
		case "inviteAgit":		gohidden('/_gohidden?menu=agit&sub=confirm_invite&mode=act&friend_no='+target_user);
		break;
		case "inviteRing":		gohidden('/_gohidden?menu=ring&sub=confirm_invitering&mode=act&friend_no='+target_user);
		break;
		default:
			if (post.indexOf("run:")!=-1) {
				if(towhere=="opener") {
					var t=typeof("opener")!="object"?top.opener:opener;
					t.location.href=post.replace("run:","");
					t.focus();
				}
				else towhere.location.href=post.replace("run:","");
			}
		break;
	}	
	document.getElementById(menu_name).style.display='none';

}


function friendAdd(target_user){
	gohidden('/_confirm/friend/add/'+target_user);
}
function friendModify(target_user){
	gohidden('/_confirm/friend/modify/'+target_user);
}



function bgmbox(user_no){
	if(bgmbox.arguments[1]) var sub=bgmbox.arguments[1]; else var sub="main";
	remote_bgmbox=window.open("http://www.idoo.net/?menu=bgmbox&sub="+sub+"&user_no="+user_no+"&frame=open","bgmwindow","width=280,height=370,toolbar=no, statusbar=no, menubar=no, resizable=no, scrollbars=no");
	if(remote_bgmbox==null) alert("WindowsXP 서비스팩2 등에 의해 팝업창이 차단되어 있습니다.\n\n오른쪽 아래 (!) 그림을 눌러 팝업 허용으로 설정해주세요");
	else if (remote_bgmbox.opener==null) remote_bgmbox.opener=window;
}

function openbox(user_no,tab){

	if(tab==undefined) tab='';
	remote_profile=window.open("http://www.idoo.net/?menu=mybox&sub="+tab+"&user_no="+user_no+"&frame=open&frommenu="+PageMenu,"profilebox","width=800,height=600,toolbar=no,statusbar=no, menubar=no, resizable=no,scrollbars=no");
	if(remote_profile==null) alert("WindowsXP 서비스팩2 등에 의해 팝업창이 차단되어 있습니다.\n\n오른쪽 아래 (!) 그림을 눌러 팝업 허용으로 설정해주세요");
	else if (remote_profile.opener==null) remote_profile.opener=window;

}

function openring(no,tab,tno){
	if(tab==undefined) tab='';
	remote=window.open("http://www.idoo.net/?menu=ring&sub="+tab+"&tableno="+no+"&tno="+tno+"&frame=open","ringbox","width=750,height=530,toolbar=no, statusbar=no, menubar=no, resizable=no, scrollbars=no");
	if(remote==null) alert("WindowsXP 서비스팩2 등에 의해 팝업창이 차단되어 있습니다.\n\n오른쪽 아래 (!) 그림을 눌러 팝업 허용으로 설정해주세요");
	else if (remote.opener==null) remote.opener=window;
}

function modify(user_no){
	openbox(user_no,"modify");
}

function msg(user_no,type){
	if(type==null) type=FamilySite?"msg":"intv";
	remote=window.open("http://www.idoo.net/?menu=msgbox&friend_no="+user_no+"&atc[type]="+type,"msg","width=540, height=600, toolbar=no, statusbar=no, menubar=no, resizable=no, scrollbars=no");
	if (remote.opener==null) remote.opener=window;
	remote.opener.name="opener";
}

function OpenSub(target, y) {
	eval(target+".style.display=\"\"");
	ta=document.getElementById(target);
	menu=document.getElementById(menu_name);
	ta.style.pixelLeft=menu.style.pixelLeft+(menu.style.pixelLeft+menu.scrollWidth+ta.scrollWidth>window.document.body.offsetWidth?-1*(ta.scrollWidth):77);
	ta.style.pixelTop=menu.style.pixelTop+y;
}


function OpenColorPicker(hex){
	gohidden("/_confirm/colorpickerfeel/"+hex.replace("#",""));
/*
	if(hex==undefined) hex='';
	try
	{
		hex = window.showModalDialog("/component/ColorPicker.idoo?hex="+hex, hex, "dialogWidth:488px;dialogHeight:323px;help:0;center:yes;resizable:0;status:0;");
		if(hex != null) return "#"+hex;
	}
	catch(e)
	{
		alert("해당 브라우저는 지원하지 않습니다. 죄송합니다.");

	}
*/
}

function returnColor(hex,rgb,hsb,Lab,cmyk){
	document.getElementById('FeelColor').style.backgroundColor="#"+hex;
try{    if(typeof(document.getElementById('FeelColorX'))=="object") document.getElementById('FeelColorX').style.display='none'; }catch(x){}

	for(i=0;i<=2;i++) hsb[i]=Math.round(hsb[i] * 100);
	for(i=0;i<=2;i++) Lab[i]=Math.round(Lab[i]);
	for(i=0;i<=3;i++) cmyk[i]=Math.round(cmyk[i] * 100);

	gohidden("/_do/modify/feelcolor?user_no="+pMyno+"&atc[hex]="+hex+"&atc[rgb]="+rgb[0]+"."+rgb[1]+"."+rgb[2]+"&atc[hsb]="+hsb[0]+"."+hsb[1]+"."+hsb[2]+"&atc[Lab]="+Lab[0]+"."+Lab[1]+"."+Lab[2]+"&atc[cmyk]="+cmyk[0]+"."+cmyk[1]+"."+cmyk[2]+"."+cmyk[3]);

}

var ton=function(n,p,pi){
	if(pi!=undefined && ton.pin!=undefined && pi==ton.pin) return;
	ton.pin=parseInt(Math.random() * 10000000000);

for(var i=1;i<=ton.max;i++){
	try{
	document.getElementById("tab"+i).className="common"+(i>=ton.wlimit?' w':'')+(n==i?" on":(ton.hidden[i]==1?' hidden':''));
	document.getElementById("tlayer"+i).style.display=(n==i?"block":"none");
	}catch(x){}
}
	if(p==undefined) {
		ton.idx=n;
		hiddenframe.location.href='about:blank';
		setTimeout("tonAddHistory('"+n+"','"+ton.pin+"');",500);
	}
}
var tonAddHistory=function(n,pi){
	pWindow=document.getElementById("hiddenframe").contentWindow;
	pWindow.document.open();
	htmlString='<html><script type="text/javascript">\n try{parent.ton('+n+',1,'+pi+');}catch(x){};\n try{parent.checkBack('+n+');}catch(x){};\n</script></html>';
	pWindow.document.write(htmlString);
}

ton.hidden=new Array;
ton.wlimit=999;


var showLoading=function(doeval){
	var s="";
	try{
	if(document.getElementById("LoadingAjaxLayer").src.indexOf(".gif")>5) {
		document.getElementById("LoadingAjaxLayer").style.display='block';
		return;
		}
	}catch(x){};
	var l=parseInt((document.body.clientWidth/2)-8);
	var t=parseInt((document.body.clientHeight/2)-8+window.document.body.scrollTop);
	var n=document.getElementById("LoadingAjaxLayer");
	n.style.position="absolute";
	n.style.top=0;
	n.style.left=0;
	n.innerHTML='<IMG SRC="http://i2.idoo.net/common/8-1.gif" STYLE="position:absolute;z-index:10000;top:'+t+';left:'+l+';left:expression((document.body.clientWidth/2)-110);top:expression((document.body.clientHeight/2)-9+window.document.body.scrollTop);" WIDTH=220 HEIGHT=19 ID="LoadingAjaxImage">';
	document.getElementById("LoadingAjaxImage").style.display='block';
	if(doeval!=undefined) eval(doeval);

}

var offLoading=function(){
	try{
		document.getElementById("LoadingAjaxImage").style.display='none';
	}catch(e){}
}

function forEach(obj, iter) {

  var prototype = obj.constructor.prototype;

  for (var k in obj) {
    if (k in prototype) continue;
    if (obj instanceof Array && isNaN(k)) continue;
    iter(obj[k], k, obj);
  }
}
if (!Array.prototype.Foreach) {
  Array.prototype.Foreach = function(iter) { forEach(this, iter); }
}

function notag(string){
	if(notIE) return string;

	string=string.replace("<","<");
	string=string.replace(">",">");
	var x=document.createElement("DIV");
	x.innerHTML=string;
	string=x.innerText;
	return string;
}
var DateFormatter = { 
	month : ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'], 
	parse : function(timestamp, format) { 
		var timestamp = parseInt(timestamp); 
		if(timestamp < 10000000000) timestamp *= 1000; 

		_date = new Date(); 
		_date.setTime(timestamp); 

		var year = _date.getFullYear(); 
		var month=_date.getMonth()
		var monthT=this.month[month];
		var day = _date.getDate(); 
		var hour = _date.getHours(); 
		var min = _date.getMinutes(); 
		var sec = _date.getSeconds(); 
		var ampm=hour>12?"am":"pm";


		if(format){ 
			format = format.replace(/y/i, year); 
			format = format.replace(/m/i, month+1); 
			format = format.replace(/M/i, monthT);
			format = format.replace(/d/i, day); 
			format = format.replace(/h/i, hour); 
			format = format.replace(/i/i, min); 
			format = format.replace(/s/i, sec);
			format = format.replace(/g/i,parseInt(hour));
			format = format.replace(/a/i,ampm)

			return format; 
		} 
		else{ 
			return day + " " + month + " " + year; 
		} 
	} 
}; 


String.prototype.hasFinalConsonant = function(str) {
	str = this != window ? this : str;
	var strTemp = str.substr(str.length-1);

	if(strTemp.charCodeAt(0)<255){
		var n="aeiousxdfhjwyz";
		if(n.indexOf(strTemp)>=0) return false;
	}

	return ((strTemp.charCodeAt(0)-16)%28!=0);
}

function josa(str,tail,x) {
	return (x==undefined?str:'')+((str.hasFinalConsonant()) ? tail.substring(0,1) : tail.substring(1,2));
}



/* ///////////////////////////////////////////
// 문서 로드 시 실행 함수 설정하는 함수
/////////////////////////////////////////////*/



function addLoadEvent(func) {
	var oldonload = window.onload;
	try{
		if (typeof window.onload != "function") {
			 window.onload=func;
		} else {
			 window.onload = function() {
				 oldonload();
				 func();
			}
		}
	}catch(x){}
}


if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement){
        HTMLElement.prototype.insertAdjacentElement = function
(where,parsedNode)
        {
                switch (where){
                case 'beforeBegin':
                        this.parentNode.insertBefore(parsedNode,this)
                        break;
                case 'afterBegin':
                        this.insertBefore(parsedNode,this.firstChild);
                        break;
                case 'beforeEnd':
                        this.appendChild(parsedNode);
                        break;
                case 'afterEnd':
                        if (this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
                        else this.parentNode.appendChild(parsedNode);
                        break;
                }
        }

        HTMLElement.prototype.insertAdjacentHTML = function
(where,htmlStr)
        {
                var r = this.ownerDocument.createRange();
                r.setStartBefore(this);
                var parsedHTML = r.createContextualFragment(htmlStr);
                this.insertAdjacentElement(where,parsedHTML)
        }


        HTMLElement.prototype.insertAdjacentText = function
(where,txtStr)
        {
                var parsedText = document.createTextNode(txtStr)
                this.insertAdjacentElement(where,parsedText)
        }
}


/* ////////////////////// */


var LayoutBox=function(width,widthcode,type,begin){
	var start=begin==undefined?'b':'t';

layoutwidth=new Array;
layoutwidth[1]=[14,13];
layoutwidth[2]=[9,11];

	var imgurl="http://i2.idoo.net/";
rslt='';
rslt+='<DIV>';
rslt+='<IMG SRC="'+imgurl+'ui/layout/box'+type+'_'+start+'1.gif" WIDTH="'+layoutwidth[type][0]+'" HEIGHT="'+layoutwidth[type][1]+'">';
rslt+='<IMG SRC="'+imgurl+'ui/layout/box'+type+'_'+start+'0.gif" WIDTH="'+(width-layoutwidth[type][0]*2)+'" HEIGHT="'+layoutwidth[type][1]+'">';
rslt+='<IMG SRC="'+imgurl+'ui/layout/box'+type+'_'+start+'2.gif" WIDTH="'+layoutwidth[type][0]+'" HEIGHT="'+layoutwidth[type][1]+'">';
rslt+='</DIV>';

return rslt;
}


function splitBrowsers(n)
{
	if(notIE && n==0) return false;
	if (document.styleSheets[n].cssRules)
		return document.styleSheets[n].cssRules;
	else if(document.styleSheets[n].rules)
		return document.styleSheets[n].rules;
	else return false;
}

var getCSSStyle=function(v,w){
        for(var zi=0;zi<document.styleSheets.length;zi++){
                var zn=splitBrowsers(zi);
		if(!zn) continue;
                for(var zj=0;zj<zn.length;zj++){
                        if(zn[zj].selectorText==v) {
                                return eval("zn[zj].style."+w+";");
                        }
                }

        }
}


var initLayout=function(){

	var n=document.getElementById("LAYOUT_BODY");
	var p=document.getElementsByTagName("UL");
	var ddw=getCSSStyle("ul dl#LAYOUT_ITEM dd","margin");
	for(i=0;i<p.length;i++){
		if(p[i].className!="LAYOUT_SIZE1" && p[i].className!="LAYOUT_SIZE2") continue;
		q=p[i].getElementsByTagName("LI");
		w=getCSSStyle("."+p[i].className,"width").replace("px","");
		ht=LayoutBox(w,1,1,true);
		hf=LayoutBox(w,1,1);
		for(j=0;j<q.length;j++){
			if(q[j].id!="LAYOUT_ITEM" || q[j].className=='plain') continue;
			q[j].style.width=w;
			q[j].style.overflow='hidden';
			q[j].innerHTML='<DIV CLASS="LayoutBox1"><DIV CLASS="LayoutBox2"><DIV STYLE="'+(notIE?'':'width:100%;overflow:hidden;')+'"><DL STYLE="width:'+w+'px;padding:0;margin:0">'+q[j].innerHTML+'</DL></DIV></DIV></DIV>';

			q[j].insertAdjacentHTML("afterBegin", ht);
			q[j].insertAdjacentHTML("beforeEnd", hf);
			r=q[j].getElementsByTagName("DD");
			for(k=0;k<r.length;k++) {
				r[k].style.width=w-28;
				if(ddw!=undefined) r[k].style.margin=ddw;
			}
			r=q[j].getElementsByTagName("DL");
			for(k=0;k<r.length;k++) if(r[k].className=="sticky") {
				s2=r[k].getElementsByTagName("IMG");
				s2=s2[0].src;
				if(s2.indexOf("t.")>0) 
					r[k].insertAdjacentHTML("beforeBegin", '<DIV STYLE="background:url(\''+s2+'\') bottom left repeat-x; height:1px;overflow:hidden;margin:12px 0 7px 0"> </DIV>');

			}
		}

	}
}

var gTransDo1=function(tid,to) {
        if(to==undefined) to="en";

        text=gTransQueue.data[tid];
        document.getElementById(tid).style.visibility='hidden';

        google.language.detect(text, function(result) {
                if (!result.error && result.language) {
                        gTransDo2(tid,to,result.language);
                }
        });
}
var gTransDo2=function(tid,to,from) {
        text=gTransQueue.data[tid];
        if(notIE)
		document.getElementById(tid).style.opacity=0.3;
	else document.getElementById(tid).style.visibility='hidden';
	
	gTransQueue.rslt[tid]="";
	if(text.length>500) {
		var texts=new Array;
		texts=text.split(".").join(".|||");
		texts=texts.split("\n").join("\n|||");
		texts=texts.split("|||");

		gTransQueue.splits[tid]=texts.length;
			for(var i=0;i<texts.length;i++) {
			google.language.translate(texts[i], from, to, function(result) {
				if (result.translation) {
					gTransDo3(tid,result.translation);

			       } else if(result.error) document.getElementById(tid).innerHTML=result.error.message;
			});
		}
	} else {
		google.language.translate(text, from, to, function(result) {
			if (result.translation) {
				gTransDo3(tid,result.translation);
			
		       } else if(result.error) document.getElementById(tid).innerHTML=result.error.message;
		});
	}
}
var gTransDo3=function(tid,rslt){
	if(gTransQueue.splits[tid]==undefined) {
		gTransQueue.rslt[tid]=rslt;
		gTransDone(tid);
	} else {
		
		gTransQueue.rslt[tid]+=rslt;
		gTransQueue.splits[tid]--;
		if(gTransQueue.splits[tid]==0) gTransDone(tid);
	}
}
var gTransDone=function(tid){
	document.getElementById(tid).innerHTML=gTransQueue.rslt[tid]+"<span id=\""+tid+"_original\" style=\"display:none\">"+gTransQueue.data[tid]+"</span>";
	document.getElementById(tid).style.visibility='visible';
	document.getElementById(tid).style.opacity=1;
}
function gTransQueue(tid,to,from) {
        if(to==undefined || to==-1) to="en";
        if(from==undefined || from==-1) from="ko";
	if(to==from) return;
try{
        tt=document.getElementById(tid);
        text=tt.innerHTML;
        gTransQueue.data[tid]=text;
        gTransQueue.idqueue[gTransQueue.cnt]=[tid,to,from];

        gTransQueue.cnt++;
        gTransCheckDo();
	if(gTransQueue.license==undefined) {
		gTransQueue.license=true;
		addLoadEvent(function(){
		try{
		document.getElementById("layout-bygtrans").innerHTML="Language Translation, Powered by <a href=\"http://google.com\">Google</a>.";
		}catch(x){}
		});
	}
}catch(x){};

}



function gTransCheckDo(){
        if(gTransCheckDo.timeout!=undefined) window.clearTimeout(gTransCheckDo.timeout);
        if(typeof google=="undefined" || typeof google.language=="undefined" || typeof google.language.translate=="undefined" ) { gTransCheckDo.timeout=window.setTimeout("gTransCheckDo();",200);return false;}

        gTransQueue.idqueue.forEach(function(val,key,ojbect) {
                 gTransDo2(val[0],val[1],val[2]);
        });
        gTransQueue.cnt=0;
        gTransQueue.idqueye=new Array;

}
gTransQueue.data=new Array;
gTransQueue.idqueue=new Array;
gTransQueue.cnt=0;
gTransQueue.rslt=new Array;
gTransQueue.splits=new Array;

function forEach(obj, iter) {
 
  var prototype = obj.constructor.prototype;
 
  for (var k in obj) {
    if (k in prototype) continue;
    if (obj instanceof Array && isNaN(k)) continue;
    iter(obj[k], k, obj);
  }
}
if (!Array.prototype.forEach) {
  Array.prototype.forEach = function(iter) { forEach(this, iter); }
} else var notIE=1;


function getAbsolutePos(obj) {
 var position = new Object;
 position.x = 0;
 position.y = 0;

 if( obj ) {
  position.x = obj.offsetLeft;
  position.y = obj.offsetTop;

  if( obj.offsetParent ) {
   var parentpos = getAbsolutePos(obj.offsetParent);
   position.x += parentpos.x;
   position.y += parentpos.y;
  }

 }

 return position;
}
