var map;
var mapOB;
var hotelList;
var prefIconList;
var activePrefObj;
var areaid;
var hyodarea="";
var ZOOM_LEVEL_WIDE=7;
var ZOOM_LEVEL_MID=9;
var ZOOM_LEVEL_NARROW=12;
var ZOOM_LEVEL_SMALL=15;
var hClick=new Object();
hClick.onClick=function(_1){
activehObj=_1;
var _2=new Object();
_2.p=parseInt(_1.pref_id);
_2.s=_1.hotel_id;
_2.a=_1.latitude;
_2.o=_1.longitude;
_2.z=map.getZoom();
location.hash=escape(JSON.stringify(_2));
};
var mapIconClick=new Object();
mapIconClick.onClick=function(_3){
viewPref(_3.pref_obj,ZOOM_LEVEL_WIDE);
};
function initError(){
alert("\u8868\u793a\u3067\u304d\u307e\u305b\u3093");
}
function getRandomPrefNum(){
return Math.floor(Math.random()*8+1);
}
function init(){
if(!GBrowserIsCompatible()){
alert("\u6050\u308c\u5165\u308a\u307e\u3059\u304c\u3001\u304a\u5ba2\u69d8\u306e\u30d6\u30e9\u30a6\u30b6\u3067\u306f\u3053\u306e\u30da\u30fc\u30b8\u3092\u6b63\u3057\u304f\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002");
}
mapOB=document.getElementById("map");
map=new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl(new GSize(130,130)));
map.enableContinuousZoom();
map.enableDoubleClickZoom();
GMap2.prototype.wheelZoom=function(_4){
if(_4.cancelable){
_4.preventDefault();
}
if((_4.detail||-_4.wheelDelta)<0){
map.zoomIn();
}else{
map.zoomOut();
}
return false;
};
GEvent.addDomListener(mapOB,"DOMMouseScroll",map.wheelZoom);
GEvent.addDomListener(mapOB,"mousewheel",map.wheelZoom);
document.body.onUnload="GUnload()";
var _5;
if(location.hash!=""){
var lh=unescape(location.hash);
var sd=JSON.parse(lh.substring(1,lh.length));
if(sd){
initPoint=new Object();
initPoint.pref_id=sd.p;
initPoint.account_id=sd.s;
initPoint.latitude=sd.a;
initPoint.longitude=sd.o;
initPoint.zoomLevel=sd.z;
}
}
if(initPoint!=null){
if(initPoint.account_id==null){
initPoint.latitude=prefObj["pref"+initPoint.pref_id].latitude;
initPoint.longitude=prefObj["pref"+initPoint.pref_id].longitude;
_5="pref";
}else{
_5="hotel";
if(initPoint.pref_id==0){
initError();
initPoint.pref_id=getRandomPrefNum();
}
if(parseInt(initPoint.latitude,10)==0||parseInt(initPoint.longitude,10)==0){
initError();
initPoint.latitude=prefObj["pref"+initPoint.pref_id].latitude;
initPoint.longitude=prefObj["pref"+initPoint.pref_id].longitude;
}
}
}else{
initPoint=new Object();
initPoint.pref_id=getRandomPrefNum();
initPoint.latitude=prefObj["pref"+initPoint.pref_id].latitude;
initPoint.longitude=prefObj["pref"+initPoint.pref_id].longitude;
_5="pref";
}
areaid=initPoint.pref_id;
$("hyoarea1").innerHTML="<b>"+prefObj["pref"+initPoint.pref_id].name+"\u5468\u8fba\u306e\u30db\u30c6\u30eb\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059</b>";
var _8;
if(initPoint&&initPoint.zoomLevel){
_8=initPoint.zoomLevel;
}else{
_8=ZOOM_LEVEL_WIDE;
}
map.setCenter(new GLatLng(initPoint.latitude,initPoint.longitude),_8);
GEvent.addListener(map,"moveend",map_onMove);
GEvent.addListener(map,"click",function(_9,_a){
if(!_9){
this.map.closeInfoWindow();
}
}.bind(this));
if(_5=="hotel"){
hotelList=new ChotelList(map,undefined,hClick,initPoint.account_id);
}else{
hotelList=new ChotelList(map,undefined,hClick);
}
var i=1;
prefIconList=new Array();
for(var _c in prefObj){
var _d=new CPrefIcon(map,prefObj[_c],prefNumObj[i]);
_d.addEventListener("click",mapIconClick);
_d.draw();
prefIconList[_c]=_d;
i++;
}
activePrefObj=prefObj["pref"+initPoint.pref_id];
initListView();
map_onMove(true);
if(_5=="pref"){
window.setTimeout(function(){
prefIconList["pref"+initPoint.pref_id].viewInfo();
},200);
}
}
var hotelListView=new Array();
function initListView(){
var _e="";
hotelList.removeAll();
hotelListView=new Array();
$("sidebar").innerHTML=_e;
}
function map_onMove(_f){
var _10="area="+activePrefObj.id;
if(hotelList.initHotelId){
_10+="&code="+hotelList.initHotelId;
}
window.setTimeout(function(){
var _11=new Ajax.Request("js/makers.php",{method:"post",parameters:_10,onSuccess:onLoadhotelList,onFailure:onFailhotelList});
},500);
}
function onLoadhotelList(_12){
var _13=_12.responseText;
if(_13.indexOf("end")==-1){
loadboxm();
var _14=JSON.parse(_13);
var _15=hotelList.registhotelList(_14.array_hotel);
hotelList.redraw();
}
body(areaid);
}
function onFailhotelList(res){
}
function viewPref(_17,_18){
if(!_18){
_18=ZOOM_LEVEL_WIDE;
}
activePrefObj=_17;
var _19=new GLatLng(_17.latitude,_17.longitude);
initListView();
hotelList.removeAll();
mapZoom(_18,_17.longitude,_17.latitude);
window.setTimeout(function(){
prefIconList["pref"+_17.id].viewInfo();
},200);
var _1a=new Object();
_1a.p=parseInt(_17.id);
_1a.s=null;
_1a.a=null;
_1a.o=null;
location.hash=escape(JSON.stringify(_1a));
areaid=_17.id;
body(areaid);
}
function mapZoom(_1b,_1c,_1d){
if(_1b){
areaimage(_1b);
}
window.setTimeout(function(){
if(_1c!=undefined){
map.setCenter(new GLatLng(_1d,_1c),_1b);
}else{
map.setZoom(_1b);
}
},200);
}
function areaimage(_1e){
if(_1e>ZOOM_LEVEL_MID){
document.MImag1.src="Image/parts005-1-1.gif";
document.MImag2.src="Image/parts005-2-1.gif";
document.MImag3.src="Image/parts005-3-2.gif";
}else{
if(_1e>ZOOM_LEVEL_WIDE&&_1e<=ZOOM_LEVEL_MID){
document.MImag1.src="Image/parts005-1-1.gif";
document.MImag2.src="Image/parts005-2-2.gif";
document.MImag3.src="Image/parts005-3-1.gif";
}else{
if(_1e<=ZOOM_LEVEL_WIDE){
document.MImag1.src="Image/parts005-1-2.gif";
document.MImag2.src="Image/parts005-2-1.gif";
document.MImag3.src="Image/parts005-3-1.gif";
}
}
}
}
function hotelCD(_1f,_20,_21,_22){
mapZoom(ZOOM_LEVEL_NARROW,_22,_21);
hotelList.call(_20);
}

