function pop(url,winWidth, winHeight) {
	if (screen.availWidth) {
		var screenPosX, screenPosY;
		screenPosX = Math.round((screen.availWidth - winWidth) / 2);
		screenPosY = Math.round((screen.availHeight - winHeight) / 2);
		newwindow = window.open(url, 'subwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0, copyhistory=0,width='+winWidth+',height='+winHeight+',left='+screenPosX+',top='+screenPosY+'');    
	} else {
		newwindow = window.open(url, 'subwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0, copyhistory=0,width='+winWidth+',height='+winHeight);
	}
	if (window.focus) {newwindow.focus()}
	return false;
}

window.onload = function () {
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++) {
		if (x[i].getAttribute('class') == 'popup') {
			x[i].onclick = function () {
				return pop(this.href,500,500)
			}
			x[i].title += ' (Popup)';
		}
	}
}
/*
window.addEvent('domready', function() {
	$$('input.add').addEvent('click', function(){
		new Request.HTML({url: '/shop/buildcart/'}).post($('msds-form'));
	});
});
*/