added check for behavior

fixed js bug
Merge branch 'master' of github.com:zuha/Media-Files-Zuha-Cakephp-Plugin