Microsoft, Viacom agree to $500M advertising pact