function Park(object) {
	if (!object.longitude || !object.latitude || !object.name) {
		return;
	}
	this.longitude = parseInt(object.longitude);
	this.latitude = parseInt(object.latitude);
	if (object.id) this.id = object.id;
	this.name = object.name;
	if ( object.distance ) {
		this.distance = object.distance;
	}
	this.prefecture = object.prefecture;
	this.address = object.address;
	this.degree = object.degree;
}

Park.prototype.roundDegree = function() {
	/*
	15 ~ 45 => 30
	45 ~ 75 => 60
	75 ~ 105 => 90
	105 ~ 135 => 120
	135 ~ 165 => 150
	165 ~ 195 => 180
	195 ~ 225 => 210
	225 ~ 255 => 240
	255 ~ 285 => 270
	285 ~ 315 => 300
	315 ~ 345 => 330
	345 ~ 15 => 0
	*/
	var target_degree = (parseInt((parseInt(this.degree) + 15) / 30) * 30) % 360;
	return target_degree;
};

Park.prototype.degreeIndex = function() {
	var degree = this.roundDegree();
	var index = degree / 30;
	return index;
};

Park.prototype.createArrowImg = function() {
	var park = this;
	var a = new Element("a", {href: ""});
	a.onclick = function() {
		oMap.Scroll(park.longitude, park.latitude);
		return false;
	};
	var index = this.degreeIndex();
	var img = new Element("img", {src: config.arrow.directory + config.arrow.images[index]});
	a.update(img);
	return(a);
};

Park.prototype.isTentative = function() {
	return(this.id ? false : true);
};

Park.prototype.setPointTentatively = function(longitude, latitude) {
	this.longitude = longitude;
	this.latitude = latitude;
};

Park.prototype.getName = function() {
	return this.name;
}

Park.prototype.setNameTentatively = function(name) {
	this.name = name;
}

Park.prototype.getLongitude = function() {
	return this.longitude;
};

Park.prototype.getLatitude = function() {
	return this.latitude;
};

Park.prototype.setLongitudeTentatively = function(longitude) {
	this.longitude = longitude;
};

Park.prototype.setLatitudeTentatively = function(latitude) {
	this.latitude = latitude;
};

Park.prototype.setPoint = function(longitude, latitude, options) {
	var park = this;
	if (!park.id) return;
	var url = config.query.url + "/data/" + park.id + "/point/" + longitude + "/" + latitude + "/";
	new Ajax.Request(url, {
		onSuccess: function() { alert("succeeded"); }
	});
	park.longitude = longitude;
	park.latitude = latitude;
	if (options) {
		if (options.reportLongitude) {
			var element = typeof options.reportLongitude == "string" ? $(options.reportLongitude) : options.reportLongitude;
			element.update(longitude);
		}
		if (options.reportLatitude) {
			var element = typeof options.reportLatitude == "string" ? $(options.reportLatitude) : options.reportLatitude;
			element.update(latitude);
		}
	}
};

