var select_obj;
var userid;
var moimNo;
var isOpenPage =0 ; 
var offsetxpoint =0 ;
document.onmouseup = ndown;
function ndown(){
         event_target = event.srcElement;
         event_target = event_target.toString();
       	 event_check = event_target.indexOf("javascript:viewMenu(");
      	 event_check_m = event_target.indexOf("javascript:viewMenuM(");	
       	 
         if(!event_check ){
			changeLayer('', 0 );
			return;
		 } else if ( !event_check_m ){
			changeLayer('', 1);
			return;
		} else{
			changeLayer('none', 0 );
			changeLayer('none', 1 );
			return ;
		}
}
function changeLayer(status, kind ) { 

		var obj;
		if ( kind == 0 ) 
			obj =document.all['MiniMenu'];
		else
			obj = document.all['MiniMenuM'];	

		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 ;

		if( offsetxpoint < -60 )
			obj.style.posLeft=_tmpx-3 + offsetxpoint;	
		else
			obj.style.posLeft=_tmpx-13 + offsetxpoint;	

		obj.style.posTop=_tmpy-12;

		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 viewMenu(uid, isOpenp){
			userid = uid;
			isOpenPage = isOpenp ; 
			moimNo = 0 ;
			//changeLayer('');
	}
	function viewMenuM(uid, isOpenp , mNo){
			userid = uid;
			isOpenPage = isOpenp ; 
			moimNo = mNo ; 
			//changeLayer('');
	}	
	function userinfo(){
			userview(userid);
	}
	function  goPageInfo(aa){
		
			var goPageUrl
			if ( aa == 'p' ) 
				goPageUrl = "http://qbic.dreamx.com/mypds/NXMyFile.asp?xUserId=" + userid ; 	
			else if ( aa == 'f' ) 
				goPageUrl = "http://qbic.dreamx.com/main/ANRegFriend.asp?friendxUserId=" + userid ; 	
			else if ( aa == 'm' ) 
				goPageUrl = "http://note.dreamx.com/WriteNote.asp?ServiceCode=2&btype=0&rId=" + userid  ; 							
			else
				goPageUrl = "http://qbic.dreamx.com/mypds/NXListVisit.asp?xUserId=" + userid ; 

			if ( aa == 'm' ) {
				window.open(goPageUrl,"popMemo","scrollbars=0,toolbar=no,directories=no,menubar=no,resizable=0,status=yes,width=780,height=550");
			}	
			else if ( isOpenPage == 1 && aa != 'f' ) 	{
				window.open(goPageUrl,'_blank');	
			}
			else if ( isOpenPage == 2 && aa != 'f' ) 	{
				window.open(goPageUrl,'_blank');	
			}			
			else if ( aa == 'f' ) {
				window.open(goPageUrl,'_blank', "scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=yes,width=780,height=550"   );
			}				
			else {
				window.open("http://qbic.dreamx.com/main/NNPopCommon.asp?title=°³ÀÎÆÄÀÏÇÔ&msg=ºñ°ø°³ ÆÄÀÏÇÔÀÔ´Ï´Ù" ,"_blank","scrollbars=0,toolbar=no,directories=no,menubar=no,resizable=0,status=yes,width=300,height=300");
			}	
	}
	
	function  goPageInfoM(aa){
		
			var goPageUrl
			if ( aa == 'p' ) 
				goPageUrl = "http://qbic.dreamx.com/main/NNComm.asp?moimNo=" + moimNo ; 	
			else if ( aa == 'f' ) 
				goPageUrl = "http://qbic.dreamx.com/mypds/ANPopRegFriend.asp?friendxUserId=" + userid ; 	
			else if ( aa == 'm' ) 
				goPageUrl = "http://note.dreamx.com/WriteNote.asp?ServiceCode=2&btype=0&rId=" + userid  ; 							
			else
				goPageUrl = "http://qbic.dreamx.com/main/NNComm.asp?kind=v&moimNo=" + moimNo ; 

			if ( aa == 'm' ) {
				window.open(goPageUrl,"popMemo","scrollbars=0,toolbar=no,directories=no,menubar=no,resizable=0,status=yes,width=780,height=550");							
			}	
			else if ( isOpenPage == 1 && aa != 'f' ) 	{
				window.open(goPageUrl,'_blank');	
			}
			else if ( isOpenPage == 2 && aa != 'f' ) 	{
				window.open(goPageUrl,'_blank');	
			}			
			else if ( aa == 'f' ) {
				window.open(goPageUrl,'_blank', "scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=yes,width=780,height=550"   );
			}				
			else {
				window.open("http://qbic.dreamx.com/main/NNPopCommon.asp?title=°³ÀÎÆÄÀÏÇÔ&msg=ºñ°ø°³ ÆÄÀÏÇÔÀÔ´Ï´Ù" ,"_blank","scrollbars=0,toolbar=no,directories=no,menubar=no,resizable=0,status=yes,width=300,height=300");
			}	
	}	
