/* Clean up URL removing unnecessary ../'s from middle of it */ function cleanupurl(url) { var pos,posone,postwo; posone=0; while( (pos=url.indexOf('/../',posone)) > 0 ) { if(url.charAt(pos-1) == '.' ) { posone = pos+4; continue; } postwo = url.lastIndexOf('/',pos-1) if( postwo < 0 ) { url = url.substring(pos+4,url.length); posone=0; continue; } url = url.substring(0,postwo+1) + url.substring(pos+4,url.length); } return(url); }