var Searcher = function(containerId,labelId) {
	//this.label = document.createElementById(labelId);
	this.tab = new Tab(containerId);
	this.queryList = {}
}

Searcher.prototype = {
	find: function (query) {
		if(this.queryList[query]) {
			this.tab.open(query);
		} else {
			this._showResult(query);
		}
	},
	
	remove: function(query) {
		if(this.queryList[query]) {
			this.tab.remove(query);
			this.queryList[query] = null;
		}
	},
	
	_showResult: function(query) {
		var url = _url + "?search_cam=" + query + "&results=20&" + siteKey;
		var othis = this;
		var loader = new net.ContentLoader(
			url, 
			function() {
				othis._loadResult(query, this.req);	
			});
	},
	
	_loadResult: function(query, req) {
		var camList = getJsonFromReq(req);
		if(!camList || camList.length == 0) {
			this.tab.openText("No Web Cameras are found");	
			return;
		}
		var ul = getSmallImgUlList(camList);
		ul.infoKey = "search_webcam_" + query;
		this.tab.open(query, ul);
		this.queryList[query] = true;
	}
}