var select_obj;
var userid;
var goURL;
var sendVars;
var offsetxpoint =0;
var goTarget;
document.onmouseup = ndown;

function ndown(){
	event_target = event.srcElement;
	event_target = event_target.toString();
	event_check = event_target.indexOf("javascript:memView(");
       	 
	if(!event_check){
		changeLayer('');
			return;
	 } else{
			changeLayer('none');
			return ;
		}

}
function changeLayer(status) { 
	
		var obj = document.all['MiniMenu'];
		var _tmpx,_tmpy, marginx, marginy;

		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight); 
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy;

		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;

		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy +20 ;
		else
			_tmpy = event.clientY + document.body.scrollTop;

		obj.style.posLeft=_tmpx-10 + offsetxpoint;
		obj.style.posTop=_tmpy - 13;

		if(status=='') {
			if(select_obj) {
				select_obj.style.display='none';
				select_obj=null;
			}
			select_obj=obj;
		}else{
			select_obj=null;
		}
		obj.style.display=status; 
	}
	
	
function memView(uid,src,send,gotarget){
	userid = uid;
	goURL = src;
	sendVars = send;
	goTarget = gotarget;
}

function memView_img(uid,src,send,x,y,gotarget){
	userid = uid;
	goURL = src;
	sendVars = send;
	goTarget = gotarget;
	
	if(MiniMenu.style.display==''){
		MiniMenu.style.display = 'none';
	}else{
		MiniMenu.style.display = '';
	}
}

/*È¸¿ø¸µÅ© ¸Þ´º*/
function LayerHtml(src) {
var html;
html ="<DIV id=\"MiniMenu\" style=\"DISPLAY: none; Z-INDEX: 1; LEFT: 10px; WIDTH: 127px; POSITION: absolute; HEIGHT: 32px\">\n";
html +="<TABLE border=\"0\" cellSpacing=\"5\" cellPadding=\"0\" >\n";
html +="  <TR>\n";
html +="    <TD colSpan=\"3\" height=\"3\"></TD>\n";
html +="	</TR>\n";
html +="  <TR>\n";
html +="    <TD width=\"5\" rowSpan=\"2\">&nbsp;</TD>\n";
html +="    <TD height=\"2\"></TD>\n";
html +="	</TR>\n";
html +="  <TR>\n";
html +="    <TD>\n";
html +="    <TABLE style=\"CURSOR: hand\" height=\"100%\" cellSpacing=\"1\" cellPadding=\"0\" width=\"100%\" bgColor=\"#666666\" border=\"0\">\n";
html +="			<TR>\n";
html +="				<TD valign=\"top\" bgcolor=\"white\">\n";

html +="				<TABLE height=\"100%\" cellSpacing=\"0\" cellPadding=\"3\" width=\"100%\" border=\"0\">\n";
html +="					<TR onmouseover=\"this.style.backgroundColor='#CCFFCC'\" onclick=\"goAzone();\" onmouseout=\"this.style.backgroundColor=''\">\n";
html +="						<TD style=\"FONT-SIZE: 9pt; FONT-FAMILY: ±¼¸²\" noWrap height=\"25\"><IMG src=\""+src+"/icon_goAzone.gif\" height=\"17\" width=\"17\" hspace=\"1\"  align=\"absMiddle\" border=\"0\">¿£Á©Á¸ ¹æ¹®&nbsp;&nbsp;</TD>\n";
html +="					</TR>\n";
html +="					<TR onmouseover=\"this.style.backgroundColor='#CCFFCC'\" onclick=\"buddyWin();\"  onmouseout=\"this.style.backgroundColor=''\">\n";
html +="						<TD style=\"FONT-SIZE: 9pt; FONT-FAMILY: ±¼¸²\" noWrap height=\"25\"><IMG src=\""+src+"/icon_buddy.gif\" height=\"17\" width=\"17\" hspace=\"1\" align=\"absMiddle\" border=\"0\">Ä£±¸½ÅÃ»&nbsp;&nbsp;</TD>\n";
html +="					</TR>\n";
html +="					<TR onmouseover=\"this.style.backgroundColor='#CCFFCC'\" onclick=\"memoWin();\"  onmouseout=\"this.style.backgroundColor=''\">\n";
html +="						<TD style=\"FONT-SIZE: 9pt; FONT-FAMILY: ±¼¸²\" noWrap  height=\"25\"><IMG src=\""+src+"/icon_memo.gif\" height=\"17\"  width=\"17\" hspace=\"1\" align=\"absMiddle\" border=\"0\">ÂÊÁöº¸³»±â&nbsp;&nbsp;</TD>\n";
html +="					</TR>\n";
html +="					</TR>\n";
html +="				</TABLE>\n";

html +="				</TD>\n";
html +="			</TR>\n";
html +="		</TABLE>\n";
html +="		</TD>\n";
html +="		<TD width=\"5\"  rowSpan=\"2\">&nbsp;</TD>\n";
html +="	</TR>\n";
html +="	<TR>\n";
html +="		<TD colSpan=\"3\" height=\"10\"></TD>\n";
html +="	</TR>\n";
html +="</TABLE>\n";
html +="</DIV>\n";

document.write(html);
}


/* ¿£Á©Á¸¹æ¹® */
function goAzone(){
	ref = goURL;

	if(goTarget=='_blank'){
		window.open(ref+"/angelzone/?guest_visit=1&zonemid="+userid ,'_blank');
	}else if(goTarget=='opener'){
		opener.location.href= ref+"/angelzone/?guest_visit=1&zonemid="+userid;
	}else{
		top.location.href= ref+"/angelzone/?guest_visit=1&zonemid="+userid;
	}
}

/* Ä£±¸½ÅÃ» */
function buddyWin(){

	ref = goURL+"/System/html/popwin/buddy.proc.php?mid="+userid;
	var window_left = (screen.width-800)/2;
	var window_top = (screen.height-600)/2;
	var openwin = window.open(ref,"buddyWin",'width=460,height=300, resize=no, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}

/* Ä£±¸½ÅÃ» */
function buddyWin_Piece(userid,goURL){

	ref = goURL+"/System/html/popwin/buddy.proc.php?mid="+userid;
	var window_left = (screen.width-800)/2;
	var window_top = (screen.height-600)/2;
	var openwin = window.open(ref,"buddyWin",'width=460,height=300, resize=no, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}

/* ÂÊÁöº¸³»±â */
function memoWin() 
{
	ref = goURL+"/System/html/popwin/note.proc.php?process=send&mid="+userid;
	var window_left = (screen.width-800)/2;
	var window_top = (screen.height-600)/2;
	var openwin = window.open(ref,"noteWin",'width=460,height=300, resize=no, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}

	/* url ·Î ÇØ´çÆäÀÌÁö¿¡¼­ »Ñ·ÁÁÖ´Â°ªÀ»°¡Á®¿Â´Ù*/
    function getHttprequest(URL) {
        var xmlhttp = null;
        if(window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open('GET', URL,false);
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState==4 && xmlhttp.status == 200 && xmlhttp.statusText=='OK') {
                responseText = xmlhttp.responseText;
            }
        }
        xmlhttp.send('');
        return responseText = xmlhttp.responseText;
    }
