	var CongSearchResultSet = function() {
		this.totalDataCount = 0;
		this.totalPageCount = 0;
		this.searchDatas = null;
	}

	var CongSearchData = function() {
		this.dataType = 0;
		this.id = null;
		this.x = 0;
		this.y = 0;
		this.hname1 = null;
		this.hname2 = null;
		this.hname3 = null;
		this.kname1 = null;
		this.kname2 = null;
		this.gname = null;
		this.vname = null;
		this.telephone = null;
		this.address = null;
		this.url = null;
		
		this.etc1 = null;
		this.etc2 = null;
		this.etc3 = null;
		this.desc = null;
		this.photos = null;
		this.keywords = null;
		this.toString = function() {
			var output = "";
			for (var property in this) {
				if(property != 'toString') {
	                output += property + " = " + this[property] + "\n";
				}
			}
			return output;
		}
	}

	var CongSearchService = function() {
    		//this.setProxy("/congsoa/clientproxy.jsp", "http://biz.congnamul.com");
		this.setProxy("/Web/Map/MapProxy.aspx", "http://biz.congnamul.com");
		this.serviceURL = "/congsoa/search/";
	}
	
	CongClass.extend(CongSearchService,CongBasicService);
	CongClass.extend(CongSearchService,CongAjaxClass);
	
	CongSearchService.prototype.nameSearch = function(hcode1, hcode2, hcode3, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameSearch(true, hcode1, hcode2, hcode3, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchNameSearch = function(hcode1, hcode2, hcode3, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameSearch(false, hcode1, hcode2, hcode3, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doNameSearch = function(synch, hcode1, hcode2, hcode3, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		query.add("hcode1", hcode1);
		query.add("hcode2", hcode2);
		query.add("hcode3", hcode3);
		query.add("name", name);
		query.add("pagesize", pagesize);
		query.add("page", page);
		query.add("lang", lang);
		query.add("output", output);
		
		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);
		
		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"nameSearch.service", query.toString());
			} else {
				this.requestJSON(this.serviceURL+"nameSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"nameSearch.service", query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"nameSearch.service", query.toString(), this.onParseSearchList);
			}
		}
	}

	CongSearchService.prototype.nameRegionSearch = function(minx, miny, maxx, maxy, name, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameRegionSearch(true, minx, miny, maxx, maxy, name, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchNameRegionSearch = function(minx, miny, maxx, maxy, name, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameRegionSearch(false, minx, miny, maxx, maxy, name, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doNameRegionSearch = function(synch, minx, miny, maxx, maxy, name, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		query.add("minx", minx);
		query.add("miny", miny);
		query.add("maxx", maxx);
		query.add("maxy", maxy);
		query.add("name", name);
		query.add("lang", lang);
		query.add("output", output);

		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);

		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"nameRegionSearch.service",query.toString());
			} else {
				this.requestJSON(this.serviceURL+"nameRegionSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"nameRegionSearch.service",query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"nameRegionSearch.service", query.toString(), this.onParseSearchList);
			}		
		}
	}
		
	CongSearchService.prototype.nameBcodesSearch = function(bcodes, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameBcodesSearch(true, bcodes, name, pagesize, page, lang, output);
	}
	CongSearchService.prototype.asynchNameBcodesSearch = function(bcodes, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doNameBcodesSearch(false, bcodes, name, pagesize, page, lang, output);
	}
	CongSearchService.prototype.doNameBcodesSearch = function(synch, bcodes, name, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		if(bcodes!=null) {
			for(var i=0; i<bcodes.length; i++) {
				query.add("bcodes", bcodes[i]);
			}
		}
		query.add("name", name);
		query.add("pagesize", pagesize);
		query.add("page", page);
		query.add("lang", lang);
		query.add("output", output);

		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);

		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"nameBcodesSearch.service",query.toString());
			} else {
				this.requestJSON(this.serviceURL+"nameBcodesSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"nameBcodesSearch.service",query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"nameBcodesSearch.service", query.toString(), this.onParseSearchList);
			}
		}
	}
	
	CongSearchService.prototype.keywordSearch = function(hcode1, hcode2, hcode3, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordSearch(true, hcode1, hcode2, hcode3, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchKeywordSearch = function(hcode1, hcode2, hcode3, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordSearch(false, hcode1, hcode2, hcode3, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doKeywordSearch = function(synch, hcode1, hcode2, hcode3, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		query.add("hcode1", hcode1);
		query.add("hcode2", hcode2);
		query.add("hcode3", hcode3);
		query.add("keyword", keyword);
		query.add("pagesize", pagesize);
		query.add("page", page);
		query.add("lang", lang);
		query.add("output", output);
		
		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);
			
		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"keywordSearch.service",query.toString());
			} else {
				this.requestJSON(this.serviceURL+"keywordSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch) {
				var dom = this.getDom(this.serviceURL+"keywordSearch.service",query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"keywordSearch.service", query.toString(), this.onParseSearchList);
			}
		}
	}

	CongSearchService.prototype.keywordRegionSearch = function(minx, miny, maxx, maxy, keyword, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordRegionSearch(true, minx, miny, maxx, maxy, keyword, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchKeywordRegionSearch = function(minx, miny, maxx, maxy, keyword, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordRegionSearch(false, minx, miny, maxx, maxy, keyword, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doKeywordRegionSearch = function(synch, minx, miny, maxx, maxy, keyword, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		query.add("minx", minx);
		query.add("miny", miny);
		query.add("maxx", maxx);
		query.add("maxy", maxy);
		query.add("keyword", keyword);
		query.add("lang", lang);
		query.add("output", output);

		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);

		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"keywordRegionSearch.service",query.toString());
			} else {
				this.requestJSON(this.serviceURL+"keywordRegionSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"keywordRegionSearch.service",query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"keywordRegionSearch.service", query.toString(), this.onParseSearchList);
			}
		}
	}
	
	CongSearchService.prototype.keywordBcodesSearch = function(bcodes, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordBcodesSearch(true, bcodes, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchKeywordBcodesSearch = function(bcodes, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doKeywordBcodesSearch(false, bcodes, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doKeywordBcodesSearch = function(synch, bcodes, keyword, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		if(bcodes!=null) {
			for(var i=0; i<bcodes.length; i++) {
				query.add("bcodes", bcodes[i]);
			}
		}
		query.add("keyword", keyword);
		query.add("pagesize", pagesize);
		query.add("page", page);
		query.add("lang", lang);
		query.add("output", output);

		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);
			
		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"keywordBcodesSearch.service",query.toString());
			} else {
				this.requestJSON(this.serviceURL+"keywordBcodesSearch.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"keywordBcodesSearch.service",query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"keywordBcodesSearch.service", query.toString(), this.onParseSearchList);
			}
		}
	}
	
	CongSearchService.prototype.initialSoundOfNameSearchSearch = function(hcode1, hcode2, hcode3, initialSound, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doInitialSoundOfNameSearch(true, hcode1, hcode2, hcode3, initialSound, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.asynchInitialSoundOfNameSearch = function(hcode1, hcode2, hcode3, initialSound, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		return this.doInitialSoundOfNameSearch(false, hcode1, hcode2, hcode3, initialSound, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem);
	}
	CongSearchService.prototype.doInitialSoundOfNameSearch = function(synch, hcode1, hcode2, hcode3, initialSound, pagesize, page, lang, output, inputCoordSystem, outputCoordSystem) {
		var query = new CongQueryString(true);
		query.add("hcode1", hcode1);
		query.add("hcode2", hcode2);
		query.add("hcode3", hcode3);
		query.add("initialSound", initialSound);
		query.add("pagesize", pagesize);
		query.add("page", page);
		query.add("lang", lang);
		query.add("output", output);

		if(inputCoordSystem)
			query.add("inputCoordSystem", inputCoordSystem);
		if(outputCoordSystem)
			query.add("outputCoordSystem", outputCoordSystem);

		if(output && output.toUpperCase()=="JSON") {
			if(synch==true) {
				return this.getJSON(this.serviceURL+"searchInitialSoundOfName.service", query.toString());
			} else {
				this.requestJSON(this.serviceURL+"searchInitialSoundOfName.service", query.toString(), this.onSearchJSON);
			}
		} else {
			if(synch==true) {
				var dom = this.getDom(this.serviceURL+"searchInitialSoundOfName.service", query.toString());
				return this.parseSearchList(dom);
			} else {
				this.request(this.serviceURL+"searchInitialSoundOfName.service", query.toString(), this.onParseSearchList);
			}
		}
	}

	CongSearchService.prototype.onNameSearch = null;
	CongSearchService.prototype.onParseSearchList = function(httprequest, dom) {
		var resultSet = this.parseSearchList(dom);
		if(this.onNameSearch!=null) {
		    this.onNameSearch(resultSet);
		} else {
			alert("callback function is null");
		}
	}
	CongSearchService.prototype.onSearchJSON = function(httprequest, data) {
		if(this.onNameSearch!=null) {
		    this.onNameSearch(data);
		} else {
			alert("callback function is null");
		}
	}
	
	CongSearchService.prototype.parseSearchList = function(dom) {
		var resultSet = new CongSearchResultSet();
		var parser = new CongDomParserClass(dom);
		var result = null;
		var handler = {
			process : function(pObj,depth,nodeName,node) {
				var resObj = null;
				if(depth==0) {
					var totalDataCount = node.getAttribute("totalDataCount");
					var totalPageCount = node.getAttribute("totalPageCount");
					resultSet.totalDataCount = (totalDataCount==null) ? 0 : totalDataCount;
					resultSet.totalPageCount = (totalPageCount==null) ? 0 : totalPageCount;
					resObj = new Array();
				} else if(depth==1) {
					var searchData = new CongSearchData();
					searchData.dataType = node.getAttribute("dataType");
					searchData.id = node.getAttribute("id");
					searchData.x = node.getAttribute("x");
					searchData.y = node.getAttribute("y");
					searchData.hname1 = node.getAttribute("hname1");
					searchData.hname2 = node.getAttribute("hname2");
					searchData.hname3 = node.getAttribute("hname3");
					searchData.kname1 = node.getAttribute("kname1");
					searchData.kname2 = node.getAttribute("kname2");
					searchData.gname = node.getAttribute("gname");
					searchData.vname = node.getAttribute("vname");
					searchData.telephone = node.getAttribute("telephone");
					//searchData.address = node.getAttribute("address");
					searchData.address = node.getAttribute("address")?node.getAttribute("address"):searchData.hname1+" "+searchData.hname2+" "+searchData.hname3;
					searchData.url = node.getAttribute("url");
					searchData.etc1 = node.getAttribute("etc1");
					searchData.etc2 = node.getAttribute("etc2");
					searchData.etc3 = node.getAttribute("etc3");
					searchData.desc = node.getAttribute("desc");
					var photosString = node.getAttribute("photosString");
					searchData.photos = photosString.split(",");
					var keywordsString = node.getAttribute("keywordsString");
					searchData.keywords = keywordsString.split(",");
					pObj[pObj.length] = searchData;
					resObj = searchData;
				}
				return resObj;
			}
		}
		resultSet.searchDatas=parser.parse(handler);
		result = resultSet;
		return result;
	}
	
	CongSearchService.prototype.listTemplateEngine;
	CongSearchService.prototype.setListTemplateEngine = function(listTemplateEngine) {
		this.listTemplateEngine = listTemplateEngine
	}
	
	CongSearchService.prototype.listDiv;
	CongSearchService.prototype.setListDiv = function(listDiv) {
	    this.listDiv = listDiv;
	}
	
	CongSearchService.prototype.renderList = function(datas) {
		this.listTemplateEngine.setParameter("datas", datas);
		this.listDiv.innerHTML = this.listTemplateEngine.getResult();
	}