
var strTotalMsg=" ";

var SelectedID;
var SelectStart=0;

function menuPop(ID, View)
{
    //
	
	if( SelectStart == 1) 
	{
		SelectedID.style.visibility='hidden';
	}
	SelectStart = 1;
	if( View == "View")
	{
		
		SelectedID = ID;
		
		
		ID.style.posLeft = window.event.x-5 + document.body.scrollLeft;
		ID.style.posTop = window.event.y-5 + document.body.scrollTop;
		ID.style.visibility='visible';
		
	}
	else if( View == "Hide")
	{
 	    ID.style.visibility='hidden';

	}
}

function checkMenu()
{
	ID = SelectedID;
	
	
	if( SelectStart == 1)
	{
		var top = parseInt(ID.style.top) - document.body.scrollTop;
		var left = parseInt(ID.style.left) - document.body.scrollLeft;
		var height = parseInt(ID.style.height);
		var width = parseInt(ID.style.width);

		if( !(    (  (top - 10 < window.event.y) && ((top+height) + 30> window.event.y))    &&  ( (left - 10 < window.event.x) && (  (left + width+10) > window.event.x)  )) )
		{
			menuPop(ID,"Hide");
			
		}
	}
}
function getMenuItem(Img, MenuContext, Width, EachHeight, MouseDown)
{
/////////////////////////////////////////////////////
	var MenuStyle='border-bottom:0px silver solid';
	var BGColor='#fafafa';
	var SELBGColor='#eeeeee';
	var FontSize=9;
	var FontType='';
	var Align='absmiddle';
///////////////////////////////////////////////////


	var TempMenu = "<tr style='cursor:hand'><td width='"+(Width)+"' style='"+MenuStyle+"' bgcolor='"+BGColor+"' onMouseover=this.style.backgroundColor='"+SELBGColor+"' onMouseOut=this.style.backgroundColor=''  align="+Align+" onMousedown="+MouseDown+"  style=font-family:"+FontType+";font-size:"+FontSize+"pt height="+EachHeight+" nowrap>" +Img+ MenuContext +"</td></tr>";

	return TempMenu;
}


function searchName(Name)

{
    
	document.SearchForm.findstr.value = Name;
    
	document.SearchForm.field.value = 'WriteName';
    
	document.SearchForm.submit();
    


}


function openHomepage(URL)

{
    
	var strTotal="http://";
    
	strTotal+=URL;
    
	window.open(strTotal,"usrhomepage");


}


function openMailForm(URL)

{
    
	var strTotal="";
    
	strTotal+=URL;
    
	window.open(strTotal,"mailsend","width=530,height=425,scrollbars=yes,resizable=yes");



}

function printMenu(IDName, Name, Mail, Homepage, EmailCgi)

{

/////////////////////////////////////////////////////
	var TableStyle = 'border:solid 1px silver;';
	var TotalMenuNum = 4;
	var Width = 100;
	var EachHeight = 18;
///////////////////////////////////////////////////

	var Menu_Head = "<div id='"+IDName+"' style='width:"+(Width)+"px; height:"+EachHeight * TotalMenuNum + "px; position:absolute; visibility: hidden;   z-index:1;'  >";
	var Menu_Table_Head = "<table style='" + TableStyle +"' cellpadding='3' cellspacing='0' width='"+Width+"' >";
	var Menu_Table_Tail = "</table></div>";
	
	var Menu_Table_Context;
	
	
		Menu_Table_Context = getMenuItem("<img src='./image/popmenu_img/usermenu_mail.gif'>","&nbsp;&nbsp;E-Mail ",Width,EachHeight,"openMailForm('"+EmailCgi+"')");
		
		Menu_Table_Context+= getMenuItem("<img src='./image/popmenu_img/usermenu_home.gif'>","&nbsp;&nbsp;Homepage",Width,EachHeight,"openHomepage('"+Homepage+"')");

		Menu_Table_Context+= getMenuItem("<img src='./image/popmenu_img/usermenu_search.gif'>","&nbsp;&nbsp;NameSearch ",Width,EachHeight,"searchName('"+Name+"')");
		

	
	var strTotal =Menu_Head+Menu_Table_Head+Menu_Table_Context+Menu_Table_Tail;
	strTotalMsg += strTotal;
	
}

function flush()

{
	
		document.writeln(strTotalMsg);


}
