document.onclick = MouseDown;
 
function getTop()
{
    return (screen.height - 500) / 2;
}
function getLeft()
{
	
    return (screen.width - 330) / 2;
}
function sendMemo(u)
{
    window.open(u,"memoWindow","fullscreen=no,titlebar=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=370,height=320,top=" + getTop() + ", left=" + getLeft());
}
function sendMail(id,nick,email)
{
    window.open("mailto:"+email);
}
function viewInfo(u)
{
    window.open(u,"userView","width=400,height=300,scrollbars=yes,resizable=yes,top=" + getTop() + ", left=" + getLeft());

}
function AddFriend(u)
{
    window.open(u,"AddFriend","width=350,height=200,scrollbars=no");
}

var listCount = 0;
var status_over = false;    
var parent_menu_name = "menu_parent";
var menuover_bgcolor = "#e4ff75";
var default_menuover_bgcolor = "#ffffff";

function MouseDown(e) 
{
    if (!e) e = window.event;
    var event_target = (document.all) ? e.srcElement : e.target;
    var event_check = event_target.className == "cviewMenu";        

    if ( !event_check ) {
    	hideAll();
    }
}

function hideAll()
{
	var arr =  $$(".cmenu_parent");
	if ( arr ) {
		for( var i=0; i<arr.length; i++ ) {
			arr[i].style.display = "none";
		}
	}
}

function viewMenu(e,ar_id) 
{

	hideAll();
    var objMenu = eval("document.getElementById('" + ar_id + "')");
    
	objMenu.style.display = "block";

    var sAgent = navigator.userAgent.toLowerCase() ;    

	if ( sAgent.indexOf("msie") != -1 || sAgent.indexOf("opera") != -1 )
	{
		objMenu.style.left = objMenu.offsetLeft;
   		objMenu.style.top = objMenu.offsetTop;
	} else if ( navigator.product == "Gecko" ) {
		objMenu.style.left = objMenu.offsetLeft + "px";
    	objMenu.style.top = objMenu.offsetTop + "px";
    	
	}

    status_over = true;
}
function menuOver(obj) 
{
    status_over = true;
    changeOnColor(obj);
}
function menuOut(obj) 
{
    status_over = false;
    changeOutColor(obj);
}

function changeOnColor(obj)
{
    obj.style.backgroundColor = menuover_bgcolor;
}
function changeOutColor(obj)
{
    obj.style.backgroundColor = default_menuover_bgcolor;
}
