Podrias a yudarme con esta funcion, lo que pasa es que no entiendo que es lo que hace o para que me puede servir, si pudieras ayudandome comentandola o que me digas que es lo que hace o algo.
 
Telo agradeceria muchisimo........
la funcion es la siguiente:
 
 
function getBaseUrl() {
  igual=1;
  docpath=location.pathname;
  x=docpath.indexOf(stofind);
  for (i=0; i< stofind.length; i++) {
    if (docpath.substring(x+i,x+i+1) == stofind.substring(i,i+1)) { x=x;
    } else {
      baseurl=defaulturl;
      if (docpath.substring(0,baseurl.length) == baseurl) {
        docpath=docpath.substring(baseurl.length,docpath.l  ength);
      }
      return;
    }
  }
  docpath=docpath.substring(x+stofind.length,documen  t.location.pathname.length);
  docname=docpath;
  stofind="/";
  x=docname.indexOf(stofind);
  if (x<0) { 
     stofind="\\";
     x=docname.indexOf(stofind);
  }
  docname=docname.substring(x+1, docname.length);
  baseurl="";
  x=docname.indexOf(stofind);
  while (x >= 0) {
    docname=docname.substring(x+1, docname.length);
    baseurl= baseurl + "../";
    x=docname.indexOf(stofind);
  }
//  alert(baseurl + ' ' + docname + ' ' + docpath);
} 
   
 

