function Cleanup() {
	CollectGarbage();
}

//////////////////////////////////////////
//Google Mapにマーカーを登録するなどの処理
//////////////////////////////////////////

function geoSearch(shop, lat, lng, location, name, info, phonelist, htmllist, detail, extra, markernum) {

	var point = new GPoint(lng,lat);
	var icon = new GIcon();
	icon.image = "img/marker/"+markernum+"/marker"+counter+".png";
	icon.iconSize = new GSize(22, 34);
	icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
	icon.shadowSize = new GSize(37, 34);
	icon.iconAnchor = new GPoint(10, 34);
	icon.infoWindowAnchor = new GPoint(5, 1);
	var marker = new GMarker(point, icon); 

	//ツールチップとSHOP情報
	marker.tooltip = '<div class="tooltip"><nobr>'+name+'</nobr></div>';
	marker.shop = shop;

	//タブの定義
	//tab3は、1秒待ってから表示することで、スライドショーのバグを吸収する。extrainfocacheにキャッシュ、extrainfoが表示側。
	var tab1 = new GInfoWindowTab( "情報", info );
	var tab2 = new GInfoWindowTab( "詳細", detail  );
	var tab3 = new GInfoWindowTab( "イメージ", '<div id="extrainfo">'+extra+'</div><div id="extrainfocache" style="display:none;">'+extra+'</div>'  );
	var tabs = [tab1, tab2, tab3];

	//フォトもビデオもなければタブを追加しない
	//noimage.pngあり＝イメージなし
	//youtubeあり＝動画有り

	if( (extra.indexOf("noimage.png", 0) < 0) || (extra.indexOf("youtube", 0) >= 0) ){
		//写真か動画がある
		var tabs = [tab1, tab2, tab3];
	}else{
		//写真も動画もない
		var tabs = [tab1, tab2];
	}


	//イベントリスナー
	GEvent.addListener( marker, "click", function() {
		marker.openInfoWindowTabsHtml( tabs, {"maxWidth":400} );
		accesscount(marker.shop);					//カウンター動作
	});

	//ツールチップ
	GEvent.addListener(marker,"mouseover", function() {
		showTooltip(marker);
	});        
	GEvent.addListener(marker,"mouseout", function() {
		tooltip.style.display="none";
	});        


	map.addOverlay(marker, icon);

	var pnt = marker.getPoint();

	
	//dispose
	//手動で解放すると、IE6でバグる
//	if( icon[counter] != null ){
//		icon[counter].image = null;
//		icon[counter].iconSize = null;
//		icon[counter].shadow = null;
//		icon[counter].shadowSize = null;
//		icon[counter].iconAnchor = null;
//		icon[counter].infoWindowAnchor = null;
//		icon[counter] = null;
//		window.setTimeout("Cleanup();",1);
//	}
//
//	gmarkers[counter] = null;
//	infos[counter] = null;
//	details[counter] = null;
//	extras[counter] = null;
//	
//	if( tab[counter] != null ){
//		tab[counter][0] = null;
//		tab[counter][1] = null;
//		tab[counter][2] = null;
//		window.setTimeout("Cleanup();",1);
//	}
//	tab[counter] = null;
//
//	window.setTimeout("Cleanup();",1);

	gmarkers[counter] = marker;
	gmarkersshop[counter] = shop;
	infos[counter] = info;
	details[counter] = detail;
	extras[counter] = extra;
	tab[counter] = tabs;
	icon[counter] = icon;

	//スライドショー
	//IEの場合のみ1秒待ってから表示することで、スライドショーのバグを吸収する
	//IE用対策を入れると、PS3ブラウザでスライドショーが動作しない
	GEvent.addListener(marker, "infowindowopen", function() {
		
		//IEのスライドショーバグ対策
		if(navigator.userAgent.indexOf("MSIE") != -1){ // 文字列に「MSIE」が含まれている場合
			if(document.getElementById("extrainfo")){
				//最初からloading...だと、タブが小さいと認識されてしまうので、一旦読み込み後にloadingにする。
				document.getElementById("extrainfo").innerHTML = 'loading...';
			}

			//タイマーを確実にオフ
			if( extrainfointerval ){
				clearInterval(extrainfointerval);
				extrainfointerval = 0;
			}
			//タイマーをセット
			extrainfointerval = setInterval(function(){
				//1秒後は、InfoWindowが閉じられている可能性があるので、一応確認。(閉じてればなにもしない。タイマーも解除しない)
				if( document.getElementById("extrainfo") ){
					//タイマーをオフ
					if( extrainfointerval ){
						clearInterval(extrainfointerval);
						extrainfointerval = 0;
					}
					document.getElementById("extrainfo").innerHTML = document.getElementById("extrainfocache").innerHTML;
				}
			}
			, 1000);
		}
	});

	//マーカーリスト
	place_list_html +=  "<table><tr><td style='padding:0; vertical-align:top'><a href='javascript:myclick(" + counter + ");' onClick='map.setCenter(new GLatLng("+ pnt.lat() +","+pnt.lng()+"),15);' ><img src='img/marker/"+markernum+"/s_marker"+counter+".jpg'><\/a><\/td><td style='padding:0; vertical-align:top'><a href='javascript:myclick(" + counter + ");' onClick='map.setCenter(new GLatLng("+ pnt.lat() +","+pnt.lng()+"),15)'>&nbsp;&nbsp;" + name + "<\/a>&nbsp;&nbsp;" + phonelist + "<\/td><\/tr><\/table>";

	document.getElementById("place_list").innerHTML = place_list_html;

	//スライドショー用キャッシュ
	tabcache_html += extra;
	document.getElementById("tabcache").innerHTML = tabcache_html;


	count ++;
	counter ++;
	return marker;

}

//////////////////////////////////////////
//マーカーのクリック
//////////////////////////////////////////

function myclick(counter) {
	gmarkers[counter].openInfoWindowTabsHtml(tab[counter]);
	accesscount(gmarkersshop[counter]);					//カウンター動作
}

<!-- ajax initialize lapper -->
function createXmlHttpRequest() {
	var xmlhttp = false;
	if( window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlhttp;
}

<!-- ajax main -->

function peekQueryManage() {
	if( (document.getElementById('ajaxok').value == 1) && (document.getElementById('mapmoving').value != 1) && (document.getElementById('timedragging').value != 1) ){
		peekQuery_execute();
	}
}


//XML読み込み発生時の処理

function XMLonreadystatechange() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//		result.style.display = "block";
//		result.innerHTML = xmlhttp.responseText;		//デバッグ用
//		result.innerHTML = query;		//デバッグ用
//		result.innerHTML = "map.html?type=ajax&kw="+query+"&globallat="+newlat+"&globallng="+newlng+"&globalarea="+newarea+"&currentpage="+currentpage;		//デバッグ用

		//同時実行回避
		document.getElementById('ajaxok').value = 0;
		document.getElementById("loadingicon").innerHTML = '<img src="img/ajax-loader.gif">';

		//すでに登録している内容をリセット
		count =0;
		counter =1;  
		map.clearOverlays();

		//マーカーリストリセット
		place_list_html = "";
		document.getElementById("place_list").innerHTML = place_list_html;

		//スライドショー用キャッシュリセット
		tabcache_html = "";	
		document.getElementById("tabcache").innerHTML = tabcache_html;

		//xmlにパーズ
		xmlData = 				xmlhttp.responseXML;
		shopListTags = 			xmlData.getElementsByTagName("shop");
		shopidListTags =	 	xmlData.getElementsByTagName("shopid");
		latListTags =	 		xmlData.getElementsByTagName("lat");
		lngListTags = 			xmlData.getElementsByTagName("lng");
		locationListTags = 		xmlData.getElementsByTagName("location");
		nameListTags = 			xmlData.getElementsByTagName("name");
		infoListTags = 			xmlData.getElementsByTagName("info");
		phonelistListTags = 	xmlData.getElementsByTagName("phonelist");
		htmllistListTags = 		xmlData.getElementsByTagName("htmllist");
		detailListTags = 		xmlData.getElementsByTagName("detail");
		extraListTags = 		xmlData.getElementsByTagName("extra");
		markernumListTags = 	xmlData.getElementsByTagName("markernum");
		globallatListTags =		xmlData.getElementsByTagName("globallat");
		globallngListTags =		xmlData.getElementsByTagName("globallng");
		zoomListTags =			xmlData.getElementsByTagName("zoom");
		pageListTags =			xmlData.getElementsByTagName("page");
		totalpageListTags =		xmlData.getElementsByTagName("totalpage");
		res_numListTags =		xmlData.getElementsByTagName("res_num");
		pagefromListTags =		xmlData.getElementsByTagName("pagefrom");
		pagetoListTags =		xmlData.getElementsByTagName("pageto");
		prevpagelinkListTags =	xmlData.getElementsByTagName("prevpagelink");
		nextpagelinkListTags =	xmlData.getElementsByTagName("nextpagelink");

		shoplen = shopListTags.length;
//		result.innerHTML = zoomListTags[0].firstChild.nodeValue + globallatListTags[0].firstChild.nodeValue;		//デバッグ用

		// センター調整
		if(zoomListTags[0].firstChild.nodeValue >= 0){
			map.setCenter(new GLatLng(globallatListTags[0].firstChild.nodeValue, globallngListTags[0].firstChild.nodeValue), eval(zoomListTags[0].firstChild.nodeValue));
		}else{
			map.setCenter(new GLatLng(globallatListTags[0].firstChild.nodeValue, globallngListTags[0].firstChild.nodeValue) );
		}

//		result.innerHTML = globallatListTags[0].firstChild.nodeValue;		//デバッグ用

		// shop dataの反映
		for( i=0 ; i<shoplen ; i++ ){
			geoSearch(
				shopidListTags[i].firstChild.nodeValue,
				latListTags[i].firstChild.nodeValue,
				lngListTags[i].firstChild.nodeValue,
				locationListTags[i].firstChild.nodeValue,
				nameListTags[i].firstChild.nodeValue,
				infoListTags[i].firstChild.nodeValue,
				phonelistListTags[i].firstChild.nodeValue,
				htmllistListTags[i].firstChild.nodeValue,
				detailListTags[i].firstChild.nodeValue,
				extraListTags[i].firstChild.nodeValue,
				markernumListTags[i].firstChild.nodeValue
			);
		}

		// ページ関連の反映
		document.getElementById('page').innerHTML			= pageListTags[0].firstChild.nodeValue;
		document.getElementById('totalpage').innerHTML		= totalpageListTags[0].firstChild.nodeValue;
		document.getElementById('res_num').innerHTML		= res_numListTags[0].firstChild.nodeValue;
		document.getElementById('currentpage').value		= pageListTags[0].firstChild.nodeValue;
		document.getElementById('pagefrom').innerHTML		= pagefromListTags[0].firstChild.nodeValue;
		document.getElementById('pageto').innerHTML			= pagetoListTags[0].firstChild.nodeValue;

		document.getElementById('mae').innerHTML			= prevpagelinkListTags[0].firstChild.nodeValue;
		document.getElementById('tsugi').innerHTML			= nextpagelinkListTags[0].firstChild.nodeValue;

		//実行OKにする
		document.getElementById('ajaxok').value = 1;
		document.getElementById('loadingicon').innerHTML = '<img src="img/spacer.png">';
		myinterval = setInterval("peekQueryManage()", 800);

	}

	//AJAXアクセスにエラーが発生した場合
	if (xmlhttp.readyState == 4 && xmlhttp.status != 200) {
		//実行OKにする
		document.getElementById('ajaxok').value = 1;
		document.getElementById('loadingicon').innerHTML = '<img src="img/ajax-error.gif" alt="Network error"><font color="red">Network Error</font>';
		myinterval = setInterval("peekQueryManage()", 800);
	}
}


function peekQuery_execute () {

	if (! xmlhttp) xmlhttp = createXmlHttpRequest();

	if (! xmlhttp || xmlhttp.readyState == 1 || 
			xmlhttp.readyState == 2 || xmlhttp.readyState == 3){
		document.getElementById('ajaxok').value = 1;
		document.getElementById('loadingicon').innerHTML = '<img src="img/spacer.png">';
		return; 
	}

	var result  = document.getElementById("result");			//デバッグ用
	var textbox = document.getElementById('s_keyword');
	var query   = encodeURI(textbox.value);
	if( textbox.value == 'ここに検索キーワード' ){
		query   = '';
	}
	
	var opend = document.getElementById('s_opend').value;
	var openh = document.getElementById('s_openh').value;
	var openm = document.getElementById('s_openm').value;
	var openampm = document.getElementById('s_openampm').value;
	var timerange = document.getElementById('s_timerange').value;
	var openyn = document.getElementById('s_openyn').checked;
	var alldayyn = document.getElementById('s_alldayyn').checked;
	var alltimeyn = document.getElementById('s_alltimeyn').checked;

	//中心位置
	LatLngObj = map.getCenter();
	var newlat  = LatLngObj.lat();
	var newlng  = LatLngObj.lng();

	//指定エリア
	var newarea = document.getElementById('s_area').value;

	//ページ
	var currentpage = document.getElementById('currentpage').value;

	//地図位置変更の理由によって処理をわける
	var b_drag = 0;
	if( (document.getElementById('mapmoving').value==0) && isMoreThanMinDistance(Math.sqrt(Math.pow(oldlat - newlat, 2)+Math.pow(oldlng - newlng, 2))) ){
		oldlat = newlat;
		oldlng = newlng;
	}
	if( (document.getElementById('mapmoving').value==2) && ((oldlat != newlat)||(oldlng != newlng)) ){
		b_drag = 1;
		document.getElementById('mapmoving').value = 0;
	}

	if (
		(oldquery != query)||isMoreThanMinDistance(Math.sqrt(Math.pow(oldlat - newlat, 2)+Math.pow(oldlng - newlng, 2)))||(oldarea != newarea)||(oldpage != currentpage)||
		(oldopend != opend)||(oldopenh != openh)||(oldopenm != openm)||(oldopenampm != openampm)||(oldtimerange != timerange)||(oldopenyn != openyn)||(oldalldayyn != alldayyn)||(oldalltimeyn != alltimeyn)
	) {

		clearInterval(myinterval);
		document.getElementById('ajaxok').value = 0;
		document.getElementById("loadingicon").innerHTML = '<img src="img/ajax-loader.gif">';

//		xmlhttp.open("GET", "map.html?type=ajax&kw="+query+"&globallat="+newlat+"&globallng="+newlng, true);
		xmlhttp.open("GET", "map.html?type=ajax&kw="+query+"&globallat="+newlat+"&globallng="+newlng+"&globalarea="+newarea+"&currentpage="+currentpage
			+"&opend="+opend+"&openh="+openh+"&openm="+openm+"&openampm="+openampm+"&opend="+opend+"&timerange="+timerange+"&openyn="+(openyn?1:0)
			+"&alldayyn="+(alldayyn?1:0)+"&alltimeyn="+(alltimeyn?1:0)
			, true);
		xmlhttp.onreadystatechange = XMLonreadystatechange;
		xmlhttp.send(null)

		//変化を知るため、old変数に現在の値を記憶する
		//地図位置だけは実際にAjax動作があったときのみ更新
		oldlat = newlat;
		oldlng = newlng;

	}

	//変化を知るため、old変数に現在の値を記憶する
	oldquery = query;
	oldarea = newarea;
	oldpage = currentpage;

	oldopend = document.getElementById('s_opend').value;
	oldopenh = document.getElementById('s_openh').value;
	oldopenm = document.getElementById('s_openm').value;
	oldopenampm = document.getElementById('s_openampm').value;
	oldtimerange = document.getElementById('s_timerange').value;
	oldopenyn = document.getElementById('s_openyn').checked;
	oldalldayyn = document.getElementById('s_alldayyn').checked;
	oldalltimeyn = document.getElementById('s_alltimeyn').checked;

}

function nextpage(){
	document.getElementById('currentpage').value++;
}
function prevpage(){
	document.getElementById('currentpage').value--;
}

// チェックボックス全部をオン(check=true)またはオフ(check=false)
function BoxChecked(elements, check){
	if (document.DATA.elements[elements].length) {
		for(var count = 0; count < document.DATA.elements[elements].length; count++){
			document.DATA.elements[elements][count].checked = check;	//チェックボックスをON/OFFにする
		}
	} else {
		document.DATA.elements[elements].checked = check;	//チェックボックスをON/OFFにする
	}
}

// チェックボックスが１つでもオンか？ 戻り値 true/false
function IsBoxChecked(elements){
	if (document.DATA.elements[elements].length) {
		for(var count = 0; count < document.DATA.elements[elements].length; count++){
			if( document.DATA.elements[elements][count].checked ){
				return true;
			}
		}
	} else {
		if( document.DATA.elements[elements].checked ){
			return true;
		}
	}
	return false;
}

function ControlDetailSearch(){
	if(document.getElementById("detailsearch").checked){
		document.getElementById("subcategorysearch").style.display = "inline";
	}else{
//	document.getElementById("subcategorysearch").style.display = "none";
		document.getElementById("subcategorysearch").style.display = "inline";
	}
}


/////////////////////////////
// 画面内のDIVを全体的に調整する。
/////////////////////////////

function adjustdiv(){

	//中心点の記憶
	LatLngObj = map.getCenter();

	//マップ全体がうまく表示されるようにDIVをリサイズ
	document.getElementById("map").style.top = document.getElementById("top").scrollHeight;
	var mapheight  = document.getElementById("map").clientHeight;
	var topheight  = document.getElementById("top").scrollHeight;
	//var bodyheight = document.body.clientHeight;
	var bodyheight	= document.documentElement.clientHeight; ////IEでdocument.body.clientHeightが取れない問題の解決
	if( !bodyheight && window.innerWidth) bodyheight = window.innerWidth; // Mozilla, Opera, NN4

	document.getElementById("map").style.height = (Number(bodyheight)-Number(topheight))+"px";
	document.getElementById("top").style.top = "-"+document.getElementById("top").clientHeight+"px";
	document.getElementById("map").style.top = document.getElementById("top").clientHeight+"px";

	//検索・広告領域のサイズ変更
	if( document.getElementById("ad").style.display != "none" ){
		document.getElementById("search_label").style.width =  document.getElementById("ad").clientWidth + "px";
		document.getElementById("search_and_ad").style.height =  document.getElementById("map").clientHeight - 48 + "px";
	}
	//結果のサイズ変更
	if( document.getElementById("list").style.display != "none" ){
		document.getElementById("result_label").style.width =  document.getElementById("list").clientWidth + "px";
		document.getElementById("place_list").style.height =  document.getElementById("map").clientHeight - 48 + "px";
	}

	map.checkResize();

	//中心点の再設定
	map.setCenter(LatLngObj);

	//時間スライダー
	dragobject.redraw("timeneedleimg");

}



function printjump(shopid, printlat, printlng){

	var printzoom = map.getZoom();

	var url="map.html?type=print&shopid="+shopid+"&globallat="+printlat+"&globallng="+printlng+"&globalzoom="+printzoom+"";

	MM_openBrWindow(url,'','scrollbars=yes,resizable=yes,width=730');

}

//レビューページにジャンプする。
//printzoomを指定すると地図のズームを変えられる
function reviewjump(shopid, printlat, printlng, printzoom){

	//printzoomがない場合はマップの大きさを採用する。
	if( !printzoom){
		var printzoom = map.getZoom();
	}

	var url="map.html?type=review&shopid="+shopid+"&globallat="+printlat+"&globallng="+printlng+"&globalzoom="+printzoom+"";

	MM_openBrWindow(url,'','scrollbars=yes,resizable=yes,width=730');

}

/////////////////////////////
// マーカーのツールチップ関連
/////////////////////////////

// ====== This function displays the tooltip ======
// it can be called from an icon mousover or a side_bar mouseover
function showTooltip(marker) {
	tooltip.innerHTML = marker.tooltip;
	var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom());
	var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
	var anchor=marker.getIcon().iconAnchor;
	var width=marker.getIcon().iconSize.width;
	var height=tooltip.clientHeight;
	var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y -height)); 
	pos.apply(tooltip);
	tooltip.style.display="inline";
}

// ===== This function is invoked when the mouse goes over an entry in the side_bar =====
// It launches the tooltip on the icon      
function mymouseover(i) {
	showTooltip(gmarkers[i])
}
// ===== This function is invoked when the mouse leaves an entry in the side_bar =====
// It hides the tooltip      
function mymouseout() {
	tooltip.style.display="none";
}

/////////////////////////////
// イメージのツールチップ関連
/////////////////////////////
function showImgTooltip(evt, message) {
	imgtooltip.innerHTML = '<div class="tooltip"><nobr>'+message+'</nobr></div>';
    var evtobj=window.event? window.event : evt;
	x = evtobj.clientX;
	y = evtobj.clientY;

	var Mx=x+0;
	var My=y+24;
	imgtooltip.style.left=Mx+"px";
	imgtooltip.style.top=My+"px";
	imgtooltip.style.display="inline";
}
function hideImgTooltip() {
	imgtooltip.style.display="none";
}

/*-----------マウスカーソル位置情報取得----------------*/
/*-----------ツールチップで使用----------------*/
function getMouseEventPos(e) {
	if (is_gecko || is_opera) {
		var values =
			[e.clientX, e.clientY, e.screenX, e.screenY,
			window.pageXOffset, window.pageYOffset, e.pageX, e.pageY,
			window.innerWidth, window.innerHeight, window.outerWidth, window.outerHeight,
			screen.availWidth, screen.availHeight,screen.availLeft, screen.availTop];
	} else if (is_ie) {
		var values =
			[e.clientX, e.clientY, e.screenX, e.screenY,
			(document.body.scrollLeft || document.documentElement.scrollLeft),
			(document.body.scrollTop || document.documentElement.scrollTop),
			e.clientX+(document.body.scrollLeft || document.documentElement.scrollLeft),
			e.clientY+(document.body.scrollTop || document.documentElement.scrollTop),
			document.documentElement.clientWidth, document.documentElement.clientHeight,
			document.body.offsetWidth, document.body.offsetHeight,
			screen.availWidth, screen.availHeight,"", ""];
	} else  var values = new Array(16);
    return values;
}


/////////////////////////////
// 時間のニードル関連(クラス)
/////////////////////////////
var dragobject={
	z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0, currentposition : 0,
	initialize:function(){
		document.onmousedown=this.drag;
		document.onmouseup=this.dragend;
	},
	resetposition:function(elementname){
		//最初の位置に移動する
		obj = document.getElementById(elementname);
		obj.style.left = (document.getElementById("timebar_area").offsetLeft + timeneedle_ImgOffsetPxX + timeneedle_LimitPxLeft)+"px";
		obj.style.top = (document.getElementById("timebar_area").offsetTop + timeneedle_ImgOffsetPxY) +"px";

		//現状の保存
		this.currentposition = 0;
	},
	drag:function(e){
		var evtobj=window.event? window.event : e
		this.targetobj=window.event? event.srcElement : e.target
		if (this.targetobj.className=="timeneedle"){
			document.getElementById('timedragging').value = 1;		//ドラッグ中のAjax停止

			this.dragapproved=1
			if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
			if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
			this.offsetx=parseInt(this.targetobj.style.left)
			this.offsety=parseInt(this.targetobj.style.top)
			this.x=evtobj.clientX + timeneedle_ImgOffsetPxX;		//基準点からのオフセットをここでも指定する必要がある
			this.y=evtobj.clientY + timeneedle_ImgOffsetPxY;
			if (evtobj.preventDefault)
			evtobj.preventDefault()
			document.onmousemove=dragobject.moveit

			//ツールチップは消してしまう
			this.targetobj.onmousemove=null;
			hideImgTooltip();
		}
	},
	jumpit:function(num, elementname){
		var targetelement = document.getElementById(elementname);

		//基準点の取得
		var x_offset = document.getElementById("timebar_area").offsetLeft + timeneedle_ImgOffsetPxX;
		var y_offset = document.getElementById("timebar_area").offsetTop + timeneedle_ImgOffsetPxY;
		
		x = num * timeneedle_UnitPxX + x_offset;

		//左の制限
		if(x < x_offset ){x = x_offset;}
		if(x < x_offset + (timeneedle_MinUnit * timeneedle_UnitPxX) ){x = x_offset + timeneedle_LimitPxLeft;}

		//右の制限
		if(x > x_offset + (timeneedle_MaxUnit * timeneedle_UnitPxX) ){x = x_offset + (49 * timeneedle_UnitPxX);}
		targetelement.style.left = x+"px";

		y = y_offset;
		targetelement.style.top = y+"px";

		//現状の保存
		this.currentposition = num;

	},
	moveit:function(e){
		var evtobj=window.event? window.event : e
		if (this.dragapproved==1){
			var h, m, ampm;

			//基準点の取得
			var x_offset = document.getElementById("timebar_area").offsetLeft + timeneedle_ImgOffsetPxX;
			var y_offset = document.getElementById("timebar_area").offsetTop + timeneedle_ImgOffsetPxY;

			x = ((this.offsetx+(evtobj.clientX-this.x) - x_offset + timeneedle_UnitPxX/2)/timeneedle_UnitPxX|0)*timeneedle_UnitPxX + x_offset;

			//左の制限
			if(x < x_offset ){x = x_offset;}
			if(x < x_offset + (timeneedle_MinUnit * timeneedle_UnitPxX) ){x = x_offset + timeneedle_LimitPxLeft;}

			//右の制限
			if(x > x_offset + (timeneedle_MaxUnit * timeneedle_UnitPxX) ){x = x_offset + (timeneedle_MaxUnit * timeneedle_UnitPxX);}

			this.targetobj.style.left = x+"px";


			//y固定 this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px";
			y = y_offset;
			this.targetobj.style.top = y +"px";

			//今の場所を選択する
			var time = "2400";
			unitsrc = (((x - x_offset) / (timeneedle_UnitPxX * 1.0)|0));		//左から何個目にいるか
			unit = unitsrc;		//調整用に使う

			if( unit >= timeneedle_MinUnit ){
				//5時スタートに調整
				unit += 5 * 2 - timeneedle_MinUnit - 1;		//5は、最初のマスの時間。
				
				//午前0時を先頭に持ってくる
				if( unit >= 48 ){
					unit -= 48;
				}
				
				//24時間制で該当時間を算出
				h = "00" + ((unit/2.0)|0);
				m = "00" + (unit%2.0 > 0 ? "30" : "00");
				h = h.substr(h.length - 2);
				m = m.substr(m.length - 2);

				time = h+m;
				if( time=="2400" ){time="0000";}
			}
			
			settimecondition( time, 60 );


			//////
			//何時か表示

			if( time != "2400" ){
				unit++;

				//午前0時を先頭に持ってくる
				if( unit > 48 ){
					unit -= 49;
				}

				//24時間制で該当時間を算出
				h = "00" + ((unit/2.0)|0);
				m = "00" + (unit%2.0 > 0 ? "30" : "00");
				h = h.substr(h.length - 2);
				m = m.substr(m.length - 2);

				time = h+m;
				if( time=="2400" ){time="0000";}
			}


			//時間と分とAMPMに分解
			h = Number(time.substr(0,2));
			m = Number(time.substr(2,2));
			ampm = (h<12 ? "AM" : "PM" );
			if( h>12 ){ h -= 12; }
			if( h==0 ){ h=12; }
			
			if( time=="2400" ){
				//Allの場合
				showImgTooltip(e,"指定しない");
			}else{
				//時間指定の場合
				//24時間制で該当時間を算出
				m = "00" + (unit%2.0 > 0 ? "30" : "00");
				m = m.substr(m.length - 2);
				showImgTooltip(e,h+":"+m+ampm);
			}

			//現状の保存
			this.currentposition = unitsrc;

			//選択状態反映
			setsearchbarimages();

			return false
		}
	},
	dragend:function(){
		this.dragapproved=0;
		document.getElementById('timedragging').value = 0;		//ドラッグ中のAjax停止解除
		hideImgTooltip();

		//選択状態反映
		setsearchbarimages();
	},
	redraw:function(elementname){
		this.jumpit( this.currentposition, elementname);
	}
}


// 施設の埋め込みページを開く
function openaddwindow(shop){
	window.open("addmap.html?shopid="+shop, "", "scrollbars=yes,resizable=yes,toolbar=no,width=600");
}


///////////////////////////////
// ルート検索
///////////////////////////////
function rootsearch(startaddress, street, city, state, zip, lat, lng){

	var zoom = map.getZoom();
	var address_s = startaddress;
	var address_d = street+", "+city+", "+state+", "+zip;

	//URIエンコーディング
	address_s = escape(address_s);
	address_d = escape(address_d);

	//URLの生成
	var url="http://maps.google.co.jp/maps?f=d&saddr="+address_s+"&daddr="+address_d+"&hl=ja&geocode=&mra=ls&dirflg=r&date=08%2F10%2F02&time=15:54&ttype=dep&noexp=0&noal=0&sort=&sll=&sspn=&ie=UTF8&ll=&spn=&z="+zoom+"&start=0";

	MM_openBrWindow(url,'','scrollbars=yes,resizable=yes,width=800');

}

///////////////////////////////
// 検索ボックス表示・非表示
///////////////////////////////
function search_div_showhide(){

	if( document.getElementById("ad").style.display == "none" ){
		//検索ボックスを表示する
		document.getElementById("ad").style.display = "inline";
		document.getElementById("search_div_button").src = "./img/search_in_on.png";
		document.getElementById("search_label").className = "search_label_out";
		
		adjustdiv();
	}else{
		//検索ボックスを隠す
		document.getElementById("ad").style.display = "none";
		document.getElementById("search_div_button").src = "./img/search_out_on.png";
		document.getElementById("search_label").className = "search_label_in";
	}

	search_result_div_button_sethover();

}

///////////////////////////////
// 結果ボックス表示・非表示
///////////////////////////////
function result_div_showhide(){

	if( document.getElementById("list").style.display == "none" ){
		//結果ボックスを表示する
		document.getElementById("list").style.display = "inline";
		document.getElementById("result_div_button").src = "./img/result_in_on.png";
		document.getElementById("result_label").className = "result_label_out";

		adjustdiv();
	}else{
		//結果ボックスを隠す
		document.getElementById("list").style.display = "none";
		document.getElementById("result_div_button").src = "./img/result_out_on.png";
		document.getElementById("result_label").className = "result_label_in";
	}

	search_result_div_button_sethover();

}

///////////////////////////////
// 検索・結果ボックス表示・非表示に伴う、表示・非表示ボタン変更
///////////////////////////////
function search_result_div_button_sethover(){

	//検索
	targetelement = document.getElementById("search_div_button");

	if( document.getElementById("ad").style.display == "none" ){
		//検索DIV非表示のとき
		targetelement.onmouseover = function(){
			this.src = "./img/search_out_on.png";
		}
		targetelement.onmouseout = function(){
			this.src = "./img/search_out.png";
		}
	}else{
		//検索DIV表示のとき
		targetelement.onmouseover = function(){
			this.src = "./img/search_in_on.png";
		}
		targetelement.onmouseout = function(){
			this.src = "./img/search_in.png";
		}
	}

	//結果
	targetelement = document.getElementById("result_div_button");

	if( document.getElementById("list").style.display == "none" ){
		//検索DIV非表示のとき
		targetelement.onmouseover = function(){
			this.src = "./img/result_out_on.png";
		}
		targetelement.onmouseout = function(){
			this.src = "./img/result_out.png";
		}
	}else{
		//検索DIV表示のとき
		targetelement.onmouseover = function(){
			this.src = "./img/result_in_on.png";
		}
		targetelement.onmouseout = function(){
			this.src = "./img/result_in.png";
		}
	}

}

///////////////////////////////
// 曜日の選択をFormに反映
// parameter: 0-6=Mon-Sun, 7=All
///////////////////////////////
function setdaycondition(day){

	//初期状態なら、All選択状態にリセット。あとは全部Ajax動作になること前提。
	//(携帯やGadgetとの共存のため、デフォルトをこれにしておけないのでここで初期化)
	if( !document.getElementById("s_openyn").checked ){
		document.getElementById("s_alldayyn").checked = true;
		document.getElementById("s_alltimeyn").checked = true;
	}

	//曜日選択
	if( day<7 ){
		document.getElementById("s_opend").value = day;
	}

	//チェックボックス選択
	if( day<7 ){
		document.getElementById("s_openyn").checked = true;
		document.getElementById("s_alldayyn").checked = false;
	}else{
		document.getElementById("s_openyn").checked = true;
		document.getElementById("s_alldayyn").checked = true;
	}

	setsearchbarimages();

}

///////////////////////////////
// 時間の選択をFormに反映
// parameter 1: "0000"-"2350"=0時-23時50分, "2400"=All
// parameter 2: 時間幅、今のところ0か60
///////////////////////////////
function settimecondition(time, timerange){

	//デフォルト値指定
	if( arguments.length < 2 ){
		timerange = 0;
	}

	//初期状態なら、All選択状態にリセット。あとは全部Ajax動作になること前提。
	//(携帯やGadgetとの共存のため、デフォルトをこれにしておけないのでここで初期化)
	if( !document.getElementById("s_openyn").checked ){
		document.getElementById("s_alldayyn").checked = true;
		document.getElementById("s_alltimeyn").checked = true;
	}

	//時間と分とAMPMに分解
	h = Number(time.substr(0,2));
	m = Number(time.substr(2,2));
	ampm = (h<12 ? 0 : 1 );
	if( h>12 ){ h -= 12; }
	if( h==0 ){ h=12; }
	tr = (timerange>0 ? 2 : 0);		//styleの指定によって変わるので注意

	//時間選択
	document.getElementById("s_openh").value = h;
	document.getElementById("s_openm").value = (m==0 ? 0 : 3);
	document.getElementById("s_openampm").value = ampm;
	document.getElementById("s_timerange").value = tr;

	//チェックボックス選択
	if( time<"2400" ){
		document.getElementById("s_openyn").checked = true;
		document.getElementById("s_alltimeyn").checked = false;
	}else{
		document.getElementById("s_openyn").checked = true;
		document.getElementById("s_alltimeyn").checked = true;
	}

	//時間選択によるスライダーへのデザイン変更
	setsearchbarimages();

}

///////////////////////////////
// 曜日と時間の選択をバーに反映
///////////////////////////////

function setsearchbarimages(){

	//時間についてはバーにスライダーを設置する仕様になったので、反映不要となった
	timebar_reflect()

	//リセット(曜日)
	for( i=0 ; i<7 ; i++){
		num = ""+i;
		var targetelement = document.getElementById("bar_day_"+num);
		targetelement.style.background = "url('img/search_bar_day.png')";

		//ホバー画像の指定
		targetelement.onmouseover = function(){
			this.style.background = 'url("img/search_bar_day_hover.png")';
			this.className = "conditionbuttontexthover";
		}
		targetelement.onmouseout = function(){
			this.style.background = 'url("img/search_bar_day.png")';
			this.className = "conditionbuttontext";
		}

	}

	//リセット(全ての曜日)
	document.getElementById("bar_day_7").style.background =	"url('img/search_bar_time.png')";		//すべて選択

	//ホバー画像の指定
	targetelement = document.getElementById("bar_day_7");
	targetelement.onmouseover = function(){
		this.style.background = 'url("img/search_bar_time_hover.png")';
		this.className = "conditionbuttontexthover";
	}
	targetelement.onmouseout = function(){
		this.style.background = 'url("img/search_bar_time.png")';
		this.className = "conditionbuttontext";
	}


	//時間　(すべての時間帯のみ)
	document.getElementById("bar_time_2400").style.background =	"url('img/search_bar_time.png')";

	//ホバー画像の指定
	targetelement = document.getElementById("bar_time_2400");
	targetelement.onmouseover = function(){
		this.style.background = 'url("img/search_bar_time_hover.png")';
		this.className = "conditionbuttontexthover";
	}
	targetelement.onmouseout = function(){
		this.style.background = 'url("img/search_bar_time.png")';
		this.className = "conditionbuttontext";
	}


	//アクティブなものを処理
	if( document.getElementById("s_openyn").checked ){
		if( document.getElementById("s_alldayyn").checked ){
			//曜日検索無効の場合、All
			targetelement = document.getElementById("bar_day_7");
			targetelement.style.background = "url('img/search_bar_time_selected.png')";
			targetelement.onmouseover = function(){
				this.style.background = 'url("img/search_bar_time_selected_hover.png")';
				this.className = "conditionbuttontexthover";
			}
			targetelement.onmouseout = function(){
				this.style.background = 'url("img/search_bar_time_selected.png")';
				this.className = "conditionbuttontext";
			}
		}else{
			//曜日検索有効の場合
			num = document.getElementById("s_opend").value;
			targetelement = document.getElementById("bar_day_"+num);
			targetelement.style.background =	"url('img/search_bar_day_selected.png')";
			targetelement.onmouseover = function(){
				this.style.background = 'url("img/search_bar_day_selected_hover.png")';
				this.className = "conditionbuttontexthover";
			}
			targetelement.onmouseout = function(){
				this.style.background = 'url("img/search_bar_day_selected.png")';
				this.className = "conditionbuttontext";
			}
		}

		if( document.getElementById("s_alltimeyn").checked ){
			//時間検索無効の場合、All
			targetelement = document.getElementById("bar_time_2400");
			targetelement.style.background = "url('img/search_bar_time_selected.png')";
			targetelement.onmouseover = function(){
				this.style.background = 'url("img/search_bar_time_selected_hover.png")';
				this.className = "conditionbuttontexthover";
			}
			targetelement.onmouseout = function(){
				this.style.background = 'url("img/search_bar_time_selected.png")';
				this.className = "conditionbuttontext";
			}
		}else{
			//時間検索有効の場合、スライダーに変化は加えなくて良い
		}
	}else{
		//指定が全くない場合

		//曜日指定なし
		targetelement = document.getElementById("bar_day_7");
		targetelement.style.background = "url('img/search_bar_time_selected.png')";
		targetelement.onmouseover = function(){
			this.style.background = 'url("img/search_bar_time_selected_hover.png")';
			this.className = "conditionbuttontexthover";
		}
		targetelement.onmouseout = function(){
			this.style.background = 'url("img/search_bar_time_selected.png")';
			this.className = "conditionbuttontext";
		}

		//時間指定なし
		targetelement = document.getElementById("bar_time_2400");
		targetelement.style.background = "url('img/search_bar_time_selected.png')";
		targetelement.onmouseover = function(){
			this.style.background = 'url("img/search_bar_time_selected_hover.png")';
			this.className = "conditionbuttontexthover";
		}
		targetelement.onmouseout = function(){
			this.style.background = 'url("img/search_bar_time_selected.png")';
			this.className = "conditionbuttontext";
		}
	}

}

///////////////////////////////
//時間指定バーのクリック
//ページ読み込み時は変数初期化のあたりで実行すると、IEが正常に動作しないので最後のほうで呼び出すこと。
///////////////////////////////

function timebar_click(evt){
    var evtobj=window.event? window.event : evt;
	var x = evtobj.clientX;
	var y = evtobj.clientY;

	timebar_click_timecondition = [
		"2400",	"2400",
		"0430",	"0500",	"0530",	"0600",	"0630",	"0700",	"0730",	"0800",	"0830",	"0900",	"0930",	"1000",
		"1030",	"1100",	"1130",	"1200",	"1230",	"1300",	"1330",	"1400",	"1430",	"1500",	"1530",	"1600",
		"1630",	"1700",	"1730",	"1800",	"1830",	"1900",	"1930",	"2000",	"2030",	"2100",	"2130",	"2200",
		"2230",	"2300",	"2330",	"0000",	"0030",	"0100",	"0130",	"0200",	"0230",	"0300",	"0330",	"0400"
	];

	//どの部分をクリックしたか知る
	x = x - document.getElementById("timebar_area").offsetLeft - timeneedle_ImgOffsetPxX;
	x = (x-(timeneedle_UnitPxX/2.0)|0)/(timeneedle_UnitPxX*1.0)|0;

	//All の処理
	if( x<timeneedle_MinUnit ){ x=0; }
	if( x>timeneedle_MaxUnit ){ x=timeneedle_MaxUnit; }

	//スライダーを移動
	dragobject.jumpit( x, "timeneedleimg");

	//時間条件を反映
	settimecondition(timebar_click_timecondition[x], 60);
}

///////////////////////////////
//時間指定のスライダーへの反映
//現在、前後30分の指定幅を前提としている
///////////////////////////////

function timebar_reflect(){

	timebar_timecondition_to_x = {
		't2400' : 0,
		't0430' : 2,
		't0500' : 3,
		't0530' : 4,
		't0600' : 5,
		't0630' : 6,
		't0700' : 7,
		't0730' : 8,
		't0800' : 9,
		't0830' : 10,
		't0900' : 11,
		't0930' : 12,
		't1000' : 13,
		't1030' : 14,
		't1100' : 15,
		't1130' : 16,
		't1200' : 17,
		't1230' : 18,
		't1300' : 19,
		't1330' : 20,
		't1400' : 21,
		't1430' : 22,
		't1500' : 23,
		't1530' : 24,
		't1600' : 25,
		't1630' : 26,
		't1700' : 27,
		't1730' : 28,
		't1800' : 29,
		't1830' : 30,
		't1900' : 31,
		't1930' : 32,
		't2000' : 33,
		't2030' : 34,
		't2100' : 35,
		't2130' : 36,
		't2200' : 37,
		't2230' : 38,
		't2300' : 39,
		't2330' : 40,
		't0000' : 41,
		't0030' : 42,
		't0100' : 43,
		't0130' : 44,
		't0200' : 45,
		't0230' : 46,
		't0300' : 47,
		't0330' : 48,
		't0400' : 49
		};

	//指定時間から24時間で取得
	h = document.getElementById("s_openh").value;
	h = (h==12 ? 0 : h );
	m = document.getElementById("s_openm").value * 10;		//選択肢が10分ずつの前提。０と３０しか期待していない
	ampm = document.getElementById("s_openampm").value;		//0 am  1 pm
	tr = document.getElementById("s_timerange").value;			//時間レンジは0か60のどちらかであることを期待している
	h = "00" + (ampm==0 ? h : Number(h)+12);
	h = h.substr(h.length - 2);
	m = "00" + m;
	m = m.substr(m.length - 2);

	//未選択の場合
	if( !document.getElementById("s_openyn").checked || document.getElementById("s_alltimeyn").checked ){
		h = "24";
		m = "00";
	}

	//スライダーを移動
	dragobject.jumpit( timebar_timecondition_to_x[ "t" + h + m ], "timeneedleimg");
}

///////////////////////////////
//検索条件リセット。Ajax対象のみ。時間と曜日は無視。
//(携帯やGadgetとの共存のため、デフォルトをこれにしておけないのでここで初期化)
//ページ読み込み時は変数初期化のあたりで実行すると、IEが正常に動作しないので最後のほうで呼び出すこと。
///////////////////////////////

function resetcondition(){

	document.getElementById("s_alldayyn").checked = false;
	document.getElementById("s_alltimeyn").checked = false;
	document.getElementById("s_openyn").checked = false;
	document.getElementById("s_keyword").value = "ここに検索キーワード";
	document.getElementById("s_area").value = 0;
	document.getElementById("s_timerange").value = 2;	//60分

}


///////////////////////////////
//アクセスカウンター動作
//(店舗のカウンターを呼び出す)
//引数：shop番号
///////////////////////////////

function accesscount(shop){
	document.getElementById("accesscounter").innerHTML = '<img src="counter.html?shop=' + shop + '">';
}


