$(function (){
	$('a.confirm').click(function (){
		var msg = $(this).attr('title');
		if (!msg){msg = 'Delete record';}
		return confirm(msg+'?');
	});
	$('.popup').click(function (){
		pop(this.href, {center: true, width: 800});
		return false;
	});
});

function pop(url, props){
	if (!props){props = {};}
	var target = (props['target']) ? props['target'] : '_blank';
	var features = [];
	features['status'] = 1;
	features['toolbar'] = (props['toolbar']) ? props['toolbar'] : 0;
	features['resizable'] = (props['resizable']) ? props['resizable'] : 1;
	features['scrollbars'] = (props['scrollbars']) ? props['scrollbars'] : 1;
	if (props['width']){features['width'] = props['width'];}
	if (props['height']){features['height'] = props['height'];}
	if (props['top']){features['top'] = props['top'];}
	if (props['left']){features['left'] = props['left'];}
	
	if (props['center']){
		if (!features['width']){features['width'] = Math.floor(screen.width/2);}
		if (!features['height']){features['height'] = Math.floor(screen.height/2);}
		features['left'] = Math.floor((screen.width-features['width'])/2);
		features['top'] = Math.floor((screen.height-features['height'])/2);
	}
	
	var s_features = [];
	for (feature in features){
		s_features[s_features.length] = feature+'='+features[feature];
	}
	var win = window.open(url, target, s_features.join(','));
	if (win){win.focus();return true;}
	return false;
}