document function S