function make_url(u){
	if(u.substr(0,location.protocol.length)!=location.protocol && u.substr(0,jsCLIENT_DROOT.length)!=jsCLIENT_DROOT){
		u=jsCLIENT_DROOT+u;
	}
	return u;
}

function openWindow(u,n,f,r){
	return window.open(make_url(u),n,f,r);
}

function setlocationHref(u){
	location.href=make_url(u);
}

function makeStyles(){
	if(document.styleSheets){
		var U=location.protocol+'//'+location.host;
		var u=U+'/';
		var i,j,l,d='',m,M;
		for(i=0;i<document.styleSheets.length;i++){
			if(!document.styleSheets[i].href || document.styleSheets[i].href.substr(0,u.length)!=u){
				continue;
			}
			if(document.styleSheets[i].rules){
				l=document.styleSheets[i].rules.length;
			}else{
				l=document.styleSheets[i].cssRules.length;
			}
			for(j=0;j<l;j++){
				m=document.styleSheets[i].rules?document.styleSheets[i].rules[j].style.backgroundImage:document.styleSheets[i].cssRules[j].style.backgroundImage;
				if(m && m.split('url(').length>1){
					m=m.split('url(').join('').split(')').join('').split('"').join('').split("'").join('');
					while(m.substr(0,3)=='../'){
						m=m.substr(3);
					}
					if(m.substr(0,1)=='/'){
						m=m.substr(1);
					}
					if(m.substr(0,u.length)!=u){
						if(document.styleSheets[i].rules){
							document.styleSheets[i].rules[j].style.backgroundImage='url("'+U+jsCLIENT_DROOT+m+'")';
						}else{
							document.styleSheets[i].cssRules[j].style.backgroundImage='url("'+U+jsCLIENT_DROOT+m+'")';
						}
					}
				}
			}
		}
	}
}

