Following days of deadly border clashes the leaders of Thailand and Cambodia have agreed to a ceasefire.