Not entirely sure how to use urlencode/urldecode, this is the function that i use and just the variables $title and $image, is this that different to what u do?
newWin = null
function opensmall(url) {
if (newWin && newWin.open && !newWin.closed) newWin.close();{
newWin = window.open(url,'newWin','width=400,height=300,top=200,left=100,scrollbars=no,menubar=no,resizable=no,taskbar=no,status=no')
}
}