Initial port of code from DojoX trunk