Edit in JSFiddle

javascript: (function (){
	/* Get Portal site name using delivered getSiteName function */
	var site = getSiteName();

	/* Get current URL */
	var currURL = window.location.href;

	/* Replace site name portion of the current URL to open New Window using regular expression */
	var regEx = new RegExp('\/'+site+'[_\\d+]*\/');
	var newURL = currURL.replace(regEx,'/'+site+'_newwin/');    
	window.open(newURL);
})();