Photoproduction of Heavy Quarks in Next-to-Leading Order QCD with Longitudinally Polarized Initial States