// prototype.js is required

var LinkToFeaturesPopup = Class.create();
LinkToFeaturesPopup.prototype = {
	initialize: function() {
		var elements = document.getElementsByClassName("link-to-features");
		for (var i = 0; i < elements.length; ++i) {
			Event.observe(elements[i], 'click', this.onClick.bindAsEventListener(this));
		}
	},
	onClick: function(event) {
		var href = Event.element(event).getAttribute('href');
		var w = Math.floor(screen.width * 0.95);
		w = 600 < w ? 600 : w;
		var h = Math.floor(screen.height * 0.95);
		h = 550 < h ? 550 : h;
		var params = "left=16,top=16,width=" + w + ",height=" + h + ",menubar=no,toolbar=no,scrollbars=yes";
		window.open(href, "g10features", params).focus();
		Event.stop(event);
	}
};
Event.observe(window, 'load', function() {
	new LinkToFeaturesPopup();
});
