Variation of Fermi level in doped semiconductor with applied voltage
Fermi level is defined only in equilibrium. Not when bias is applied. In that case there are only quasi-fermi levels, usually marked  with \$E_{Fn}\$ and \$E_{Fp}\$. The current through the device will be proportional to the gradient of quasi-fermi levels. So if no current flows, then the quasi-fermi levels will be flat. The band diagram shown in figure represents a MOS capacitor and no stead-state current can flow through an ideal MOS capacitor and hence the quasi fermi level is marked flat. 

Intrinsic fermi level (\$E_i\$) is the fermi level of an intrinsic semiconductor at equilibrium. This level is fixed with respect to conduction and valance band. So if band edges change (with position), \$E_i\$ also changes.