var ad_num = 0;
var img = '';
var spn = document.getElementById('spnRotate');
var cnt = 0;
var valid = true;
var href = '';

function adArray() {
	for (i=0; i*3<adArray.arguments.length; i++) {
		this[i] = new Object();
		this[i].src = adArray.arguments[i*3];
		this[i].href = adArray.arguments[i*3+1];
		this[i].height = adArray.arguments[i*3+2];
	}
	this.length = i;
}

function getAdNum() {
	ad_num=Math.floor(Math.random()*ads.length);
	return ad_num;
}

function rotateSponsor() {
	if (document.images && valid) {
		img='';
		cnt += 1;
		ad_num = getAdNum();
		//alert('Adnum: ' + ad_num + '\nCnt: ' + cnt)
	
		href= ads[ad_num].href;
		href = href.replace('~',':');

		img = '<IMG SRC="'+ads[ad_num].src+'" HEIGHT="'+ads[ad_num].height+'" BORDER=0 name=js_ad onmouseover="valid=false;" onmouseout="valid=true;delayRotateSponsor();">';
		
		if(ads[ad_num].href!=''){
			img = '<A HREF="'+ href +'" TARGET=_blank>' + img + '</A>';
		}
		spn.innerHTML=img;
		if (cnt < 25){
			delayRotateSponsor();
		}
	}
}

function delayRotateSponsor() {
	setTimeout('rotateSponsor()',5000);
}		