result = (/.*(pt|en)\/(.*)/).exec(document.location.href);
if(result && result.length == 3) {
	$('body').html('');
	if(result[2].match('/')) {
		document.location = document.location.protocol+'//'+document.location.host+'/'+result[1]+'/'+result[2].replace('/', '#');
	} else {
		document.location = document.location.protocol+'//'+document.location.host+'/'+result[1]+'/#'+result[2];
	}
} else {
	$(function(){
		$('body').html('<p style="text-align:center;">loading...</p>');
		$.get('/real_browser.php', function(){
			document.location.reload();
		});
	});
}

