Effect of magnesium on structure and properties of LiNbO3 prepared from polymeric precursors