AdminForumtopicsGridJsParams = "width=350,height=200";

function AdminForumtopicsGridRowInit( domid , rownum , uid , aJSLangDefs ) {
	tr = $("#"+domid);
	tr.data( "uid" , uid );

	cntxid = "cntx_" + rownum;
	div = $("<div></div>");
	div.attr( "id" , cntxid );
	div.attr( "class" , "ContextMenu" );
	ul = $("<ul></ul>" );

	li = $("<li></li>" );
	li.attr( "id" , "new" );
	li.html( "<img src=\"/fanthom.php/www/icons/16x16/page_add.png\" /> " + aJSLangDefs.forumtopics_New_topic );
	ul.append( li );
	
	li = $("<li></li>" );
	li.attr( "id" , "modify" );
	li.html( "<img src=\"/fanthom.php/www/icons/16x16/page_edit.png\" /> " + aJSLangDefs.forumtopics_Modify_topic );
	ul.append( li );
	
	li = $("<li></li>" );
	li.attr( "id" , "delete" );
	li.html( "<img src=\"/fanthom.php/www/icons/16x16/page_remove.png\" /> " + aJSLangDefs.forumtopics_Delete_topic );
	ul.append( li );

	div.append( ul );
	$("body").append( div );

	tr.contextMenu( cntxid ,
		{
			menuStyle: { width: '300px' },
			bindings: {
				'new':function(t) {
					AdminForumtopicsGridNew( $("#"+t.id).data("uid") );
				},
				'modify':function(t) {
					AdminForumtopicsGridModify( $("#"+t.id).data("uid") );
				},
				'delete':function(t) {
					AdminForumtopicsGridDelete( $("#"+t.id).data("uid") );
				}
			}
		}
	 );
}

function AdminForumtopicsGridNew( pid ) {
	window.open( 'edit.php?mode=new&pid='+pid , '_blank' , AdminForumtopicsGridJsParams );
}

function AdminForumtopicsGridModify( uid ) {
	window.open( 'edit.php?mode=modify&uid='+uid , '_blank' , AdminForumtopicsGridJsParams );
}

function AdminForumtopicsGridDelete( uid ) {
	window.open( 'edit.php?mode=delete&uid='+uid , '_blank' , AdminForumtopicsGridJsParams );
}

function AdminForumtopicsGridAction( n , action ) {
	if ($("#"+FNTHSuperGrid_ToolbarId( n , action )).hasClass( "dsb" )) return;
	switch (action) {
	case "new":
		window.open( 'edit.php?mode=new' , '_blank' , AdminForumtopicsGridJsParams );break;
	case "modify":
		AdminForumtopicsGridModify( $("#"+n).data( "selecteds" )[0] , AdminForumtopicsGridJsParams );
		break;
	case "delete":
		if (!window.confirm( aJSLangDefs.forumtopics_confirm_Delete_topic )) return;
		BGAction( n , action );
		break;
	case "filter":
		$("#frm_AdminForumtopicsGrid").append( "<input type=\"hidden\" name=\"task\" value=\"filter\" />" );
		document.frm_AdminForumtopicsGrid.submit();
		break;
	}
}

function AdminForumtopicsGridSelectionChanged( tblid , chk , id ) {
	BGSelectionChanged( tblid , chk , id );
	BGSelectionChangedDefaultAMD( tblid , chk, id );
}
