	function Search_Store() {
		var el = document.getElementById("search_store");

		if(trim(el.value) == "" || trim(el.value) == "장소 검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		document.location.href = "/town/store.search.php?search_keyword=" + encodeURIComponent(el.value);
	}

	function Search_Soribada() {
		var el = document.getElementById("search_soribada");

		if(trim(el.value) == "" || trim(el.value) == "소리바다 곡검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		document.location.href = "/town/soribada.search.php?town_id=1001&search_keyword=" + encodeURIComponent(el.value);
	}

	function Search_Youtube() {
		var el = document.getElementById("search_youtube");

		if(trim(el.value) == "" || trim(el.value) == "유튜브 검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		location.href = "/town/youtube.search.php?town_id=1002&search_keyword=" + encodeURIComponent(el.value);
	}
    function Search_DaumBook()
    {
		var el = document.getElementById("search_daumbook");
       
		if(trim(el.value) == "" || trim(el.value) == "책 검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		location.href = "/town/daumbook.search.php?town_id=1004&search_keyword=" + encodeURIComponent(el.value);
        
	}
	function Search_Town()
    {
		var el = document.getElementById("search_town");
       
		if(trim(el.value) == "" || trim(el.value) == "장소 검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		
		location.href = "/town/town.search.php?town_id=1004&search_keyword=" + encodeURIComponent(el.value);
        
	}
	function Search_DaumShopping()
	{
		var el = document.getElementById("search_daumshopping");
       
		if(trim(el.value) == "" || trim(el.value) == "상품 검색") {
			alert("검색어를 입력해 주세요.");
			return;
		}
		
		location.href = "/town/daum.shop.search.php?town_id=1005&search_keyword=" + encodeURIComponent(el.value);

	}
	function PageMusicChart(town_id, page, total_count)
	{
		CallAjax("../town/soribada.chart.ajax.php?town_id=" + town_id + "&page=" + page + "&total_count=" + total_count, "DisplayMusicChart(responseText)");
	}

	function DisplayMusicChart(text)
	{
		var target = document.getElementById("chart_music");
		target.innerHTML = text;
	}

	function ListMovie(page)
	{        
		CallAjax("../town/youtube.hot.ajax.php?page=" + page, "DisplayView(responseText)");
	}

	function DisplayView(text)
	{
		 var target = document.getElementById("list_movie");
		 target.innerHTML = text;
	}
	function blind()
	{
		 alert("비공개 영상입니다.");
		 false;
	}
	function ListGame(page)
	{        
		CallAjax("../town/game.hot.ajax.php?page=" + page, "DisplayViewGame(responseText)");

	}
	function DisplayViewGame(text)
	{
		 var target = document.getElementById("list_game");
		 target.innerHTML = text;
	}

function commify(n) {
  var reg = /(^[+-]?\d+)(\d{3})/;   // 정규식
  n += '';									   // 숫자를 문자열로 변환

  while (reg.test(n))
    n = n.replace(reg, '$1' + ',' + '$2');

  return n;
}

function ShowGameRanking(store_id,page)
{			
	CallAjax("/store/game.ranking.list.ajax.php?store_id="+store_id+"&page="+page, "DisplayGameRanking(responseText)");
}

function DisplayGameRanking(text)
{
	var target = document.getElementById("div_ranking");
	target.innerHTML = text;
}

function PageSoribadaBookmarker(town_id, user_id, page, type)
{
	CallAjax("/town/bookmark.store.list.ajax.php?page=" + page+ "&town_id="+ town_id+ "&user_id="+ user_id+"&type="+type, "DisplaySoribadaBookmarker(responseText)");
}

function DisplaySoribadaBookmarker(text)
{ 
	 var target = document.getElementById("bookmark_list");
	 target.innerHTML = text;
}

function PageYouTubeBookmarker(town_id, user_id, page, type)
{
	CallAjax("/town/bookmark.store.list.ajax.php?page=" + page+ "&town_id="+ town_id+ "&user_id="+ user_id+"&type="+type, "DisplayYouTubeBookmarker(responseText)");
}

function DisplayYouTubeBookmarker(text)
{
	 var target = document.getElementById("bookmark_list");
	 target.innerHTML = text;
}

function SearchResultContent(page,town_id,keyword)
{      
	  CallAjax("/inc/search.result.ajax.php?page=" + page+ "&town_id="+town_id+"&keyword="+encodeURIComponent(keyword),"DisplayResultContent(responseText)");
			 
}
function DisplayResultContent(text)
{
	  var target = document.getElementById("result_content");
	  target.innerHTML = text;
}

function SearchUnregistMusic(page,keyword)
{      			     
 CallAjax("/inc/unregist.music.ajax.php?page=" + page+ "&keyword="+encodeURIComponent(keyword),"DisplaySearchUnregistMusic(responseText)");

}
function DisplaySearchUnregistMusic(text)
{
 var target = document.getElementById("unregist_music");
 target.innerHTML = text;
}

function SearchUnregistSinger(page,keyword)
{      
 
 CallAjax("/inc/search.result.singer.ajax.php?page=" + page+ "&keyword="+encodeURIComponent(keyword),"DisplaySearchUnregistSinger(responseText)");

}
function DisplaySearchUnregistSinger(text)
{
 var target = document.getElementById("result_singer");
 target.innerHTML = text;
}

function SearchUnregistTown(page,keyword)
 {      

	  CallAjax("/inc/unregist.town.ajax.php?page=" + page+ "&keyword="+encodeURIComponent(keyword),"DisplaySearchUnregistTown(responseText)");

 }
function DisplaySearchUnregistTown(text)
 {
	  var target = document.getElementById("unregist_town");
	  target.innerHTML = text;
 }

 function ShowStoreMap(e,mapx,mapy)
{
	var browser = navigator.appName;
    if(browser=="Microsoft Internet Explorer")
	{
        var x=event.x;
		var y=event.y;
	}else{
        var x=e.clientX;
		var y=e.clientY;
	}

	var width = 390;
	var height = 340;
	//var x = 870;
	//var y = 280;
	//var html = "<p><iframe src=\"store.map.php\" width=\"" + width + "\" height=\"" + height + "\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\"  scrolling=\"no\"  frameborder=\"0\"></iframe></p>";
    var html = "<p><iframe src=\"/town/store.map.php?mapx="+mapx+"&mapy="+mapy+"\" width=\"" + width + "\" height=\"" + height + "\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\"  scrolling=\"no\"  frameborder=\"0\"></iframe></p>";
	
	var div = document.getElementById("popup");
	
	div.style.left = x-width;
	div.style.top = y;	
	div.style.width = width;
	div.style.height = height;
	
	//div.style.align = "center";
	div.innerHTML = html;
	div.style.display = "block";		
}
//////////////////////////외부연동//////////////////////////////
//-->
function twitterlogin()
{
	window.open('/twitter/twitter/start.php','', "width=760, height=360, scrollbars=no, resizable=no,location=no");
}
function twitter()
{
	window.open('../twitter/twitter/start.php','', "width=760, height=360, scrollbars=no, resizable=no,location=no");
}
function facebook()
{//
	window.open("../facebook/start.php",'', "width=800 height=500 scrollbars=no, resizable=no,location=no");
	
}
function twitterDisconn()
{
	if(confirm("정말 연결을 끊으시겠습니까?"))
	{
		
         document.location="twitter.disconnect.php?user_id="+user_id;
		 return false;
	}
}
function facebookDisconn()
{
	if(confirm("정말 연결을 끊으시겠습니까?"))
	{
		 
         document.location="facebook.disconnect.php?user_id="+user_id;
		 return false;
		 
	}
}
function me2day()
{ 
	window.open('../me2day/start.php','', "width=560, height=450, resizable=no,scrollbars=no,menubar=no,status=no,titlebar=no,toolbar=no location=no");
}
function me2daylogin()
{ 
	window.open('../me2day/start.php','', "width=560, height=450, resizable=no,scrollbars=no,menubar=no,status=no,titlebar=no,toolbar=no location=no");
}
function me2dayDisconn()
{
	if(confirm("정말 연결을 끊으시겠습니까?"))
	{
		
         document.location="me2day.disconnect.php?user_id="+user_id;
		 return false;
	}
}