define([
	"dojo/_base/declare",
    "dijit/_WidgetBase",
    "dijit/_TemplatedMixin",
	"dojo/parser", 
	"dojo/ready", 
    "dojo/dom",
	"dojo/_base/xhr",
	"dojo/dom-construct",
	"dojo/_base/array",
	"dojo/text!./templates/LayouteditorMovable.html"	
], function(declare, _WidgetBase, _TemplatedMixin, parser, ready, dom, xhr, domConstruct, array, template) {
	return declare("widget.LayouteditorMovable",[_WidgetBase, _TemplatedMixin], {
		//properties
		templateString: template,
		title: "title",
		questionId: 0,
		questionInfo: null,
		styleCSS: '',
		
		//constructor
		constructor: function(args){
	        declare.safeMixin(this,args);
			if(this.questionInfo == null){
				this.title = this.questionId+' is removed.';
				this.styleCSS = 'background-color: red;';
			} else {
				this.title = this.questionInfo.question_text;
			}
		},
		
		postCreate:function(){
			this.inherited(arguments);
			
			this.domNode.myMovable = this;
			
			parser.parse();
		},
		
		onStart: function(){
			this.inherited(arguments);
			
			parser.parse();
		},
		
		destroy:function(){
			this.inherited(arguments);
		}
	});
});	
