<!-- // setup onload
//OnLoad += "rotateBradco();";
var currentCycle = 0;
var currentImage = 0;

function rotateBradco() {
	if ($('bradcoContainer')) {
		var pNodes = getElementsByClass('productNode', $('bradcoContainer'), 'SPAN');
		for (var x = 0; x < pNodes.length; x++) {
			pNodes[x].innerHTML = eval("group" + (x+1) + "item" + currentCycle);
			//alert(eval("group" + (x+1) + "item" + currentCycle));
		}
		currentCycle++;
		setTimeout("rotateBradCoImage()", 2000);
	}
	return true;
}

function rotateBradCoImage() {
	// if the image is at 8 then set it to 0
	if (currentImage == 8) { currentCycle++; currentImage = 0; }
	if (currentCycle == 2) { currentCycle = 0; }
	
	var pNodes = getElementsByClass('productNode', $('bradcoContainer'), 'SPAN');
	pNodes[currentImage].innerHTML = eval("group" + (currentImage+1) + "item" + currentCycle);
	currentImage++;
	
	setTimeout("rotateBradCoImage()", 2000);
	return true;
}


// setup fade to color and paths to the images
var fadebgcolor = "#fff";
var fadearray = new Array(); // array to cache fadeshow instances
var fadeclear = new Array(); // array to cache corresponding clearinterval pointers
var dom = (document.getElementById); // modern dom browsers
var iebrowser = document.all;

// this is the class function
// Eg: new fadeshow(fadeimages, 500,330, 0, 3000, 1, "R");
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, interval, delay, pause, displayorder) {
	
	// init the fadeshow obj properties
	this.theimages = theimages;
	this.imageborder = parseInt(borderwidth);
	this.delay = delay;
	this.interval = interval;
	this.pausecheck = pause;
	this.degree = 0; // initial opacity degree
	this.mouseovercheck = 0;
	this.curimageindex = 0;
	this.nextimageindex = 1;

	fadearray[fadearray.length] = this;
	this.slideshowid = fadearray.length - 1;
	this.canvasbase = "canvas" + this.slideshowid;
	this.curcanvas = this.canvasbase + "_0";
	if (typeof displayorder != "undefined") { theimages.sort(function() { return 0.5 - Math.random(); }); }
	var fadewidth = fadewidth + this.imageborder * 2;
	var fadeheight = fadeheight + this.imageborder * 2;
	
	// preload images
	this.postimages = new Array();
	for (var p = 0; p < theimages.length; p++) {
		this.postimages[p] = new Image();
		this.postimages[p].src = theimages[p][0];
	}
	
	// if IE5+ or modern browsers
	if (iebrowser && dom || dom) { 
		document.write('<div id="master' + this.slideshowid + '" style="position:relative;width:' + fadewidth + 'px;height:' + fadeheight + 'px;overflow:hidden;">');
		document.write('<div id="' + this.canvasbase + '_0" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:' + fadebgcolor + '"></div>');
		document.write('<div id="' + this.canvasbase + '_1" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:' + fadebgcolor + '"></div></div>');
		//this.startit();
		var tmp = this;
		setTimeout(function () { tmp.startit(); }, this.delay);
		
	} else {
		document.write('<div><img name="defaultslide' + this.slideshowid + '" src="' + this.postimages[0].src + '"></div>');
		this.curimageindex++;
		setInterval("fadearray[" + this.slideshowid + "].rotateimage()", this.interval);
	}
}
// starts the slideshow for modern browsers
fadeshow.prototype.startit = function() {
	var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas); // get the right canvas obj
	this.populateslide(crossobj, this.curimageindex); // put the image and link into the current canvas
	if (this.pausecheck == 1) { // if slideshow should pause on mouseover
		var cacheobj = this;
		var crossobjcontainer = iebrowser? iebrowser["master" + this.slideshowid] : document.getElementById("master" + this.slideshowid);
		crossobjcontainer.onmouseover = function() { cacheobj.mouseovercheck = 1; }
		crossobjcontainer.onmouseout = function() { cacheobj.mouseovercheck = 0; }
	}
	this.rotateimage();
}
// function to populate the HTML and A tags for the image
fadeshow.prototype.populateslide = function(canvas, picindex) {
	var slideHTML = '';
	if (this.theimages[picindex][1] != '#') { slideHTML = '<a href="' + this.theimages[picindex][1] + '" target="' + this.theimages[picindex][2] + '">'; }
	slideHTML += '<img src="' + this.postimages[picindex].src + '" border="' + this.imageborder + 'px">';
	if (this.theimages[picindex][1] != '#') { slideHTML += '</a>'; } 
	canvas.innerHTML = slideHTML;
}
// function to rotate the pic
fadeshow.prototype.rotateimage = function () {
	if (this.pausecheck == 1) { var cacheobj = this; } // if pause onmouseover enabled, cache object
	if (this.mouseovercheck == 1) { setTimeout(function() { cacheobj.rotateimage(); }, 100); }
	else if (iebrowser && dom || dom) {
		this.resetit(); // reset the fadeshow opacity
		var crossobj = this.tempobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas); // get the right canvas obj
		crossobj.style.zIndex++; // move to the top layer
		fadeclear[this.slideshowid] = setInterval("fadepic(fadearray[" + this.slideshowid + "])", 50); // fade the image in, every 50 microseconds
		//setTimeout("fadeclear[this.slideshowid] = setInterval(\"fadepic(fadearray[" + this.slideshowid + "])\", 50)", this.delay); // fade the image in, every 50 microseconds
		this.curcanvas = (this.curcanvas == this.canvasbase + "_0") ? this.canvasbase + "_1" : this.canvasbase + "_0"; // switch canvases
	
	} else {
		var ns4imgobj = document.images['defaultslide' + this.slideshowid];
		ns4imgobj.src = this.postimages[this.curimageindex].src;
	}

	// increase the counter or reset it back to the beginning
	this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0;
}
// resets the fadeshow opacity
fadeshow.prototype.resetit = function() {
	this.degree = 0;
	var crossobj = iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas);
	if (crossobj.filters && crossobj.filters[0]) {
		if (typeof crossobj.filters[0].opacity == "number") { crossobj.filters(0).opacity = this.degree; } // if IE6+
		else { crossobj.style.filter = "alpha(opacity=" + this.degree + ")"; } // else if IE5.5-
	}
	else if (crossobj.style.MozOpacity) { crossobj.style.MozOpacity = this.degree / 100; }
	else if (crossobj.style.KhtmlOpacity) { crossobj.style.KhtmlOpacity = obj.degree / 100; }
}
// this is the function that does the fading
function fadepic(obj) { // obj from the fade array, it's the current instance of the 

	// if we aren't at full opacity yet, continue to increase
	if (obj.degree < 100) {
		obj.degree += 10; // this is the fade step interval (10 is good)
		if (obj.tempobj.filters && obj.tempobj.filters[0]) {
			if (typeof obj.tempobj.filters[0].opacity == "number") { obj.tempobj.filters[0].opacity = obj.degree; } // if IE6+
			else { obj.tempobj.style.filter = "alpha(opacity=" + obj.degree + ")"; } // else if IE5.5-
		
		} else if (obj.tempobj.style.MozOpacity) { obj.tempobj.style.MozOpacity = obj.degree/100;
		} else if (obj.tempobj.style.KhtmlOpacity) { obj.tempobj.style.KhtmlOpacity = obj.degree/100; }
	
	// otherwise clear and start again
	} else {
		clearInterval(fadeclear[obj.slideshowid]);
		obj.nextcanvas = (obj.curcanvas == obj.canvasbase + "_0") ? obj.canvasbase + "_0" : obj.canvasbase + "_1";
		obj.tempobj = iebrowser ? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas);
		obj.populateslide(obj.tempobj, obj.nextimageindex);
		obj.nextimageindex = (obj.nextimageindex < obj.postimages.length - 1) ? obj.nextimageindex + 1 : 0;
		
		//setTimeout("setInterval(\"fadearray[" + this.slideshowid + "].rotateimage()\", this.interval)", this.delay);
		setTimeout("fadearray[" + obj.slideshowid + "].rotateimage()", obj.interval);
	}
}
//-->