function NIV_getRelativePath(origen, destino) {

    var destinoPath = destino.split("/");	

	var origenInitial = 0;
	var destinoInitial = 0;

    var i;

    for (i = 0; (i < origen.length) && (i < destinoPath.length); i++) {
        if (origen[i] != destino[i]) {
            break;
        } else {
	origenInitial++;
	destinoInitial++;
        }
    }

    var ret = "";

    for (i = origenInitial+1; i < origen.length; i++) {
        ret += "../";
    }

    for (i = destinoInitial; i < destinoPath.length; i++) {
        if (i > destinoInitial) {
            ret += "/";
        }
        ret += destinoPath[i];
    }
	
    return ret;
}

function isDOMHTML() {
	return typeof(document.getElementsByTagName) != 'undefined' && typeof(document.createElement) != 'undefined' && typeof(document.getElementById) != 'undefined';
}
