/*
* 	Mapsack status
*/

var State = {
	//Constants
	MODE_EXPLORE : 0,
	MODE_ADD : 1,
	MODE_MOVING : 2,
	
	/*
	*	browsing mode
	*/
	mode : -1,  				
		
	/*
	*	For Tag handling
	*/
	currentTags : [],	//Current content of the tag shelf
	current_search_term : '',
	
	genericMinTags : [],	 //Generic minimum tags
	genericExcludeTags: [],  //Generic exclude tags
	initialTags : [],	 //Current initial tags
	excludeTags : [],		 //Current exclude tags

	//If this is ever not -1, the record with the id will be poped-up on next load
	autopopid : -1,
	
	//Should I jump to the center of the items on next load?
	autocenter : false,
	
	//Should I fit to the bounds of the items on next load?
	autobounds : false,
	
	init : function(){
		State.mode = State.MODE_EXPLORE;
		State.autopopid = _initdata.autopopid;
		State.autobounds = (_initdata.autobounds ==1);
		State.autocenter = (_initdata.autocenter ==1);
	},
	
	initTags : function(tags, extags, mintags){
		State.genericMinTags = mintags;
		State.genericExcludeTags.extend(extags);		
		State.excludeTags = State.genericExcludeTags.copy();
		State.initialTags = tags;
		State.currentTags = tags;
 		//TagCloud.displayCurrentTags();
		//Explore.doload(true);
	},
	
	setTags : function (tags, inttags, extags){
		State.excludeTags = extags.concat(State.genericExcludeTags);
		State.initialTags = inttags; 
		State.currentTags = inttags.concat(tags);
 		TagCloud.displayCurrentTags();
		Explore.doload(true);
	}
};