A crumbling French chateau dating back to the 13th century has been saved from being ruined by thousands of strangers who banded together to purchase it for restoration.