// function to control the state of element - selected state - unselected state
function ControlState() {
	
	var history = null;
	var style ="";
	
	function allocateStyle(stylename){
		style = stylename;
	}
	
	
	function changeState(id){
		var current = document.getElementById(id);
		current.className = style;

		if(history != null)
			history.className = "";
		
		history = document.getElementById(id);
	}
		
		
	this.updateState = function(id){
		changeState(id);
	};
	
	
	this.setStyle = function(stylename){
		allocateStyle(stylename)
	};
}

