
function mapZoom(){

	map.setZoom(17);

}


function MarkerInfo(lat,lon,number,name,image,copy,desc,accessdata,price,sitelink,tinyaddress,tid) {
	this.point=new GLatLng(parseFloat(lat),parseFloat(lon));
	this.number=number;
	this.name=name;
	this.image=image;
	this.copy=copy;
	this.desc=desc;
	this.accessdata=accessdata;
	this.price=price;
	this.sitelink=sitelink;
	this.tinyaddress=tinyaddress;
	this.tid=tid;
}

MarkerInfo.prototype.getHtml=MarkerInfo_getHtml;

function MarkerInfo_getHtml(showDate,showTime,showLocation,showHeight,imageLoaded) {


	if(this.number == 51){
	
		var html;
	
		html='<div class="marker_mini">';
		
		if(this.url!=''){
		
			html+='<div><a href="'+this.url+'" target="_blank"><strong>'+this.name+'</strong></a></div>';
			html+='<div class="window_coment">'+this.image+'</div>';
			html+='</div>';
		
		}else{
		
			html+='<div class="marker_subject"><strong>'+this.name+'</strong></div>';
			html+='<div class="window_coment">'+this.image+'</div>';
			html+='</div>';
	
		}
	
	
	}else{
	
	var html;

	html='<div class="marker">';
	html+='<div class="marker_subject"><a href="http://hotel-ryokan.accessgate.jp/detail/'+this.tid+'.html">'+this.name+'</a></div>';
	html+='<table width="300"><tr><td colspan="2">';

	if (this.copy!='') {
		html+='<div class="window_copy">'+this.copy+'</div></td></tr>';
	}
	
	html+='<tr><td width="130" valign="top">';
	
	if (this.image!='' && imageLoaded) {
		html+='<div class="marker_image"><img src="'+this.image+'" width="120"></div></td><td valign="top">';
	}
	
	if (this.desc!='') {
		html+='<div class="window_coment">';
	}
	
	if (this.desc!='') {
		html+=''+this.desc+'</div>';
	}
	
	html+='</td></tr><tr><td colspan="2" width="300">';
	
	if (this.sitelink!='') {
		html+='<div class="window_ttitle">予約・申込可能サイト</div><div class="window_tbody">'+this.sitelink+'</div>';
	}
		
	if (this.price!='') {
		html+='<div class="window_access">'+this.price+'</div>';
	}
	
	html+='</td></tr>';
	
	if (this.detail!='') {
		html+='</table><div class="marker_url"><a href="http://hotel-ryokan.accessgate.jp/detail/'+this.tid+'.html">'+this.name+'の詳細</a></div>';
	}
	
	html+='<a onMouseDown="mapZoom()" class="link"><img src="http://hotel-ryokan.accessgate.jp/image/menu_window/zoom2.gif" align="absmiddle" hspace="2" border="0" alt="ズーム・拡大"></a>';
	html+='<a onMouseDown="setck(\'' + this.tid + '\',\'' + this.name + '\',\'' + this.tinyaddress + '\')" class="link">';
	html+='<img src="../image/menu_window/add_mylist2.gif" vspace="3" hspace="3" alt="マイリストに追加"></a>';
	html+='</div>';
	
	}
	

	return html;
}

function createMarker(markerInfo,showDate,showTime,showLocation,showHeight) {

	var icon = new GIcon(baseIcon);
	icon.image = "http://hotel-ryokan.accessgate.jp/image/maps/icon/" + markerInfo.number + ".png";
	var marker=new GMarker(markerInfo.point,icon);

	GEvent.addListener(marker,'click',function() {
		if (markerInfo.image!='') {
			var image=new Image();
			image.src=markerInfo.image;
			if (image.complete) {
				marker.openInfoWindowHtml(markerInfo.getHtml(showDate,showTime,showLocation,showHeight,true));
			}
			else {
				image.onload=function() {
					marker.openInfoWindowHtml(markerInfo.getHtml(showDate,showTime,showLocation,showHeight,true));
				}
				image.onerror=function() {
					marker.openInfoWindowHtml(markerInfo.getHtml(showDate,showTime,showLocation,showHeight,false));
				}
			}
		}
		else {
			marker.openInfoWindowHtml(markerInfo.getHtml(showDate,showTime,showLocation,showHeight,false));
		}
	});

	return marker;
}



function popupMarker(num) {
	GEvent.trigger(markers[num],'click');
}

function getBrowser() {
	var agent=navigator.userAgent;

	if (agent.indexOf('Safari')>=0) {
		return 'Safari';
	}
	else if (agent.indexOf('Opera')>=0) {
		return 'Opera';
	}
	else if (agent.indexOf('Gecko')>=0) {
		return 'Mozilla';
	}
	else if (agent.indexOf('MSIE')>=0) {
		return 'MSIE';
	}
	else {
		return 'other';
	}
}

function handleKeyEvents(e) {
	var browser=getBrowser();
	var keycode;
	var level;

	if (browser=='MSIE') {
		keycode=event.keyCode;
	}
	else {
		keycode=e.which;
	}

	switch (keycode) {
		case 27:
			map.closeInfoWindow();
			break;
		case 33:
			map.zoomIn();
			break;
		case 34:
			map.zoomOut();
			break;
		case 35:
			if (points.length>0) {
				map.panTo(points[points.length-1]);
			}
			break;
		case 36:
			if (points.length>0) {
				map.panTo(points[0]);
			}
			break;
		case 37:
			map.panDirection(1,0);
			break;
		case 38:
			map.panDirection(0,1);
			break;
		case 39:
			map.panDirection(-1,0);
			break;
		case 40:
			map.panDirection(0,-1);
			break;
		default:
			break;
	}
}

	function centercheck(){
		
		center = map.getCenter();
		var zoomleverl = map.getZoom();
		
		switch(zoomleverl) {
			
			case 5:
			case 6:
			Yzoomleverl = 10;
			break;
			
			case 7:
			case 8:
			Yzoomleverl = 9;
			break;
			
			case 9:
			Yzoomleverl = 8;
			break;
			
			case 10:
			Yzoomleverl = 7;
			break;

			case 11:
			Yzoomleverl = 6;
			break;
			
			case 12:
			Yzoomleverl = 5;
			break;
			
			case 13:
			case 14:
			Yzoomleverl = 4;
			break;
			
			case 15:
			case 16:
			Yzoomleverl = 3;
			break;
			
			case 17:
			Yzoomleverl = 2;
			break;
			
			case 18:
			case 19:
			Yzoomleverl = 9;
			break;
			
			default:
			Yzoomleverl = 11;
		
		}
			
		
		
		var bookurlhtml = '<a href="http://hotel-ryokan.accessgate.jp/freemap/?lat='+ center.y +'&lon='+ center.x +'&sc=' + Yzoomleverl + '">フリースクロールマップ検索に切替え</a>';
		
		document.getElementById("bookurl").innerHTML = bookurlhtml;
		
	}


