// Get the path aka: URL
var paththis = location.pathname;

// Creates an array where each element is the
// different values between "/" in the URL
subdir = paththis.split("/");

// Get the length of the array and subtract 2
// to get to the proper element that stores the
// folder name aka: affiliate #
temp = subdir.length
temp -= 2;

// Set afk as the folder name
var afk=subdir[temp];

// The below calls the usual <script src='../generated/js/######.js'> call in the html pages
var afkURL = "../generated/js/" + afk + ".js";

document.write( "\<SCRIPT" );
document.write( '   LANGUAGE="JavaScript"' );
document.write( "   SRC='" + afkURL + "'" );
document.write( "\>" );
document.write( "\</SCRIPT\>" );