Edit in JSFiddle

var getCSSUrl = function (cssId) {	
	var mainUrl = window.location.href;	
	var parts = mainUrl.match(/ps[pc]\/(.+?)(?:_\d)*?\/(.+?)\/(.+?)\/[chs]\//);	
	return window.location.origin + "/psc/" + parts[1] + "/" + parts[2] + "/" + parts[3] + "/s/WEBLIB_PTBR.ISCRIPT1.FieldFormula.IScript_GET_CSS?ID=" + cssId;
};

var cskLoadCSS = function (path) {   
	var oHead= document.getElementsByTagName('head')[0];    
	var oStyle= document.createElement('link');	
	oStyle.type='text/css';
	oStyle.rel="stylesheet";
	oStyle.href=path;
	oHead.appendChild(oStyle);
};