Here is another more complicated version.

Bock A with mass m is put on top of a surface. There is another block (B) with mass m2 on top of block A.
Friction coefficient between block A and surface is $\mu$, between block A and block B is $\mu_2$.

The normal force between block A and surface is $(m+m_2) g$, between block A and block B is $m_2 g$
The external force is F:

1. $F\le (m+m_2)g \mu$: both block would not move
 Friction force between block A and surface is $-F$, between block A and block B is 0.
2. $(m+m_2)g\mu   ($\frac{F-(m+m_2)g\mu}{m+m2}m_2< m_2 g\mu_2$ Force on block B less than maximum static friction force)
Friction force  between block A and surface is $(m+m_2)g \mu$ , acceleration of both blocks is $\frac{F-(m+m_2) g\mu}{m+m2}=\frac{F}{m+m_2}-g\mu$
friction force between block A and block B is $\frac{m_2}{m+m_2} (F-(m+m_2) g\mu)=\frac{m_2}{m+m_2}F-m_2 g \mu $
3. $F>(m+m_2) g (\mu+\mu_2)$: block A and block B move separately.
Friction force  between block A and surface is $(m+m_2)g \mu$ , acceleration of blocks A is $\frac{F-(m+m_2) g\mu-m_2 g\mu_2}{m}$
friction force between block A and block B is $m_2 g \mu_2$, acceleration of block B is $g \mu_2$

Enjoy the simulation!
CLick the following image to display the simulation.
[eye]

translate strings in simulation to different language format before download
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(1374.1kB):double click downloaded file to run it. (5 times by 4 users) , Download EJS source View EJS source
[/eye]