Twisted quandle homology theory and cocycle knot invariants