doBanner()  
		
function doBanner() {
//*--------------------------------------------------------
//* Display banner image. First pic is random, next pics rotate.
//* Last image filename displayed is saved in a cookie.
//*-------------------------------------------------------- 
	var p=new Array(); 	//* Pic records
	var ix = -1;  

//*------------------------------------ 
//*  PLACE BANNER INFO IN ARRAY.  
//*------------------------------------
//* Rec format: Expiry date yyyy-mm-dd | banner image | url	|

//*	p[ix = ix + 1] = "2099-12-31|vp-advertise-468x60.gif|redirect.asp?l=1wuKI&e=999|";
	p[ix = ix + 1] = "2099-07-31|mapadoc-banner.gif|redirect.asp?l=1wvgy&e=246|";
	p[ix = ix + 1] = "2010-08-31|banyancommerce-468x60.gif|redirect.asp?l=1wvwN&e=381|";
	p[ix = ix + 1] = "2010-08-31|dis-banner-468x60.gif|redirect.asp?l=1wD4q&e=051|";

//*------------------------------------ 
//*  DONT TOUCH ANYTHING BELOW HERE.
//*------------------------------------	                         
	var w 	= "468";
	var h	= "60";

	var hs	= "0";  //* Horizontal space
	var vs	= "0";  //* Vertical space
	var border = "0";
	var pic	= "vp-advertise-468x60.gif";    //* Default pic 
	var url	= "advertising.asp";  	//* Default url 	
 
	var picdir = "../banners/"	
	var p_array = new Object();  //p record is split into this array
	
	sCurDate = new Date();
	sCurDate = sCurDate.format("isoDate"); 				//* YYYY-MM-DD	(These date rtn are in utils.js	
 
	var pcount =  p.length  // no. of array elments
// 	alert("pcount=" + pcount );

	var picindex = getCookie("banner");   //* GET COOKIE
// 	alert("0 picindex=" + picindex );

//* get random pic the first time	
  	if (picindex == null || picindex == "NaN" || picindex == "") {
  		picindex = get_random(pcount); 
  	}
  	
 	picindex = parseInt(picindex);  // Converts string to a number
 
 	var iy = picindex + 1;
 	if (iy >= pcount) {iy = 0}; 
 
//*---------------------------------- 
//* Bypass banners with expired dates.
//*----------------------------------  	
	ipic = iy;	
	for (i=0; i=pcount; i++)
	{
		p_array=p[ipic].split("|");  //* Split the record into an array
		expdate  = p_array[0];
		if (sCurDate <= expdate ) {
			//* OK, Not expired, jump out of loop.
			iy = ipic;
			break;
		}
		ipic++;
		if (ipic >= pcount) {ipic = 0};
	} 	//* END FOR LOOP 	
 
 	setCookie("banner", iy);  //* SAVE COOKIE
	
	p_array=p[iy].split("|");  //* Split the record into an array
	pic  = p_array[1];  
	url  = p_array[2];   
	
// 	alert("picindex=" + picindex + " iy=" + iy + " " );
//*---------------------------------------------------------
//* FORMAT the HTML
//*---------------------------------------------------------  

	sTarget = "_blank";  //* Default target - opens new window

//* if url contains this specific string, the page is within the site so don't open new window
	if (url.indexOf('c=38688&i=143559') > -1 ) {		
		sTarget = "_self";
	}
 

theBanner = '<a href="' + url + '" target="' + sTarget + '">' + 
	   		 '<img src="' + picdir +  pic +  '" border="' + border + '></a>';
	
document.write(theBanner);				
 
} //* end doBanner()


 