App.Collections.Flag = Backbone.Collection.extend({
	model: App.Models.Flag,
	currentFolder: '',
	ids:'',
	flag:'',
	url: function(){
		return App.baseUrl + '/api/mail/setmessageflags?folder='+this.currentFolder+'&flag='+this.flag+'&uids='+ this.ids;

	}

})


App.Collections.Flag.prototype.setCurrentFolder = function(folder){
	this.currentFolder = folder;
};

App.Collections.Flag.prototype.setFlag = function(flag){
	this.flag = flag;
};

App.Collections.Flag.prototype.setIDs = function(ids){
	console.log('App.Collections.Flag.prototype.setIDs() ids: ' + ids);

	if(typeof ids === 'number')
	{
		this.ids = ids.toString();
		return;
	}

	var idsArray = [];
	for(var i = 0; i < ids.length; ++i)
	{
		idsArray.push(ids[i]);
	}

    // todo: what is this here for?
	if(ids.indexOf(" ") != -1)
	{
		this.ids = idsArray.join(",");
	}
	else
	{
		this.ids = ids;
	}

	console.log('App.Collections.Flag.prototype.setIDs() this.ids: ' + this.ids);
};



