// BanManPro.js - Support code for the BanManPro Ads on a site - reduces code weight by avoiding replication per Ad & sharing for all pages. Download just once!
//
// CONTENTS
// 1. Ad - see Instructions c.
//
// NOTES
// i. Design ensures this script file is loaded before in-line calls can load the ads.
// ii. follow inline call with <noscript> if maximum ad exposure is sought
// iii. Based up BanManPro code option 2 (Advanced JavaScript Code (Recommended) -- Serves rich media ads and defeats cache.  Does not support floating ads, rollover, or moving banner)
//
// HISTORY
// 1.0, 02/07/05, Don Kent. Ready for EGB web launch
// 1.1, 05/07/05, Don Kent. Debug: reset var out!
//
// INSTRUCTIONS
// a. Include this file as asset
// b. Include this script and the test variable e between head tags e.g.
/*
<script language="javascript" src="../assets/BanManPro.js"></script>
<script>var e;</script>
*/
// c. Include container & call at appropriate places in the HTML document e.g.
/*
<div id="Ad1"></div>
<script>function tx(){if(e){Ad(1,1,234,60)}else{setTimeout("tx()",100)}};tx()</script>
*/
//	where:
// - tx - is unique on the page for each ad e.g. t1, t2
// - paramaeter 1 = AdId e.g. 1 - so the <div> element has an id of "Ad1"
// - paramaeter 2 = ZoneID e.g. 1
// - paramaeter 2 = width of Ad e.g. 234
// - paramaeter 3 = height of Ad e.g. 60
// d. Also, if required - see note ii, include the following <noscript>. Manually change ZoneID, width, height and PageID. Probably not worth including this ...
/*
<noscript>
    <a href="http://www.eshophost.net/ad.aspx?ZoneID=1&Task=Click&Mode=HTML&SiteID=1&PageID=93074" target="_new">
    <img src="http://www.eshophost.net/ad.aspx?ZoneID=1&Task=Get&Mode=HTML&SiteID=1&PageID=93074" width="234" height="60" border="0"></a>
</noscript>
*/

// Determine browser characteristics
var browName = navigator.appName;
var browDateTime = (new Date()).getTime();
var browVersion = parseInt(navigator.appVersion);
var ua = navigator.userAgent.toLowerCase();
var adcode=''; // not sure what this is for ... may need to include in function Ad

function Ad (AdId, ZoneID, width, height) {
	var out = "";
	if (browName=='Netscape'){
	     if (browVersion>=5) 
	          { out +='<ifr'+'ame src="http://www.eshophost.net/ad.aspx?ZoneID=' + ZoneID + '&Task=Get&Browser=NETSCAPE6&SiteID=1&X=' + browDateTime + '" width=' + width + ' height=' + height + ' Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No></ifr'+'ame>'; }
	     else if ((browVersion>=4)&&(ua.indexOf("mac")==-1))
	          { out += '<S'+'CRIPT src="http://www.eshophost.net/ad.aspx?ZoneID=' + ZoneID + '&Task=Get&Browser=NETSCAPE4&SiteID=1">';
	          out += '</'+'scr'+'ipt>';
	          out += adcode; }
	     else if (browVersion>=3) 
	          { out += '<A HREF="http://www.eshophost.net/ad.aspx?ZoneID=' + ZoneID + '&Task=Click&Mode=HTML&SiteID=1&PageID=' + browDateTime + '&RandomNumber=' + browDateTime + '" target="_new"><IMG SRC="http://www.eshophost.net/ad.aspx?ZoneID=' + ZoneID + '&Task=Get&Mode=HTML&SiteID=1&PageID=' + browDateTime + '&RandomNumber=' + browDateTime + '" width="' + width + '" height="' + height + '" border="0"></A>'; } }
	else
	     { out += '<ifr'+'ame src="http://www.eshophost.net/ad.aspx?ZoneID=' + ZoneID + '&Task=Get&SiteID=1&X=' + browDateTime + '" width=' + width + ' height=' + height + ' Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No></ifr'+'ame>'; }
	var objAd;
	AdId = "Ad" + AdId;
	if (document.getElementById) {
		objAd = document.getElementById (AdId);
	} else {
		objAd = document.all[AdId];
	}
	objAd.innerHTML = out;
}

// Allow web page code to know when script file has loaded
//setTimeout("e = 1;", 9000);// Debug - simulate long script load
e = 1; // the last statement

