dialog.js for dialogbox control

JS core of dialogbox control