/*
 * gslweb_main.js
 *
 * www.gslweb.de
 *
 */

/**
 * Return the file name part of a pathname (a string which consists 
 * of path parts and a file name). Handles file: protocol with \ path 
 * separator, slash else.
 * Example: getFileName( location.pathname )
 * gsl 2003-10-09
 */
function /* String */ getFileName( /* String */ pathName ) {
	alert( "gslweb.getFileName: pathName=" + pathName );
	if ( !pathName ) return "";
	if ( !location ) alert( "gslweb.getFileName: no location!" );
	if ( location.protocol == "file:" ) {
		separator = '\\';
	}
	else {
		separator = '/';
	}
	alert( "gslweb.getFileName: separator=" + separator );
	lastSlash = pathName.lastIndexOf( separator );
	alert( "gslweb.getFileName: lastSlash=" + lastSlash );
	// -1 needs no separate handling!
	return pathName.substring( lastSlash + 1 );
}

function /* String */ getBaseName( /* String */ fileName ) {
	if ( !fileName ) return "";
	lastDot = fileName.lastIndexOf( '.' );
	// -1 needs no separate handling!
	return fileName.substring( 0, lastDot );
}


