AdminArticlecategoriesGridJsParams = "width=800,height=600";

function AdminArticlecategoriesGridRowInit( 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.articlecategories_New_article_category );
	ul.append( li );
	
	li = $("<li></li>" );
	li.attr( "id" , "modify" );
	li.html( "<img src=\"/fanthom.php/www/icons/16x16/page_edit.png\" /> " + aJSLangDefs.articlecategories_Modify_article_category );
	ul.append( li );
	
	li = $("<li></li>" );
	li.attr( "id" , "delete" );
	li.html( "<img src=\"/fanthom.php/www/icons/16x16/page_remove.png\" /> " + aJSLangDefs.articlecategories_Delete_article_category );
	ul.append( li );

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

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

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

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

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

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

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