document.observe("dom:loaded",
	function() {
		var imgs = document.getElementsByClassName('ad');
		for( var i=0; i<imgs.length; i++) {
			$(imgs[i]).observe('click',
				function(){
					var sLocation = this.getAttribute("popupTarget");
					var sWidth = this.getAttribute("popupWidth");
					var sHeight = this.getAttribute("popupHeight");
					if( sLocation && sWidth && sHeight ) {
						window.open( sLocation, '', 'width=' + sWidth + ',height=' + sHeight);
					}
					return false;
				}
			);
		}
	}
);
