Manipulate[
magneticPendulum[magnetList_,pendulumLength_,height_,start_,{t_,tmin_,tmax_},opt___]:=Module[{frictionCoefficient,showMagnet,sol},
frictionCoefficient=Abs[FrictionCoefficient/.{opt}/.FrictionCoefficient->1];
showMagnet=ShowMagnet/.{opt}/.ShowMagnet->True;
sol[x0_,y0_,l_,h_,w_,mList_,friction_]:=Module[{n,f,ft,xx,yy},
n[x_,y_]:=(1/l){x,y,-(Sqrt[(l^2)-(x^2)-(y^2)])};
f[x_,y_]:={0,0,-w}+Apply[Plus,Map[#[[2]]{#[[1,1]]-x,#[[1,2]]-y,(Sqrt[(l^2)-(x^2)-(y^2)])-h}/(√((#[[1,1]]-x)^2+(#[[1,2]]-y)^2+((Sqrt[(l^2)-(x^2)-(y^2)])-h)^2))^3&,mList]];
ft[x_,y_]:=f[x,y]-(f[x,y].n[x,y])n[x,y];
Return[{xx,yy}/.First[NDSolve[{xx''[t]==ft[xx[t],yy[t]][[1]]-friction xx'[t],yy''[t]==ft[xx[t],yy[t]][[2]]-friction yy'[t],xx'[0]==0,yy'[0]==0,xx[0]==x0,yy[0]==y0},{xx,yy},{t,0,tmax}]]]
];
{xx,yy}=sol[start[[1]],start[[2]],pendulumLength,height,1,magnetList,frictionCoefficient];
plot=ParametricPlot[{xx[t],yy[t]},{t,tmin,tmax}];
If[showMagnet,Show[Graphics[{Gray,Circle[{0,0},pendulumLength]}],plot,Graphics[Join[{Thickness[0.008]},Flatten[Map[{Black,Circle[#[[1]],.02pendulumLength]}&,magnetList],1],{}]]],
Show[plot,PlotRange->{{-height,height},{-height,height}}]
]
];
magneticPendulum[Table[{{Cos[N[2π i/magnetNumber]],Sin[N[2π i/magnetNumber]]},10,Hue[i/N[magnetNumber]]},{i,magnetNumber}],pendulumLength,2.2,start,{t,0,tmax},FrictionCoefficient->coef],
{{start,{.5,.5}},Locator},
{{magnetNumber,1,"Number of magnets:"},
{1,2,3,4,5},ControlType->PopupMenu
},
{{pendulumLength,2.1},1,2.1},
{tmax,0.001,20},
{coef,.01,2}
]