Bug 1031505 - Switching keyboard layout type when messaging enables capslocks

I observed JS error that layoutName actually doesn't exist in this scope, so I changed it onto layout.layoutName.