// Cycling Banner Variables
bannerImages = new Array ("images/twf-140.gif","images/gbc-140.gif","images/sheraton-140.gif","images/phytocos-140.gif","images/chiralsep-140.gif","images/cit-140.gif")
bannerURL = new Array ("http://www.tradewithfrance.org/","http://www.askgbc.com/","http://www.sheratonchapelhill.com/","http://www.tradewithfrance.org/icatalog/phytocos.html","http://www.tradewithfrance.org/icatalog/chirosep.html","http://www.tradewithfrance.org/icatalog/cit.html")
thisBanner = 0
bannerCt = bannerImages.length
actionTimer = 0

// Testing to ensure that TWF and GBC banners are skipped when redundant.
function partnerPage_test() {
	   if(thisBanner == 0) {
		 thisBanner++;
	   }
	   if(thisBanner == 1) {
		  thisBanner++;
	   }
}

// Rotation of the Banners
function rotate() {
	   if (document.images) {
            if (document.bannerBox.complete) {
            thisBanner++
	           if (thisBanner == bannerCt) {
	           thisBanner = 0
	           }
			   if (self.location == "http://www.ubizquity.com/partners.html"){
			   partnerPage_test()
			   }
            document.bannerBox.src=bannerImages[thisBanner]
	        }
		  if (thisBanner == 0) {	
	      actionTimer = setTimeout("rotate()", 8 * 1000)
		  }
		  if (thisBanner == 1) {	
	      actionTimer = setTimeout("rotate()", 8 * 1000)
		  }
		  if (thisBanner == 2) {	
	      actionTimer = setTimeout("rotate()", 10 * 1000)
		  }
		  if (thisBanner == 3) {	
	      actionTimer = setTimeout("rotate()", 8 * 1000)
		  }
		  if (thisBanner == 4) {	
	      actionTimer = setTimeout("rotate()", 8 * 1000)
		  }
		  if (thisBanner == 5) {	
	      actionTimer = setTimeout("rotate()", 8 * 1000)
		  }
	   }
}

// Random Selection of First Banner to be Displayed
function chooseBanner() {
	   if (document.images) {
	      // ensuring that TWF and GBC banner do not appear on the Partners page (redundant).
	      if(self.location == "http://www.ubizquity.com/partners.html") {
	      bannerCt = bannerCt - 2
		  randomNum = Math.floor((Math.random() * bannerCt))
		  bannerCt = bannerCt + 2
		  thisBanner = randomNum + 2
		  }
		  else {
		  randomNum = Math.floor((Math.random() * bannerCt))
		  thisBanner = randomNum
		  }
	   document.bannerBox.src=bannerImages[thisBanner]
	   }
	actionTimer=setTimeout('rotate()', 5 * 1000)
}
	
// Ensuring that when the user clicks on Banner, user goes to correct page
// which will be displayed either in the current window or as a pop-up.
function newURL(windowLocation) {
	   if(windowLocation == 'self') {
	   document.location.href = bannerURL[thisBanner]
	   }
	   if(windowLocation == 'pop') {
	   newLocation = bannerURL[thisBanner]
	   centerPopup(newLocation,'popUpWindow','yes','yes','yes','yes','640','400','yes')
	   }
}
/*********************************************************************/