<!--  AD rotator script written entirely in JavaScript  -->
<!--  Written by WenWei, 2002/03/03. E-mail: wenwei@blueidea.com  -->
<!--  ASP 2 JS Written by panliu888, 2004/08/10. E-mail: phx@blueidea.com  -->
<!--  Member Of Blueidea Web Team. -->
<!--  Welcome to www.blueidea.com. -->

// AD Banner object
function ADBanner(){
	this.htmlcode  = "";// Non image banner's html code
	this.href      = "";// Link's href attrib
	this.imgsrc    = "";// Image's src attrib
	this.imgwidth  = "";// Image's width attrib
	this.imgheight = "";// Image's height attrib
	this.imgalt    = "";// Image's alt attrib
	this.imgborder = "";// Image's border attrib
	this.weight    = 1;// Banner's show weight
	this.place     = 1// Banner's place
	this.type      = 1;// Banner's type
}

// Make Banner objects array
function CreatBanners(aBanners, aNum){
	for( var i=0; i<aNum; i++ ){
	    aBanners[i] = new ADBanner();
	}
}

// Show banner
function showbanner(aPlace, aType, aBannerID){
	var amount = ADBanners.length;
	var includeList = new Array(amount);
	
	if (!document.usedBanners){
		document.usedBanners = new Array(amount);
		for (var i=0; i<amount; i++)
			document.usedBanners[i] = -1;
	}
 
	var usedList = document.usedBanners;

	if (arguments.length == 1){
		var j = 0;
		var sum = 0;
		for(var i=0; i<amount; i++){
			if (ADBanners[i].place == aPlace){	// && ADBanners[i].type == aType
				if (usedList[i] != i){
					includeList[j] = i;
					j++;
					sum = sum + ADBanners[i].weight;
				}
			}
		}
		if (sum <= 0)	return;
	  
		var rndNum = Math.round(Math.random() * sum);
		i = 0;
		j = 0;
		while (true) {
			j = j + ADBanners[includeList[i]].weight;
			if (j >= rndNum)	break;
			i++;
		}
		
		i = includeList[i];
	} else {
		if (aBannerID >= 0 && aBannerID < amount)
			i = aBannerID;
		else
			return;
	}

	usedList[i] = i;

	if (ADBanners[i].htmlcode == "")
		document.write('<A HREF="'+ ADBanners[i].href +'" target=_blank><IMG SRC="'+ ADBanners[i].imgsrc +'" WIDTH="'+ ADBanners[i].imgwidth +'" HEIGHT="'+ ADBanners[i].imgheight +'" ALT="'+ ADBanners[i].imgalt +'" BORDER="'+ ADBanners[i].imgborder +'"></A>');
	else
		document.write(ADBanners[i].htmlcode);
}

var ADBanners = new Array();

CreatBanners(ADBanners, 5);
ADBanners[0].imgsrc    = "/ad/s_1.jpg";
ADBanners[0].href      = "http://";
ADBanners[0].imgwidth  = "180";
ADBanners[0].imgheight = "156";
ADBanners[0].imgalt    = "说明";
ADBanners[0].weight    = 20;
ADBanners[0].place     = 1;
ADBanners[0].type      = 1;

ADBanners[1].imgsrc    = "/ad/2.jpg";
ADBanners[1].href      = "http://";
ADBanners[1].imgwidth  = "180";
ADBanners[1].imgheight = "118";
ADBanners[1].imgalt    = "说明";
ADBanners[1].weight    = 20;
ADBanners[1].place     = 1;
ADBanners[1].type      = 1;

ADBanners[2].imgsrc    = "/ad/s_3.jpg";
ADBanners[2].href      = "http://";
ADBanners[2].imgwidth  = "180";
ADBanners[2].imgheight = "126";
ADBanners[2].imgalt    = "说明";
ADBanners[2].weight    = 30;
ADBanners[2].place     = 1;
ADBanners[2].type      = 1;

ADBanners[3].imgsrc    = "/ad/blood019.gif";
ADBanners[3].href      = "http://";
ADBanners[3].imgwidth  = "180";
ADBanners[3].imgheight = "246";
ADBanners[3].imgalt    = "说明";
ADBanners[3].weight    = 50;
ADBanners[3].place     = 1;
ADBanners[3].type      = 1;

ADBanners[4].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="182">  <param name="movie" value="http://www.czxz.org.cn/ad/%u53E3%u53F7.swf">  <param name="quality" value="high">  <embed src="http://www.czxz.org.cn/ad/%u53E3%u53F7.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="182"></embed></object>';
ADBanners[4].weight    = 50;
ADBanners[4].place     = 2;
ADBanners[4].type      = 2;

