

// Set up namepace
if (!HTML) var HTML = {};

HTML.Popup = function (width, height, features) {
	this.width = width || 300;
	this.height = height || 300;
	this.features = features || 'location=no, statusbar=no, menubar=no';
}

HTML.Popup.VERSION = '0.04';

HTML.Popup.prototype.popup = function(element) {
	var href = element.getAttribute('href');
	var target = element.getAttribute('target') || '_blank';
	window.open (href, target, 
		'width='+ this.width + 
		', height=' + this.height+
		', ' + this.features
		).focus();
	return false;
}


HTML.Popup.prototype.attachToClass = function(classname) {
	var links = document.getElementsByTagName('a');
	var _obj = this;
	 for(l=0;l<links.length;l++){
		if (links[l].className == classname){
			links[l].onclick = function() {return _obj.popup(this); };
		}
	}
}

HTML.Popup.prototype.attachToTarget = function(targetname) {
	var links = document.getElementsByTagName('a');
	var _obj = this;
	 for(l=0;l<links.length;l++){
		if (links[l].getAttribute('target') == targetname){
			links[l].onclick = function() {return _obj.popup(this); };
		}
	}
}

