

EPSN.search={

	Umdsearch:function(){



		umdname=$("#searchumd").val();

		
		if ($("#addr_select").val()=="UMD")
		{	var param="c=umd&umdname="+encodeURIComponent(umdname);
			var method="post";
			var url="xml/SearchPopup.php";
			var f="Umdsearchtable";
			var page=1;
			this.submit(url,method,param,f,page,"json");

		}else{
			var param="c=addr&umdname="+encodeURIComponent(umdname);
			var method="post";
			var url="xml/SearchPopup.php";
			var f="searchDetailAddr2";
			var page=1;
			//window.open(url + "?"+param)
			this.submit(url,method,param,f,page,"xml");

		}
		
		
	
	}
	,xy_searchall:function(){
	
	
		if( !isUndefined($("#xy_value").val()) )
		{
			EPSN.NewDiv.error("xy_valuechk","검색어를 입력하세요","red");
			$("#xy_value").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("xy_valuechk");
		}




		var xy=$("#xy_value").val();

		xy=xy.split(",");
		x1=xy[1];
		y1=xy[0];
	
		name=$("#xy_value").val();


		if ($("#xy_select").val()=="WGS84")
		{
			T="G";

			if (x1!='' && y1!='') document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(x1,y1,name,T)
		}else if ($("#xy_select").val()=="GG")
		{
			T="M";
			if (x1!='' && y1!='') document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(y1,x1,name,T)
		}else if ($("#xy_select").val()=="KATEC")
		{
			T="N";
			if (x1!='' && y1!='') document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(y1,x1,name,T)
			//if (x1!='' && y1!='') CoordinatesInput(y1,x1,"Naver","00")

		}
		//xy_select


	
	
	}
	,epAngular:function(){
		

		if( $("#xe").val() == "" )
		{
			EPSN.NewDiv.error("xechk","경도 좌표가 누락되었습니다","red");
			$("#xe").focus();
		}
		else if( $("#xm").val() == "")
		{
			EPSN.NewDiv.error("xechk","경도 좌표가 누락되었습니다","red");
			$("#xm").focus();
		}
		else if( $("#xx").val() == "")
		{
			EPSN.NewDiv.error("xechk","경도 좌표가 누락되었습니다","red");
			$("#xx").focus();
		}
		else if( $("#yn").val() == "")
		{
			EPSN.NewDiv.error("xechk","위도 좌표가 누락되었습니다","red");
			$("#yn").focus();
		}
		else if( $("#ym").val() == "")
		{
			EPSN.NewDiv.error("xechk","위도 좌표가 누락되었습니다","red");
			$("#ym").focus();
		}
		else if( $("#yy").val() == "")
		{
			EPSN.NewDiv.error("xechk","위도 좌표가 누락되었습니다","red");
			$("#yy").focus();
		}
		else
		{
			EPSN.NewDiv.slideUP("xechk");
			var xe = $("#xe").val();
			var xm = $("#xm").val();
			var xx = $("#xx").val();

			var yn = $("#yn").val();
			var ym = $("#ym").val();
			var yy = $("#yy").val();

			var iPx = (parseInt(eval(xe))*360000) + (parseInt(eval(xm))*6000) + (parseInt(eval(xx))/1000*6000);
			var iPy = (parseInt(eval(yn))*360000) + (parseInt(eval(ym))*6000) + (parseInt(eval(yy))/1000*6000);

			var Px = String(iPx);
			var Py = String(iPy);
		
			vPx = parseInt(Px);
			vPy = parseInt(Py);

			Px = ( parseInt(Px.substr(0,7))+80 ) * 10;
			Py = ( parseInt(Py.substr(0,7))-100 ) * 10;
		
			document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(vPx,vPy,"선택지점","M")

		}

	}
	,Epsearch:function(a){
	
		if( !isUndefined($("#epsearch_values").val()) )
		{
			EPSN.NewDiv.error("epsearch_valueschk","검색어를 입력하세요","red");
			$("#epsearch_values").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("epsearch_valueschk");
		}












		var epsearch_values=$("#epsearch_values").val();




	/*
		if ( retURL = isAccessServer(epsearch_values) ){
			if ( epsearch_values.indexOf("#") > -1 )	{
				ep = epsearch_values.split("#");
				para = "?epid="+(ep[0].replace(" ",""));
				para = para + "&epdomain="+(ep[1].replace(" ",""));
				ep_id=ep[0]
			}else{
				para = "?epid="+(epsearch_values.replace(" ",""));
				ep_id=epsearch_values
			}
			
			retURL1=retURL.replace("/d/","/r/");
		
		}
		*/
		//alert(retURL1)
//xml_remote_eposition_query.php?epid="+epid+"&qu="+queryURL1);
		//exit;
		
		var param="epid="+encodeURIComponent(epsearch_values)+"&page="+a;
		var method="post";
		var url="xml/xml_remote_eposition_query.php";
		var f="Epsearchtable";
		var page=1;
		//window.open(url + "?"+param)
		this.submit(url,method,param,f,page,"json");

	}
	,Namesearch:function(a){
		
		if(!isUndefined($("#namesearch_value").val()))
		{
			EPSN.NewDiv.error("#namesearch_valuechk","검색어를 입력하세요","red");
			$("#namesearch_value").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("#namesearch_valuechk");
		}
		
		var param="page="+a+"&c=searchDetailNamesearch&name="+encodeURIComponent($("#namesearch_value").val());
		var method="POST";
		var url="xml/json_remote_eposition_query.php";
		var f="Namesearchtable";
		var page=a;
		//window.open(url + "?"+param)
		this.submit(url,method,param,f,page,"json");

	}
	,Telsearch:function(){
	
		if(!isUndefined($("#telsearchvalue").val()))
		{
			EPSN.NewDiv.error("telsearchvaluechk","검색어를 입력하세요","red");
			$("#telsearchvalue").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("telsearchvaluechk");
		}

		var param="c=searchDetailtel&name="+encodeURIComponent($("#telsearchvalue").val());
		var method="POST";
		var url="xml/json_remote_eposition_query.php";
		var f="Telsearchtable";
		var page=a;
		//window.open(url + "?"+param)
		this.submit(url,method,param,f,page,"json");

	}
	,wgs84:function(){
	
		if( !isUndefined($("#wgs84id").val()) )
		{
			EPSN.NewDiv.error("wgs84idchk","검색어를 입력하세요","red");
			$("#wgs84id").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("wgs84idchk");
		}

		var xy=$("#wgs84id").val();

		xy=xy.split(",");
		x=xy[1];
		y=xy[0];
	
		name='새로운 선택지점';

		if (x!='' && y!=''){
			document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(x,y,name,"G")
		}
	}
	,worldsearch:function(data){
		

		$("#SearchPopupdata").show()
		$("#SearchPopupdata").html(data)
	}
	,showAddress:function(){
		




		
		//alert($("#Addressid").val())
		

		

		if( $("#Addressid").val() == "" )
		{
			EPSN.NewDiv.error("Addressidchk","검색어를 입력하세요","red");
			$("#Addressid").focus();
			return false;
		}else{
			EPSN.NewDiv.slideUP("Addressidchk");
		}

		
	//alert(1)
		var search = $("#Addressid").val(); 

		document.getElementById('mapiframe').contentWindow.CaptureForm(search)
		return false;
		// ====== Perform the Geocoding ======
		document.getElementById('mapiframe').contentWindow.MAPS.Control.geo.getLatLng(search, function (point)
		{
			//return false;
		// ===== If that was successful, plot the point and centre the map ======
			if (point) {

				//alert(point['Lat'])
				
				//var zpoint=point.replace(",",""); 

				//alert(point.x)
				
				document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint(point.x,point.y,search,"G")
				
				//zpoint=zpoint.replace(")",""); 
				
				//zpoint=zpoint.split(",");
				
				//alert(zpoint)
				
				//map.setCenter(point,14);


				//map.clearOverlays()
				//map.addOverlay(marker2);
				//map.addOverlay(new GMarker(point,icon));
				//map.openInfoWindow(point, document.createTextNode(search));



				//document.getElementById("Px").value=Math.round(point.x*360000);
				//document.getElementById("Py").value=Math.round(point.y*360000);

			}
			// ====== Decode the error status ======
			else {
			// ==Look to see if the query was cached ==
				var result=document.getElementById('mapiframe').contentWindow.MAPS.Control.geo.getCache().get(search);
				if (result) {
					var reason="Code "+result.Status.code;
					if (document.getElementById('mapiframe').contentWindow.MAPS.Control.reasons[result.Status.code]) {
					  reason = document.getElementById('mapiframe').contentWindow.MAPS.Control.reasons[result.Status.code]
					}
				} else {
					var reason = "";
				}
				
				//alert('검색 할수 없습니다 "'+search+ '" ' + reason);
				EPSN.NewDiv.error("Addressidchk",'검색 할수 없습니다 "'+search+ '" ' + reason,"red");
			}
		});


	}
	,submit:function(url,method,param,f,page,type){
	
		var d;
		$.ajax({
			type: method,
			url: url,
			data: param ,
			timeout: 5000,
			dataType: type ,
			beforeSend:function(){

				$("#SearchPopup").block('<b><img src="img/loading.gif"> Loading... </b>');
			},
			complete: function(){
				//$("#findResult").animate({opacity: "show" }, { duration: "slow" })
				//alert(d)
				if (d==false){
					
				}else{
					
					$("#SearchPopup").unblock();
				
				}

			},
			error: function(msg){
				$("#SearchPopup").block('<b>Network Error</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{a:setTimeout('$("#SearchPopup").unblock()',"3000")});

			},
			success: function(aa){
				d=eval("EPSN.search." + f)(aa);
			}



		})
	
	}
	,Umdsearchtable:function(json){
			var data= "<div style=padding:2px></div><select id='zipname' name='zipname' style='width:320px;color:#000000;background:#EAEEEA;' size=7 onchange=EPSN.search.select_zipname()>";
			$.each(json.items, function(i,item){
				$.each(item, function(i, n){
					Temp=n.split(",");
					//4280031035,명곶리,46082530,13687960,4280031035,강원도 양구군 남면 명곶리
					data += "<option b_code='"+Temp[0]+"' lon='"+Temp[2]+"' lat='"+Temp[3]+"' temp_detail='"+Temp[1]+"' value='"+Temp[5]+"'>"+Temp[5]+"</option>";

				});

			  });
			
			data += "</select><div style=padding:2px></div><input type=text id=jusotext style='width:320px' class=boxblue><BR> 산 : 	<input type=checkbox id=SanCHK value='2'>'산' 포함시 <input type=text id=Bungi1 style='width:30px;' maxlength=5 class=boxblue>	- <input type=text id=Bungi2 style='width:30px;' maxlength=5 class=boxblue> <img src='img/search_confirm.gif' onclick=\"EPSN.search.searchDetailAddr('search')\" style='cursor:pointer;' align=absmiddle><div id=search1chk style=display:none></div>";
			$("#SearchPopupdata").show()
			$("#SearchPopupdata").html(data)
	}
	,select_zipname:function(){
		
	//	alert($("#zipname option:selected").attr('lon'))

	//	var Temp=document.all.zipname.options[document.all.zipname.selectedIndex];
		$("#jusotext").val($("#zipname option:selected").attr('value'));

	}
	,searchDetailAddr:function(json){
		//alert(json)
		
		if (json=="search")
		{


			if( $("#jusotext").val() == "" )
			{
				EPSN.NewDiv.error("jusotextchk","지역을 선택하세요","red");
				$("#jusotext").focus();
				return false;
			}else{
				EPSN.NewDiv.slideUP("jusotextchk");
			}

			var jusotext=$("#jusotext").val();

			var Bungi2=$("#Bungi2").val();
			var Bungi1=$("#Bungi1").val();

	
			//if ( $("#SanCHK:checked")) { s_san = "산"; } else { s_san=""; }
			
			if ( $("#SanCHK:checked").val()=="2" ) { s_san = "산"; } else { s_san=""; }
//			$("#SanCHK option:checked").attr('value')
			//alert($("#SanCHK:checked").val())
			//return false

			var param="c=searchDetailAddr&jusotext="+encodeURIComponent(jusotext)+"&san="+encodeURIComponent(s_san)+"&bun1="+encodeURIComponent(Bungi1)+"&bun2="+encodeURIComponent(Bungi2);
			var method="post";
			var url="xml/SearchPopup.php";
			var f="searchDetailAddr1";
			var page=1;
			//window.open(url + "?"+param)
			this.submit(url,method,param,f,page,"xml");
		}
		
		
	}
	,searchDetailAddr1:function(json){
//		alert(json)
		var userquery=$(json).find('userquery').text();
		var x_search="";
		var y_search="";

		$(json).find('item').each(function(){
			x_search = $(this).find('x').text();
			y_search = $(this).find('y').text();
			//var userquery = $(this).find('userquery').text();
			
			return false

			
		});

		if (x_search !="")
		{
			$("#SearchPopup").block('<b >'+userquery+' 로 이동합니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000"), b:setTimeout('document.getElementById(\'mapiframe\').contentWindow.MAPS.Control.viewpoint("'+x_search+'","'+y_search+'","'+userquery+'","N")',"1000")});
			
		}else{
			//var Temp=document.all.zipname.options[document.all.zipname.selectedIndex];
			//$("#jusotext").val(Temp.value);
			//$("#jusotext").val($("#zipname option:selected").attr('value'));

			$("#SearchPopup").block('<b >검색결과가 없습니다 <br>'+$("#zipname option:selected").attr('value')+' 로 이동합니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000"), b:setTimeout('document.getElementById(\'mapiframe\').contentWindow.MAPS.Control.viewpoint("'+$("#zipname option:selected").attr('lon')+'","'+$("#zipname option:selected").attr('lat')+'","'+$("#zipname option:selected").attr('value')+'","M")',"1000")});


		}


		return false
	}
	,searchDetailAddr2:function(json){
//		alert(json)
		var userquery=$(json).find('userquery').text();
		var x_search="";
		var y_search="";

		$(json).find('item').each(function(){
			x_search = $(this).find('x').text();
			y_search = $(this).find('y').text();
			//var userquery = $(this).find('userquery').text();
			
			return false

			
		});

		if (x_search !="")
		{
			$("#SearchPopup").block('<b >'+userquery+' 로 이동합니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000"), b:setTimeout('document.getElementById(\'mapiframe\').contentWindow.MAPS.Control.viewpoint("'+x_search+'","'+y_search+'","'+userquery+'","N")',"1000")});
			
		}else{
			//$("#jusotext").val(Temp.value);
			//$("#jusotext").val($("#zipname option:selected").attr('value'));

			$("#SearchPopup").block('<b >검색결과가 없습니다 <br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000")});


		}


		return false
	}
	,Epsearchtable:function(json){


		var inhtml="<div style='padding:2px'></div><table cellpadding=0 cellspacing=0 width=95% style='table-layout:fixed' align=center>";
		inhtml+="<tr height=2px><td colspan=3 bgcolor=#609ECF></td></tr>";
		inhtml+="<col width=230px align=left>";
		inhtml+="<col width=110px align=left>";
		inhtml+="<col width=50px align=left>";
		inhtml+="<tr bgcolor='#F9F9F9' height=25px><td align=left><b style='color:#474747'>아이디</b></td><td  align=left><b style='color:#474747'>주소</a></td><td><b style='color:#474747'  align=left>위치선택</b></td></tr>";
		inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";

		if (json.count == 0)
		{
			inhtml+="<tr ><td colspan=3>검색 결과가 없습니다</td></tr>";

		}else{
			//식별코드(PID) 푯말명 주 소 우편번호 위치선택 
			$.each(json.items, function(i,item){
				var epid=item.ep_id;


				if (decodeURIComponent(item.ep_domain)=="사이사이" || decodeURIComponent(item.ep_domain)=="ucici.net")
				{
					inhtml+="<tr height=22px>";
	//				inhtml+="<td align=left><a href=javascript:EPSN.search.search_eposition_view1('"+decodeURIComponent(item.ep_id)+"','"+decodeURIComponent(item.ep_domain)+"','"+decodeURIComponent(item.qurl)+"')>"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"</a></td>";
					
					inhtml+="<td align=left><a href=javascript:void(0) onclick='window.open(\"http://open.egosio.com/?q="+(item.ep_id)+"%23"+(item.ep_domain)+"\")'>"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"</a></td>";
					
					inhtml+="<td align=left>"+decodeURIComponent(item.region)+"</td>";
					inhtml+="<td align=left></td>";
					inhtml+="</tr>";
					inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";
				}else{
					if (item.qurl=="")
					{
						inhtml+="<tr height=22px>";


						inhtml+="<td align=left><a href='http://keyword.eposition.com/?keyword="+(item.ep_id)+"%23"+(item.ep_domain)+"' target=_blank>"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"</a></td>";
						inhtml+="<td align=left>"+decodeURIComponent(item.region)+"</td>";
						inhtml+="<td align=left></td>";
						inhtml+="</tr>";
						inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";
					}else{
						inhtml+="<tr height=22px>";
						inhtml+="<td align=left><a href=javascript:EPSN.search.search_eposition_view1('"+decodeURIComponent(item.ep_id)+"','"+decodeURIComponent(item.ep_domain)+"','"+decodeURIComponent(item.qurl)+"')>"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"</a></td>";
						inhtml+="<td align=left>"+decodeURIComponent(item.region)+"</td>";
						inhtml+="<td align=left><a href=javascript:EPSN.search.search_eposition_view2('"+decodeURIComponent(item.ep_id)+"','"+decodeURIComponent(item.ep_domain)+"','"+decodeURIComponent(item.qurl)+"')><img src='img/area.gif' style='cursor:pointer' align=absmiddle></a></td>";
						inhtml+="</tr>";
						inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";
					}
				}
				


			});
			inhtml+="<td colspan=3>"+ EPSN.search.AllPage( json.total , json.page,"EPSN.search.Epsearch") +"</td>";

		}
		inhtml+="</table>";
		//alert(inhtml)
		$("#SearchPopupdata").show()
		$("#SearchPopupdata").html(inhtml)
/*
		$(json).find('eposition').each(function(){

			if ($(this).attr('result')=="find")
			{
				$("#SearchPopup").block('<b >'+$(this).attr('epid') +"#"+$(this).attr('epdomain') +' 로 이동합니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000"), b:setTimeout('document.getElementById(\'mapiframe\').contentWindow.MAPS.Control.viewpoint("'+$(this).attr('px')+'","'+$(this).attr('py')+'","'+$(this).attr('epid') +"#"+$(this).attr('epdomain')+'","M")',"1000")});
			}else{
				$("#SearchPopup").block('<b >검색결과가 없습니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000")});

			}

		});
		return false
	*/
	}
	,search_eposition_view:function(epid){
		
		//alert(document.getElementById('contents_basic'))
		
		if (!document.getElementById('contents_basic'))
		{
			LeftPanelWidth=357;
			EPSN.LeftPanelResize(LeftPanelWidth,"resize","epositionsearchview");
			//Button_click("myep_button")
			setTimeout("EPSN.contents.Contents_Basic('"+epid+"')","1000")
		}else{
			
			EPSN.contents.Contents_Basic(epid)

		}




		
	}
	,search_eposition_view1:function(epid,domain,qurl){
	
		
		if (!document.getElementById('contents_basic'))
		{
			LeftPanelWidth=357;
			EPSN.LeftPanelResize(LeftPanelWidth,"resize","epositionsearchview");
			//Button_click("myep_button")
			setTimeout("EPSN.contents.Contents_Basic1('"+epid+"','"+domain+"','"+qurl+"')","1000")
		}else{
			
			EPSN.contents.Contents_Basic1(epid,domain,qurl)

		}
	

	}
	,search_eposition_view2:function(epid,domain,qurl){
		
		EPSN.contents.Contents_Basic2(epid,domain,qurl)

	}
	,Namesearchtable:function(json){
		var inhtml;

		inhtml="<div style='padding:2px'></div><table cellpadding=0 cellspacing=0 width=95% style='table-layout:fixed' align=center>";
		inhtml+="<tr height=2px><td colspan=3 bgcolor=#609ECF></td></tr>";
		inhtml+="<col width=230px align=left>";
		inhtml+="<col width=110px align=left>";
		inhtml+="<col width=50px align=left>";
		inhtml+="<tr bgcolor='#F9F9F9' height=25px><td align=left><b style='color:#474747'>아이디</b></td><td  align=left><b style='color:#474747'>푯말명</a></td><td><b style='color:#474747'  align=left>위치선택</b></td></tr>";
		inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";


		if (json.count==0)
		{
			inhtml+="<tr ><td colspan=3>검색 결과가 없습니다</td></tr>";

		}else{
			//식별코드(PID) 푯말명 주 소 우편번호 위치선택 
			$.each(json.items, function(i,item){
				epid=item.ep_id;
				inhtml+="<tr height=22px>";
				inhtml+="<td align=left><a href=javascript:EPSN.search.search_eposition_view('"+decodeURIComponent(item.ep_id)+"')>"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"</a></td>";
				inhtml+="<td align=left>"+decodeURIComponent(item.ep_name)+"</td>";
				inhtml+="<td align=left><a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.px+"','"+item.py+"','"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"','M')><img src='img/area.gif' style='cursor:pointer' align=absmiddle></a></td>";

				inhtml+="</tr>";
				inhtml+="<tr height=1px><td colspan=3 bgcolor=#ADD1EB></td></tr>";

				//inhtml+= decodeURIComponent(item.ep_id) + "<img src='http://open.egosio.com/img/COUNTRY/"+item.country+".png'>" + " (" + decodeURIComponent(item.ep_name) +") <br>";
			});
			inhtml+="<td colspan=3>"+ EPSN.search.AllPage( json.total , json.page,"EPSN.search.Namesearch") +"</td>";

		}
		inhtml+="</table>";
		//alert(inhtml)
		$("#SearchPopupdata").show()
		$("#SearchPopupdata").html(inhtml)

	}
	,NamesearchPage:function(total,page){
		listunit=10;
		pageunit=10;
	/*
	var page=1;

	var listunit=10;
	var pageunit=10;

	totalcnt
	*/	
		
		var totpages = Math.ceil(total/listunit); //총페이지수
		var thisblock = Math.ceil(page/pageunit); //현재 페이징블럭
		var startpage, endpage;
		var ret_HTML = "";
		//ct=document.cform.hcate.value
		
		// 현재 페이지블럭의 시작페이지번호
		if(thisblock > 1){
			startpage = (thisblock-1)*pageunit+1;
		}else{
			startpage = 1;
		}
		
		// 현재 페이지블럭의 끝페이지번호
		if( (thisblock*pageunit) >= totpages ){
			endpage = totpages;
		}else{
			endpage = thisblock*pageunit;
		}
		
		ret_HTML = "<table width=100%><TR>";
		ret_HTML += "  <TD align='center' colspan='5' class='paging_td' >";
		
		if(page > 1){
			ret_HTML += "  <A href='javascript:EPSN.search.Namesearch(1);'><img src='img/left_arrow1.gif' align=absmiddle></A>"; 
			
			if (startpage!=1)
			{
				ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+(startpage-1)+");'><img src='img/left_arrow.gif' align=absmiddle></A>"; 

			}


		}



		for(i=startpage; i<=endpage; i++){
			if(i!=page){
				ret_HTML += " <A href='javascript:EPSN.search.Namesearch("+i+");'>"+i+"</A>";
			}else{
				ret_HTML += " <B>"+i+"</B>";
			}
		}
		


		if(page != totpages){
			if (i < totpages)
			{
				ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+(i)+");'><img src='img/right_arrow.gif' align=absmiddle></A>"; 

			}
			
			ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+totpages+");'><img src='img/right_arrow1.gif' align=absmiddle></A>"; 
		}

		ret_HTML += "  </TD>";
		ret_HTML += "</TR></table>";
		
		return ret_HTML;

	
	}
	,Telsearchtable:function(json){
		
		//alert(json.state)
		if (json.state=="true"){
			$("#SearchPopup").block('<b >'+json.tel +' 로 이동합니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000"), b:setTimeout('document.getElementById(\'mapiframe\').contentWindow.MAPS.Control.viewpoint("'+json.x+'","'+json.y+'","'+json.tel+'","M")',"1000")});
		}else{
			$("#SearchPopup").block('<b >검색결과가 없습니다</b><br><button onclick=$("#SearchPopup").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{ a:setTimeout('$("#SearchPopup").unblock()',"1000")});

		}
		return false
	
	}
	,box_text:{
		
		addr_umd:"봉명동"
		,addr_addr:"대전시 유성구 봉명동 538-8"
		,xy_gg:"45844033,13087984"
		,xy_wgs84:"39.9069,116.3914"
		,xy_katec:"309935,552083"
		,epsearch_values:"gg21#이고시오"
		,namesearch_value:"인천"
		,telsearchvalue:"042-828-7717"
		,Addressid:"Seoul"


	}
	,shadow_select:function(a,b){
   // $create(Microsoft.MapPoint.VirtualEarth.WebCore.WatermarkBehavior, {"CssClass":"Watermark","Text":"Business or location ...","id":"taskBar_qparam_wm"}, null, null, $get("taskBar_qparam"));
		

		//alert(EPSN.search.box_text.addr_umd)

		if (b=="addr")
		{
			if (a=="UMD")
			{
				$("#searchumd").css({"color":"#999999"}).val(EPSN.search.box_text.addr_umd);
			}else{
				$("#searchumd").css({"color":"#999999"}).val(EPSN.search.box_text.addr_addr);
			}
		}

		if (b=="xx")
		{

			if (a=="GG")
			{
				$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_gg);

			}else if (a=="WGS84")
			{
				$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_wgs84);
			}else if (a=="KATEC")
			{
				$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_katec);
			}

		}
		
		

	}
	
	//onfocus
	,box_press:function(a,b){
		//alert("press" + a+" "+b)

		if (a=="addr_select")
		{
			
			if ($("#addr_select").val()=="UMD")
			{
				if ($("#searchumd").val()==EPSN.search.box_text.addr_umd)
				{
					$("#searchumd").css({"color":"#000000"}).val("");
				}
			}else if ($("#addr_select").val()=="ADDR"){
				if ($("#searchumd").val()==EPSN.search.box_text.addr_addr)
				{
					$("#searchumd").css({"color":"#000000"}).val("");
				}
			}

		}else if (a=="xy_select")
		{
			if ($("#xy_select").val()=="GG"){

				if ($("#xy_value").val()==EPSN.search.box_text.xy_gg)
				{
					$("#xy_value").css({"color":"#000000"}).val("");
				}
			}else if ($("#xy_select").val()=="WGS84"){
				if ($("#xy_value").val()==EPSN.search.box_text.xy_wgs84)
				{
					$("#xy_value").css({"color":"#000000"}).val("");
				}
			}else if ($("#xy_select").val()=="KATEC"){
				if ($("#xy_value").val()==EPSN.search.box_text.xy_katec)
				{
					$("#xy_value").css({"color":"#000000"}).val("");
				}
			}

		}else{
		
			if (b=="epsearch_values")
			{
				if ($("#epsearch_values").val()==EPSN.search.box_text.epsearch_values) $("#epsearch_values").css({"color":"#000000"}).val("");
			}
			
			if (b=="namesearch_value")
			{
				if ($("#namesearch_value").val()==EPSN.search.box_text.namesearch_value) $("#namesearch_value").css({"color":"#000000"}).val("");
			}
			if (b=="telsearchvalue")
			{
				if ($("#telsearchvalue").val()==EPSN.search.box_text.telsearchvalue) $("#telsearchvalue").css({"color":"#000000"}).val("");
			}
			if (b=="Addressid")
			{
				if ($("#Addressid").val()==EPSN.search.box_text.Addressid) $("#Addressid").css({"color":"#000000"}).val("");
			}
		}

//Addressid

	}
	//onblur
	,box_up:function(a,b){
		if (a=="addr_select")
		{

			if ($("#addr_select").val()=="UMD")
			{
				
				if ($("#searchumd").val()=="")
				{
					$("#searchumd").css({"color":"#999999"}).val(EPSN.search.box_text.addr_umd);
				}
			}else if ($("#addr_select").val()=="ADDR"){
				if ($("#searchumd").val()=="")
				{
					$("#searchumd").css({"color":"#999999"}).val(EPSN.search.box_text.addr_addr);
				}
			}

		}else if (a=="xy_select")
		{
			if ($("#xy_select").val()=="GG"){

				if ($("#xy_value").val()=="")
				{
					$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_gg);
				}
			}else if ($("#xy_select").val()=="WGS84"){
				if ($("#xy_value").val()=="")
				{
					$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_wgs84);
				}
			}else if ($("#xy_select").val()=="KATEC"){
				if ($("#xy_value").val()=="")
				{
					$("#xy_value").css({"color":"#999999"}).val(EPSN.search.box_text.xy_katec);
				}
			}

		}else{
			if (b=="epsearch_values")
			{
				if ($("#epsearch_values").val()=="") $("#epsearch_values").css({"color":"#999999"}).val(EPSN.search.box_text.epsearch_values);
			}
			
			if (b=="namesearch_value")
			{
				if ($("#namesearch_value").val()=="") $("#namesearch_value").css({"color":"#999999"}).val(EPSN.search.box_text.namesearch_value);
			}
			if (b=="telsearchvalue")
			{
				if ($("#telsearchvalue").val()=="") $("#telsearchvalue").css({"color":"#999999"}).val(EPSN.search.box_text.telsearchvalue);
			}
			if (b=="Addressid")
			{
				if ($("#Addressid").val()=="") $("#Addressid").css({"color":"#999999"}).val(EPSN.search.box_text.Addressid);
			}
		}


	}
	,thema_select:function(a,b,src,c,d){

	//	alert(src)
		if (a=="1")
		{	//$("#thema_c1").
			
			
			$("#thema_img1").attr("src",src);
			
			
			var height_ani=25 * c
			
			var ani_left= $("#thema_img1").offset().left
			var ani_top= $("#thema_img1").offset().top
			
			//alert(ani_left)
			$("#anidiv").show();
			$("#anidiv").css({"left" : 10,"top":(height_ani + 52 )});
			$("#anidiv").html("<img src='"+src+"' style='width:150px;height:25px;border:1px solid #B5C5B5;'>");
			
			$("#anidiv").animate({"left": "+=153"}, {queue:false,duration: 500});
			$("#anidiv").animate({"top": "-="+height_ani}, {queue:false,duration: 500});
			
			
			setTimeout("$('#thema_cate1').slideUp()","700")
			setTimeout("$('#anidiv').hide('slow');","500")

			//$("#thema_c1").animate({"left": "-=100"});


			
			
			//$("#thema_cate1").slideUp();
			$("#thema_cate2").html("");
			$("#thema_c2").html("2차카테고리")
			//$("#thema_c2").css({"background-image":src})
			$("#cate_value1").val(b)
			$("#cate_value2").val("")

			var outhtml="";

			if (a!="")
			{
				
				//alert(b)
				$.each(CATES[b], function(i, n){
					Temp=CATES[b][i].split(",");
					if (Temp[0]!="") outhtml+="<div style='width:150px;height:20px;' onclick=javascript:EPSN.search.thema_select(2,'"+Temp[0]+"','"+Temp[1]+"','',"+b+")><img src='img/cate"+b+".gif' align=absmiddle>"+Temp[1]+"</div>";
				});
				//background-image:URL("+src+");
				$("#thema_cate2").html(outhtml)
			}
		
		}else if (a=="2")
		{
			$("#thema_cate2").slideUp();
			src1="<img src='img/cate"+d+".gif' align=absmiddle> "+src;
			$("#thema_c2").html(src1)
			
			$("#cate_value2").val(b)
		}

		
	}
	,CAreaSelect:function(a){
		document.getElementById("cate_area2").options.length=0;
		document.getElementById("cate_area2").options[0]=new Option("==구/군==","");
	
		if(a)
		{
			$.each(AreaS[a], function(i, n){
	
				Temp=AreaS[a][i].split(",");
				newItem=new Option(Temp[1]);
				newItem.value = Temp[0];
				document.getElementById("cate_area2").options.add(newItem,i+1);
			
			});
			
		}

	}
	,Cate_Search:function(a){

		
		$('#thema_cate1').slideUp()
		$('#thema_cate2').slideUp()

		var param=$("#Cate_Form").serialize() + "&page="+a;
		var method="POST";
		var url="xml/Cate_Search.php";
		var f="Cate_Search_list";
		var page=1;
		//window.open(url + "?"+param)
		EPSN.search.submit(url,method,param,f,page,"json");
	
	}
	,Cate_Search_list:function(json){
		
		

		
		var inhtml="<div style='padding:2px'></div><table cellpadding=0 cellspacing=0 width=100% style='table-layout:fixed'>";
		inhtml+="<col width=110px align=left>";
		inhtml+="<col width=110px align=left>";
		inhtml+="<col width=120px align=left>";
		inhtml+="<col width=55px align=left>";
		inhtml+="<tr height=1px><td colspan=4 bgcolor=#DBDBDB></td></tr>";

		inhtml+="<tr bgcolor='#F9F9F9' height=25px><td>아이디</td><td>푯말명</td><td>주소</td><td>위치선택</td></tr>";
		inhtml+="<tr height=1px><td colspan=4 bgcolor=#F2F2F2></td></tr>";

		if (json.count == 0)
		{
			inhtml+="<tr><td colspan=4>검색 결과가 없습니다</td></tr>";

		}else{
			//식별코드(PID) 푯말명 주 소 우편번호 위치선택 
			$.each(json.items, function(i,item){
				epid=item.ep_id;
				inhtml+="<tr height=22px>";
				inhtml+="<td align=left><a href=javascript:EPSN.search.search_eposition_view('"+decodeURIComponent(item.ep_id)+"')>"+decodeURIComponent(item.ep_id)+"</a></td>";
				inhtml+="<td align=left><img src='http://open.egosio.com/OUTPUT/IMAGE/COUNTRY/"+item.country+".png'>" + decodeURIComponent(item.ep_name) +"</td>";
				inhtml+="<td align=left>"+decodeURIComponent(item.region)+"</td>";
				inhtml+="<td align=left><a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.px+"','"+item.py+"','"+decodeURIComponent(item.ep_id)+"#"+decodeURIComponent(item.ep_domain)+"','M')>위치선택</a></td>";

				inhtml+="</tr>";
				inhtml+="<tr height=1px><td colspan=4 bgcolor=#DBDBDB></td></tr>";

				//inhtml+= decodeURIComponent(item.ep_id) + "<img src='http://open.egosio.com/img/COUNTRY/"+item.country+".png'>" + " (" + decodeURIComponent(item.ep_name) +") <br>";
			});
			
			
			inhtml+="<tr><td colspan=4>"+ EPSN.search.AllPage( json.total , json.page,"EPSN.search.Cate_Search") +"</td></tr>";

		}
		inhtml+="</table>";
		//alert(inhtml)
		$("#SearchPopupdata").show()
		$("#SearchPopupdata").html(inhtml)











		
	
	}
	,AllPage:function(total,page,func){
		listunit=10;
		pageunit=10;
	/*
	var page=1;

	var listunit=10;
	var pageunit=10;

	totalcnt
	*/	
		
		var totpages = Math.ceil(total/listunit); //총페이지수
		var thisblock = Math.ceil(page/pageunit); //현재 페이징블럭
		var startpage, endpage;
		var ret_HTML = "";
		//ct=document.cform.hcate.value
		
		// 현재 페이지블럭의 시작페이지번호
		if(thisblock > 1){
			startpage = (thisblock-1)*pageunit+1;
		}else{
			startpage = 1;
		}
		
		// 현재 페이지블럭의 끝페이지번호
		if( (thisblock*pageunit) >= totpages ){
			endpage = totpages;
		}else{
			endpage = thisblock*pageunit;
		}
		
		ret_HTML = "<table width=100%><TR>";
		ret_HTML += "  <TD align='center' colspan='5' class='paging_td' >";
		
		if(page > 1){
			ret_HTML += "  <A href='javascript:"+func+"(1);'><img src='img/left_arrow1.gif' align=absmiddle></A>"; 
			
			if (startpage!=1)
			{
				ret_HTML += "  <A href='javascript:"+func+"("+(startpage-1)+");'><img src='img/left_arrow.gif' align=absmiddle></A>"; 

			}


		}



		for(i=startpage; i<=endpage; i++){
			if(i!=page){
				ret_HTML += " <A href='javascript:"+func+"("+i+");'>"+i+"</A>";
			}else{
				ret_HTML += " <B>"+i+"</B>";
			}
		}
		


		if(page != totpages){
			if (i < totpages)
			{
				ret_HTML += "  <A href='javascript:"+func+"("+(i)+");'><img src='img/right_arrow.gif' align=absmiddle></A>"; 

			}
			
			ret_HTML += "  <A href='javascript:"+func+"("+totpages+");'><img src='img/right_arrow1.gif' align=absmiddle></A>"; 
		}

		ret_HTML += "  </TD>";
		ret_HTML += "</TR></table>";
		
		return ret_HTML;

	
	}
	,CatesearchPage:function(total,page,func){
		listunit=10;
		pageunit=10;
	/*
	var page=1;

	var listunit=10;
	var pageunit=10;

	totalcnt
	*/	
		
		var totpages = Math.ceil(total/listunit); //총페이지수
		var thisblock = Math.ceil(page/pageunit); //현재 페이징블럭
		var startpage, endpage;
		var ret_HTML = "";
		//ct=document.cform.hcate.value
		
		// 현재 페이지블럭의 시작페이지번호
		if(thisblock > 1){
			startpage = (thisblock-1)*pageunit+1;
		}else{
			startpage = 1;
		}
		
		// 현재 페이지블럭의 끝페이지번호
		if( (thisblock*pageunit) >= totpages ){
			endpage = totpages;
		}else{
			endpage = thisblock*pageunit;
		}
		
		ret_HTML = "<table width=100%><TR>";
		ret_HTML += "  <TD align='center' colspan='5' class='paging_td' >";
		
		if(page > 1){
			ret_HTML += "  <A href='javascript:EPSN.search.Namesearch(1);'><img src='img/left_arrow1.gif' align=absmiddle></A>"; 
			
			if (startpage!=1)
			{
				ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+(startpage-1)+");'><img src='img/left_arrow.gif' align=absmiddle></A>"; 

			}


		}



		for(i=startpage; i<=endpage; i++){
			if(i!=page){
				ret_HTML += " <A href='javascript:EPSN.search.Namesearch("+i+");'>"+i+"</A>";
			}else{
				ret_HTML += " <B>"+i+"</B>";
			}
		}
		


		if(page != totpages){
			if (i < totpages)
			{
				ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+(i)+");'><img src='img/right_arrow.gif' align=absmiddle></A>"; 

			}
			
			ret_HTML += "  <A href='javascript:EPSN.search.Namesearch("+totpages+");'><img src='img/right_arrow1.gif' align=absmiddle></A>"; 
		}

		ret_HTML += "  </TD>";
		ret_HTML += "</TR></table>";
		
		return ret_HTML;

	
	}
	
}


function Togglediv(a){


	$("#SearchPopupdata").html('')
	
	for (i=1;i<=7 ;i++ ){
		if (i==a){
			$("#search"+i).show("fast");
			
			//$("#atag"+i).css({"font-weight": "bold","border-top":"1px solid #F26522","border-left":"1px solid #F26522","border-right":"1px solid #F26522","border-bottom":"1px solid #FFFFFF","background":"#FFFFFF","padding":"2px","color":"#F26522"})
			
		   $("#atag"+i).attr({ src: "img/Lmenu"+a+"C.gif"});
			//	border-top:1px solid #F26522;border-left:1px solid #F26522;border-right:1px solid #F26522;//$("#atag"+i).addClass("atags_over");
//			$("p:last").addClass("selected");
//atags_over
		}else{
			$("#search"+i).hide();
			  $("#atag"+i).attr({ src: "img/Lmenu"+i+".gif"});

			//$("#atag"+i).css({"font-weight": "normal","border-top":"0px","border-left":"0px","border-right":"0px","border-bottom":"0px","background":"#FFFFFF","padding":"1px","color":"#0066A7"})
			//$("#atag"+i).addClass("atags_out");
			//$("#atag"+i).css({"font-weight": "normal","border":"0px","background":"#FFFFFF","padding":"0px","color":"#0066A7"})

		}
	}
}
