if(get_cookie('isSpb')!=null){
	var c = get_cookie('isSpb');
	var loca=document.location.href;	

	loca=loca.replace(/^http:\/\/hosting.rbc.ru/, 'http://hc.ru');
	loca=loca.replace(/^http:\/\/www.hosting.rbc.ru/, 'http://hc.ru');

	var str=loca.replace(/^https/, 'http').substr(7,3);
	//loca=loca.replace(/^http:\/\/www.hc.ru/, 'http://hc.ru');
	if(c=='true'){
		if(str!='spb' && str!='tes'){
			loca = loca.replace(/^http:\/\/hc/, 'http://spb.hc').replace(/^https:\/\/hc/, 'https://spb.hc');
			loca = loca.replace(/^http:\/\/www\.hc/, 'http://spb.hc').replace(/^https:\/\/www\.hc/, 'https://spb.hc');
			document.location.href=loca;
			window.status = loca;
		}
	} else if(c=='false'){
		if(str=='spb' && str!='tes'){
			document.location.href=loca.replace(/^http:\/\/spb\./, 'http://www.').replace(/^https:\/\/spb\./, 'https://www.');
			window.status = loca;
		}else if(str!='spb' && str!='www'){
			document.location.href=loca.replace(/^http:\/\/hc/, 'http://www\.hc').replace(/^https:\/\/hc/, 'https://www\.hc');
			window.status = loca;
		}
	
	}
}else{
	var loca=document.location.href.replace(/^http:\/\/hc/, 'http://www\.hc').replace(/^https:\/\/hc/, 'https://www\.hc');	
	if(loca != document.location.href)
		document.location.href=loca;
}

