//////////////////////////////////////////////////////////////////////////////////////////////
// SAVE THIS TEXT AS A FILE IN S-INCLUDES CALLED 'TheGpc'-Ads.js, example: LaxNws-Ads.js
// Then include the file in the document you want to call ads in
// Like this: <script SRC="/S-Includes/LaxNws-Ads.js"></script>

//////////////////////////////////////////////////////////////////////////////////////////////
// THIS SETS UP A RANDOM NUMBER EXACTLY 15 DIGITS LONG
//
var now = new Date();
var jvSeed = Math.random() * now.valueOf() * 100000;
jvSeed = jvSeed.toString().substr(0, 15);

///////////////////////////////////////////////////////////////////////////////////////////////
// THIS FINDS THE URL FOR THE ADS
//
var jvPURL = document.domain

//////////////////////////////////////////////////////////////////////////////////////////////
// THIS SETS THE KEYWORD VALUES FOR ALL THE ADS to the same string CONSTANT...
//
//var TheKey = 'sec1=bus;sec2=sto;sec3=hig;';

//////////////////////////////////////////////////////////////////////////////////////////////
// THIS builds KEYWORD VALUES dynamically from the URL...
//
var TheKey = '';
var keys = document.URL.split('/');
var KeyConstant = 3;
var intY = KeyConstant + 1;
var intX = keys.length;
while (intY < intX)
{
	// this produces "TheKey", a series of keyword values, from the URL
	// if the URL is: "http:www.dailynews.com/business/stocks/highmovers.html"
	// then TheKey = "sec1=sto;sec2=hig"
	TheKey = TheKey + 'sec' + (intY - KeyConstant) + '=' + keys[intY].substr(0,3) + ';';
	intY++;
}

//////////////////////////////////////////////////////////////////////////////////////////////
// THIS JUST RESETS THE 'BOTTOMINCLUDE' VARIABLE TO NOTHING FOR EACH PAGE REQUEST...
//
var BottomInclude = '';

//////////////////////////////////////////////////////////////////////////////////////////////
//      YOU CALL THE 'AD-MAKING-FUNCTION' LIKE THIS:
//     <SCRIPT>GetAd(2, 'r2', 120, 90, '/entry');</SCRIPT>
//
function GetAd(TheTile, ThePosition, TheWidth, TheHeight, ThePath)
{	
	//////////////////////////////////////////////////////////////////////////////////////////
	//
	// this part puts together each ad
	//
	var ThePath = jvPURL + ThePath;
	document.write('<TABLE><TR><TD>');
	document.write('<NOLAYER>');
	document.write('<IFRAME SRC="http://ad.doubleclick.net/adi/' + ThePath + ';pos=' + ThePosition + ';');
	document.write(TheKey + 'sz=' + TheWidth + 'x' + TheHeight + ';');
	document.write('tile=' + TheTile + ';ord=' + jvSeed + '?" width="' + TheWidth + '"');
	document.write(' height="' + TheHeight + '" frameborder="no"');
	document.write(' border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">');
	document.write('<A HREF="http://ad.doubleclick.net/jump/');
	document.write(ThePath + ';pos=' + ThePosition + ';' + TheKey + ';');
	document.write('sz=' + TheWidth + 'x' + TheHeight + ';tile=' + TheTile + ';ord=' + jvSeed + '?">');
	document.write('<IMG SRC="http://ad.doubleclick.net/ad/');
	document.write(ThePath + ';pos=' + ThePosition + ';' + TheKey + ';');
	document.write('sz=' + TheWidth + 'x' + TheHeight + ';tile=' + TheTile + ';ord=' + jvSeed + '?"');
	document.write(' border=0 height="' + TheHeight + '" width="' + TheWidth + '"></A>');
	document.write('</IFRAME>');
	document.write('</NOLAYER>');
	document.write('<ILAYER ID="layer' + TheTile + '"');
	document.write(' visibility="hidden" width=' + TheWidth + ' height=' + TheHeight + '></ILAYER>');
	document.write('</TD></TR></TABLE>');
	//////////////////////////////////////////////////////////////////////////////////////
	//
	// this part puts together the bottom include(s)
	// to make the layers work in netscape:
	//
	BottomInclude = BottomInclude + '<LAYER SRC="http://ad.doubleclick.net/adl/';
	BottomInclude = BottomInclude + ThePath + ';pos=' + ThePosition + ';';
	BottomInclude = BottomInclude + TheKey + 'sz=' + TheWidth + 'x' + TheHeight + ';';
	BottomInclude = BottomInclude + 'tile=' + TheTile + ';ord=' + jvSeed + '?"';
	BottomInclude = BottomInclude + ' width=' + TheWidth + ' height=' + TheHeight;
	BottomInclude = BottomInclude + ' visibility="hidden"';
	BottomInclude = BottomInclude + ' onLoad="moveToAbsolute(';
	BottomInclude = BottomInclude + 'layer' + TheTile + '.pageX,layer' + TheTile + '.pageY);';
	BottomInclude = BottomInclude + 'clip.height=' + TheHeight + ';clip.width=' + TheWidth + ';';
	BottomInclude = BottomInclude + " visibility='show';";
	BottomInclude = BottomInclude + '"></LAYER>';
}

////////////////////////////////////////////////////////////////////////////////////////
//      YOU CALL THE NETSCAPE LAYERS INCLUDE AT THE END LIKE THIS:
//     <SCRIPT>NetscapeAds();</SCRIPT>
//
function NetscapeAds()
{
	document.write(BottomInclude);
}