function urlEncode(txt) {
	return txt.replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
}
function rpc(url) {
	top.RPC.document.location.href=urlEncode(url)
}
function lconfirm(question,url) {
	if (confirm(question)) {
		location.href=url
	}
}
function wopen(url) {
	function handleError(e) {
		if (e.indexOf('denied')>1) {
			prompt('Sorry the security of your browser does not allow to redirect to a local or network file. Please copy the link (Ctrl+C) and paste (Ctrl+V) it in some browser (even this one).',url)
		}
	}
	window.onerror=handleError
	open(url,'','')
	window.onerror=null
}

function switchDisplay(elementId,menuElementId) {
	if (document.getElementById(elementId).style.display=='list-item') {
		document.getElementById(elementId).style.display='none'
		document.getElementById(menuElementId).className='collapsed'
	} else {
		document.getElementById(elementId).style.display='list-item'
		document.getElementById(menuElementId).className='expanded'
	}
}

