
function popUp( url, name, title, width, height, query ) {
	if( query && typeof( query ) == 'string' ) {
		url += query;
	} else if( query && typeof( query ) == 'object' ) {
		url += '?q';
		for( var cParam in query ) {
			var cVal = query[ cParam ];
			url += '&amp;' + cParam + '=' + cVal;
		}
	}
	

	width = width ? width : 625;
	height = height ? height : 780;

	var posX = Math.round( (screen.availWidth - width)/2 );
	var posY = Math.round( (screen.availHeight - height)/2 );
	
	name = name.replace(/-/gi, '_'); //replace '-' with '_' character in name
	
	var args = 'left=' + posX + ',top=' + posY+',width=' + width + ',height=' + height + ',toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=no,titlebar=no';
	var hWin = window.open(url, name, args);
	return false;
}

$(function() {

	$('a.popup').click(
		function( ev ) {
			if( window.event ) {
				window.event.returnValue = false;
			} else {
				ev.preventDefault();
			}
			
			popUp( $(this).attr('href'), $(this).attr('name'), $(this).attr('title') );
		}
	);
});
