var b1=new Banner("matrixprice","/vwweb/VWPINNACLE/images/header/ads/bd_rx4_430x56-matrix.gif","http://www.rxclub.ca/index1.html","_blank","2","01-01-3000","4", "0","0","1","1","0","1","1" );
var b2=new Banner("prodspecs","/vwweb/VWPINNACLE/images/header/ads/bd_rx3_430x56-product_specs_statique.gif","http://www.rxclub.ca/indexs.html ","_blank","2","01-01-3000","4", "0","0","1","1","0","1","1" );

var colBanners = new Array(b1,b2);

var adBanners; var thisAd = 0;
var AddPage = "Default";
var UrlForNetscape;
var gvHTTP = "http";
var SessionUId = "";
var sRoot = "http://www.visionweb.com/";
var pagecode = "";

function Banner(name,img,url,target,timer,expDate, weight,def,home,news,ce,ishop,account,order){
	this.name = name;
	this.img=img;
	this.url=url;
	this.target=target;
	this.timer=timer;
	this.expDate=expDate;
	this.weight=weight;
	this.DEF = def;
	this.HOME=home;
	this.NEWS= news;
	this.CECME= ce;
	this.ISHOP=ishop;
	this.ACCNT = account;
	this.ORDER=order;
}

function pageBanners( pgCode){
  var aBanners = new Array();
  var index = 0;
	for(  i=0;i< colBanners.length; i++){
	var ban = eval("colBanners[i]."+pgCode);
		if( ban == "1"){
					weight = colBanners[i].weight;
					if( weight !=""){
							nWeight = parseInt(weight);
						  for( j=0; j<nWeight; j++){
								aBanners [index] = colBanners[i];
								index++;
							}
					}
		}
	}
	return aBanners;
}

function rotate(pagecode1)
{
	pagecode = pagecode1;
	if( pagecode==""){pagecode= "DEF";}
   adBanners = pageBanners(pagecode);
   UrlForNetscape = "";
   var imgCt = adBanners.length;
   if(imgCt > 0){
			if (eval("document.images"))
			{
				//random numbers...........................
				thisAd = rand(imgCt-1);
				eval("document.adBanner").src=adBanners[thisAd].img;
				if (adBanners[thisAd].url == "")
				{
					UrlForNetscape = "#top";
				}
				else {
				 var bName = adBanners[thisAd].name;
				if( bName =='visionweb'){
					UrlForNetscape = adBanners[thisAd].url;
				}else{
					UrlForNetscape = "/banner/banner.jsp?URL="+adBanners[thisAd].url+"&BAN="+bName;
				}
						 }

			}
			 var time= adBanners[thisAd].timer;
			 setTimeout("rotate(pagecode)", Number(time) * 1000);
    } // imgCt check
}
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
  rnd.seed = (rnd.seed*9301+49297) % 233280;
  return rnd.seed/(233280.0);
}

function rand(number) {
    return Math.ceil(rnd()*number);
}

function netscape_href()
{
	if(UrlForNetscape != ""){
		if(UrlForNetscape != "#top"){
			//alert(UrlForNetscape);
			if (gvHTTP == "http") {
				window.open(UrlForNetscape,"banner");
			}
			else {
				if (UrlForNetscape != "#top") {
					document.location.href = UrlForNetscape;
				}
			}
		}
	}
}
