// cbpetfoodandsupplies.com javascript file

function menuOver(id, sil, bg) {
	var menuid	= id+"menu";
	//document.getElementById( menuid ).src = "images/btn/"+id+"-btn-over.gif";
	document.getElementById( menuid ).style.color="#000000";

	if( sil==true ) {
		var silid = id+"sil";
		//document.getElementById( silid ).src = "images/sil/"+id+"-sil-active.gif";
		document.getElementById( silid ).style.backgroundPosition = bg;
	}
}

function menuOut(id, sil, bg) {
	var menuid	= id+"menu";
	//document.getElementById( menuid ).src = "images/btn/"+id+"-btn-out.gif";
	document.getElementById( menuid ).style.color="#FFFFFF";

	if( sil==true ) {
		var silid = id+"sil";
		//document.getElementById( silid ).src = "images/sil/"+id+"-sil-out.gif";
		document.getElementById( silid ).style.backgroundPosition = bg;
	}
}

/****
* Banner Ad Rotater v3.02
* Anarchos > anarchos3@hotmail.com
* http://anarchos.xs.mw/bannerad.phtml
**/

function Banner(refreshTime, width, height, altText, start, random){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
	if (!width) this.width = 776; else this.width = width;
	if (!height) this.height = 150; else this.height = height;
	if (random == null) this.random = 1; else this.random = random;
	this.altText = altText;
	this.ads = [];
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target) {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
		if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
		ad.href = href;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self"){
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_new"){
			open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.randomAd = function(){
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while(n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 1){
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			this.nextAd();
		} else {
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
		    tempCode = '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
		    tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" />';
			document.getElementById("cbheaderslider").innerHTML=tempCode;
		    //document.write(tempCode);
		}
	}

	this.newAd = function(){
		if (!this.random){	
			this.currentAd++;
			if (this.currentAd >= this.mySize)
			   this.currentAd = 0;
		}
		else {
			this.randomAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		var tempCode = "";
		if (this.ads[this.currentAd].href != null) {
			tempCode = '<a href="' + this.ads[this.currentAd].href + '"';
			tempCode += ' target="' + this.ads[this.currentAd].target + '"';
			tempCode += ' id="' + this.objName + 'link">';
		}
		tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
		tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
		if (this.altText) tempCode += 'alt="'+this.altText + '" ';
		tempCode += 'border="0" />';
		if (this.ads[this.currentAd].href != null) tempCode += '</a>';
		document.getElementById("cbheaderslider").innerHTML=tempCode;
		setTimeout(this.objName+'.newAd()',this.refreshTime);
	}
}
Banner.count = 0;
