// JavaScript Document

function f_Msg_Add(msg_parent,cat_id) {
	// Open a new message in a popup window
	if ((msg_parent>0) || (cat_id>0)) {
		f_Popup(script_name+'?scr=newmsg&msg_parent='+msg_parent+'&cat_id='+cat_id,520,350,'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
	}
}

function f_Msg_Close(win,msg_id) {
	// Close the popup window and refresh the display
	window.location.href = script_name+'?msg_id='+msg_id;
	win.close()
}

// Manage Bull Displaying
// ----------------------
var PrevBull = new Array();
function f_BullDisplay(BullType,BullId) {
	if (PrevBull[BullType]!=null) {
		document.getElementById(PrevBull[BullType]).style.visibility = 'hidden';
	}
	if (BullId>0) {
		var Bull = BullType + BullId;
		PrevBull[BullType] = Bull;
		document.getElementById(Bull).style.visibility = 'visible';
	}
}

// Display a page in a popup
// --------------------------
function f_Popup(page,width,height,options) {
  var top=(screen.height-height)/2
  var left=(screen.width-width)/2
  var popup = window.open(page,'','top='+top+',left='+left+',width='+width+',height='+height+','+options)
	return popup
}