

var select_obj;
var userid;
var goURL;
var sendVars;
var offsetxpoint =0;
var goTarget;






document.onmousedown = ndown;



function ndown(evt){

	event_target = evt?evt.target:event.srcElement;
	
	var this_event = event_target;

	event_target = event_target.toString();
	
	event_check = event_target.indexOf("javascript:memView(");
       	 
	if(!event_check){
		changeLayer('block',evt);
			return;
	 } else{
			changeLayer('none',evt);
			return ;
		}

}

function changeLayer(status,e) { 
	
		var obj = document.getElementById('MiniMenu');
		var _tmpx,_tmpy, marginx, marginy;








		posx=0;posy=0;
		var ev=(!e)?window.event:e;//IE:Moz
		if (ev.pageX){//Moz
		posx=ev.pageX;
		posy=ev.pageY;
		}
		else if(ev.clientX){//IE

		if(document.documentElement){//IE 6+ strict mode
		posx = ev.clientX + document.documentElement.scrollLeft;
		posy = ev.clientY + document.documentElement.scrollTop;
		}
		else if(document.body){//Other IE
		posx = ev.clientX + document.body.scrollLeft;
		posy = ev.clientY + document.body.scrollTop;
		}
		}
		else{return false}//old browsers

		
		_tmpx = posx;
		_tmpy = posy;


 
		_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.left= (_tmpx-10 + offsetxpoint)+'px';
		obj.style.top= (_tmpy - 13)+'px';

		if(status=='block') {
			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=='block'){
		MiniMenu.style.display = 'none';
	}else{
		MiniMenu.style.display = 'block';
	}
}

/*È¸¿ø¸µÅ© ¸Þ´º*/
function LayerHtml(src) {
var html;
html ="<div id=\"MiniMenu\" style=\"display: none; z-index:1000; left:10px; width: 127px; position: absolute; height: 32px;\">\n";


html +="<iframe name=\"memview_frame\" id=\"memview_frame\" width=\"93\" height=\"79\" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"/System/html/iframe/memview.html\"></iframe>";

/*
html +="<table border=\"0\" cellspacing=\"5\" cellpadding=\"0\" >\n";
html +="  <tr>\n";
html +="    <td colspan=\"3\" style=\"height:3px;\"></td>\n";
html +="	</tr>\n";
html +="  <tr>\n";
html +="    <td style=\"width:5px;\" rowspan=\"2\">&nbsp;</td>\n";
html +="    <td style=\"height:2px;\"></td>\n";
html +="	</tr>\n";
html +="  <tr>\n";
html +="    <td>\n";
html +="    <table style=\"cursor: pointer; height:100%; width:100%; border:1px solid #666666; background-color:#ffffff;\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\">\n";
html +="			<tr>\n";
html +="				<td style=\"background-color:#ffffff;vertical-align:bottom;\">\n";






html +="				<table style=\"width:100%; height:100%;\" cellspacing=\"0\" cellpadding=\"3\" border=\"0\">\n";
html +="					<tr>\n";
html +="						<td style=\"text-align:left;font-size: 11px; height:25px; padding-left:5px; color:#000000;\" onmouseover=\"this.style.backgroundcolor='#CCFFCC'\" onclick=\"goAzone();\" onmouseout=\"this.style.backgroundcolor='#ffffff'\"><img src=\""+src+"/icon_goAzone.gif\" height=\"17\" width=\"17\" alt=\"¿£Á©Á¸ ¹æ¹®\" />¿£Á©Á¸ ¹æ¹®&nbsp;&nbsp;</td>\n";
html +="					</tr>\n";
html +="					<tr>\n";
html +="						<td style=\"text-align:left;font-size: 11px; height:25px; padding-left:5px; color:#000000; \" onmouseover=\"this.style.backgroundcolor='#CCFFCC'\" onclick=\"buddyWin();\"  onmouseout=\"this.style.backgroundcolor='#ffffff'\"><img src=\""+src+"/icon_buddy.gif\" height=\"17\" width=\"17\" alt=\"Ä£±¸½ÅÃ»\" />Ä£±¸½ÅÃ»&nbsp;&nbsp;</td>\n";
html +="					</tr>\n";
html +="					<tr>\n";
html +="						<td style=\"text-align:left;font-size: 11px; height:25px; padding-left:5px; color:#000000; \" onmouseover=\"this.style.backgroundcolor='#CCFFCC'\" onclick=\"memoWin();\"  onmouseout=\"this.style.backgroundcolor='#ffffff'\"><img src=\""+src+"/icon_memo.gif\" height=\"17\"  width=\"17\" alt=\"ÂÊÁöº¸³»±â\" />ÂÊÁöº¸³»±â&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 style=\"width:5px;\"  rowspan=\"2\">&nbsp;</td>\n";
html +="	</tr>\n";
html +="	<tr>\n";
html +="		<td colspan=\"3\" style=\"height:10px;\"></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;
    }

