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

function AdminNewsletterGroupsGridModify( uid ) {
	window.open( 'group_edit.php?mode=modify&uid='+uid , '_blank' , AdminNewsletterGroupsGridJsParams );
}

function AdminNewsletterGroupsGridAction( n , action , params ) {
	if ($("#"+FNTHSuperGrid_ToolbarId( n , action )).hasClass( "dsb" )) return;
	switch (action) {
	case "new":
		window.open( 'group_edit.php?mode=new' , '_blank' , AdminNewsletterGroupsGridJsParams );break;
	case "modify":
		AdminNewsletterGroupsGridModify( $("#"+n).data( "selecteds" )[0] , AdminNewsletterGroupsGridJsParams );
		break;
	case "delete":
		if (!window.confirm( aJSLangDefs.newsletters_Confirm_delete_newsletter_group )) return;
		BGAction( n , action );
		break;
	case "filter":
		$("#frm_AdminNewsletterGroupsGrid").append( "<input type=\"hidden\" name=\"task\" value=\"filter\" />" );
		document.frm_AdminNewsletterGroupsGrid.submit();
		break;
	case "newsletters":
		document.location.href='newsletters.php?newsletter_group_id='+params["newsletter_group_id"];
		break;
	case "users":
		document.location.href='users.php?newsletter_group_id='+params["newsletter_group_id"];
		break;
	case "allusers":
		document.location.href='users.php';
		break;
	}
}

function AdminNewsletterGroupsGridSelectionChanged( tblid , chk , id ) {
	BGSelectionChanged( tblid , chk , id );
	AdminNewsletterGroupsChanged( tblid  );
}

function AdminNewsletterGroupsChanged( tblid ) {
	BGSelectionChangedDefaultAMD( tblid );
	var t = $("#"+tblid );
	var a = t.data( "selecteds" );
	if (a.length>0) {
		$("#"+tblid+"_tbrbutton_ack").removeClass( "dsb" );
	} else {
		$("#"+tblid+"_tbrbutton_ack").addClass( "dsb" );
	}
}

function AdminNewsletterGroupsGridSelectAll( tblid , val ) {
	BGSelectAll( tblid , val );
	AdminNewsletterGroupsChanged( tblid );
}

