	
	instanceCount=0;
	var instances=new Array();
	startOrder=new Array('a','b','c','d','e','f','g','h',
	                     'i','j','k','l','m','n','o','p',
						 'q','r','s','t','u','v','w','x',
						 'y','z','aa','ab','ac','ad','ae','af',
						 'ag','ah','ai','aj','ak','al','am','an',
						 'ao','ap','aq','ar','as','at','au','av',
						 'aw','ax','ay','az');
	
function bf_options_object(name)
{
	this.maximages=5;
	this.did_depends=false;
	this.name=name;
	instances[instanceCount]=this;
	this.placeholder='placeholder_image_span_name';
	this.layerHeader=startOrder[instanceCount++];
	this.images=new Array();
	this.gfccounter=0-0;
	this.gfcincrement=gfcincrement;
	this.hideIt=hideIt;
	this.showIt=showIt;
	this.colorIt=colorIt;
	this.getIt=getIt;
	this.moveIt=moveIt;
	this.showHide=showHide;
	this.startX=50-0;
	this.blockCaption=''; // actually means title
	this.blockCaptionsFlag=false;
	this.blockCaptions=new Array(); // array of captions
	this.startY=50-0;
	this.imgWid=100-0;
	this.imgHgt=75-0;
	this.flashRows=3-0;
	this.flashCols=3-0;
	this.flashtime=.05-0; // seconds for flashing
	this.flashloops=4-0;
	this.flashpause=1-0; //seconds between images
	this.tweenpause=1-0; //seconds between fade in/fade out
	this.lastfadetime=1-0; //seconds before fade out of last image
	this.baseColor='#fffff0';
	this.layerLinkUrl="http://cslak.com";
	this.bf_border=0-0;
	// choose X random images from the list, defaults to first five items
	this.randomList=0; 
	this.bf_border_color='#000000';
	this.locations=new Array();
	this.bf_init=false;
}
function fisherYates ( myArray ) {
  var i = myArray.length;
  if ( i == 0 ) return false;
  while ( --i ) {
     var j = Math.floor( Math.random() * ( i + 1 ) );
     var tempi = myArray[i];
     var tempj = myArray[j];
     myArray[i] = tempj;
     myArray[j] = tempi;
   }
}
function bf_dependencies(obj)
{
	if (obj.randomList)
	{
		ab=obj.images.length;
		fisherYates(obj.images);
		if (obj.randomListr>ab) obj.randomList=ab;
		obj.maximages=obj.randomList;
	}
	if (obj.images.length>obj.maximages)
	{
		obj.images=obj.images.slice(0,obj.maximages);
		
	}
	obj.gfccounter=obj.images.length-1;
	obj.ll=obj.flashRows*obj.flashCols;
	obj.layerWid=Math.ceil(obj.imgWid/obj.flashCols);
	obj.layerHgt=Math.ceil(obj.imgHgt/obj.flashRows);
	obj.totalWid=obj.layerWid*obj.flashCols;
	obj.totalHgt=obj.layerHgt*obj.flashRows;

	if (! obj.did_depends)
	{
		obj.flashpause*=1000;
		obj.tweenpause*=1000;
		obj.did_depends=true;
	}
	obj.flashmil=1000*obj.flashtime;
	obj.flashinc=Math.floor(obj.flashmil/((obj.flashloops-1)*obj.flashloops));
	obj.flashstep=obj.flashinc*obj.flashloops;
	obj.flashendtime=obj.flashmil+obj.flashstep*obj.ll+obj.flashpause;
	obj.countermod=obj.images.length;
}
function blockFadeInit(obj)
{
	var yOffset=0;
	bf_dependencies(obj);
	if (obj.bf_border && obj.ll)
	{
		createIt(obj.layerHeader+'gfcborderlayer',obj.startX-obj.bf_border,obj.startY-obj.bf_border + yOffset,obj.totalWid+2*obj.bf_border,obj.totalHgt+2*obj.bf_border,1,'','','<img src="/pix/pixel.gif">');
		colorIt(obj.layerHeader+'gfcborderlayer',obj.bf_border_color);
		obj.locations.push(obj.layerHeader+'gfcborderlayer',-obj.bf_border,-obj.bf_border);
	}
	for (i=0;i<obj.images.length;i++)
	{
		createIt(obj.layerHeader+'gfclayer'+i,obj.startX,obj.startY + yOffset,obj.imgWid,obj.imgHgt,0,'','','<img name="gfcimage'+i+'" src="'+obj.images[i]+'" width='+obj.imgWid+' height='+obj.imgHgt+'>');
		obj.locations.push(obj.layerHeader+'gfclayer'+i,0,0);
	}
//	createIt('gfclayer',obj.startX,obj.startY,obj.imgWid,obj.imgHgt,0,'','','<img name=imglayer src="/pix/pixel.gif" width='+obj.imgWid+' height='+obj.imgHgt+'>');
	for(i=0;i<obj.ll;i++)
	{
		var ii=i+1;
		var row=Math.floor(i/obj.flashCols);
		var col=ii-obj.flashCols*row;
		createIt(obj.layerHeader+'flasher'+startOrder[i],obj.startX+(obj.layerWid*(col-1)),obj.startY+obj.layerHgt*row + yOffset,obj.layerWid,obj.layerHgt,0,'','','<img src="/pix/pixel.gif">');
		colorIt(obj.layerHeader+'flasher'+startOrder[i],obj.baseColor);
		obj.locations.push(obj.layerHeader+'flasher'+startOrder[i],obj.layerWid*(col-1),obj.layerHgt*row);
	}
	createIt(obj.layerHeader+'linklayer',obj.startX,obj.startY + yOffset,obj.totalWid,obj.totalHgt,1,'','','<a href="'+obj.layerLinkUrl+'" id=bfimagelink><img border=0 src="/pix/pixel.gif" width='+obj.totalWid+' height='+obj.totalHgt+'></a>');
		obj.locations.push(obj.layerHeader+'linklayer',0,0);
	if (obj.blockCaption)
	{
		yOffset=25;
		createIt(obj.layerHeader+'bfcaptionlayer',obj.startX,obj.startY,obj.totalWid,yOffset,1,'','','<div class=imageCaption align=center>'+obj.blockCaption+'</div>\n');
		colorIt(obj.layerHeader+'bfcaptionlayer',obj.bf_border_color);
		obj.locations.push(obj.layerHeader+'bfcaptionlayer',-obj.bf_border,-obj.bf_border);
	}
	if (obj.blockCaptionsFlag)
	{
		yOffset=50;
		createIt(obj.layerHeader+'bfcaptionslayer',obj.startX-obj.bf_border,obj.startY+obj.totalHgt+obj.bf_border,obj.totalWid+2*obj.bf_border,yOffset+obj.bf_border,1,'','','<div class=imageCaption align=center><form name=captionsForm><textarea name=imageCaptions class="bluevartextarea" cols=50 rows=3></textarea></form></div>\n');
		colorIt(obj.layerHeader+'bfcaptionslayer',obj.bf_border_color);
		obj.locations.push(obj.layerHeader+'bfcaptionlayer',-obj.bf_border,-obj.bf_border);
	}
	this.bf_init=true;
	blockFade(obj);
}
function moveBlock()
{
	for (i=0;i<instances.length;i++)
	{
		instances[i].startX=getXOffset(instances[i].placeholder);
		instances[i].startY=getYOffset(instances[i].placeholder);

		for (ii=0;ii<instances[i].locations.length;ii+=3)
		{
			moveIt(instances[i].locations[ii],instances[i].startX-0+instances[i].locations[ii+1],instances[i].startY-0+instances[i].locations[ii+2]);
		}
	}
}
function blockFade(obj)
{
	timers=new Array();
	junk=new Array();
	endOrder=new Array();
	for (i=0;i<obj.ll;i++)
	{
		junk[i]=startOrder[i];
	}

	for(i=0;i<obj.ll;i++)
	{
		var x=Math.floor(junk.length * Math.random());
		var y=junk.splice(x,1);
		endOrder.push(y[0]);
	}

	for (i=0;i<obj.ll;i++)
	{
		setTimeout(obj.name+'.showHide("'+obj.layerHeader+'flasher'+endOrder[i]+'",0,1)',obj.flashstep*i);
		setTimeout(obj.name+'.showHide("'+obj.layerHeader+'flasher'+endOrder[i]+'",0,0)',obj.flashendtime+obj.flashstep*i);
	}
	setTimeout(buildTimeout(obj.name+'.gfcincrement()'),obj.flashstep*obj.ll-(-1)*obj.flashpause/2);
	var fadetime=1;
	if (! (obj.gfccounter-obj.countermod+1)%obj.countermod)
	{
		fadetime=obj.lastfadetime;
	}
	setTimeout(buildTimeout('blockFade('+obj.name+')'),obj.flashendtime+obj.flashstep*obj.ll-0+obj.flashmil+obj.tweenpause*fadetime);
}
function buildTimeout(x)
{
	return x;
}
function gfcincrement()
{
	this.hideIt(this.layerHeader+'gfclayer'+this.gfccounter);
	this.gfccounter=(++this.gfccounter)%this.countermod;
	this.showIt(this.layerHeader+'gfclayer'+this.gfccounter);
	if (this.blockCaptionsFlag)
	{
		document.captionsForm.imageCaptions.value=this.blockCaptions[this.gfccounter];
	}
	changeLinkUrl(this,this.gfccounter);
}
function changeLinkUrl(th,ii)
{
	ei=document.getElementById('bfimagelink');
	ei.href=th.images[ii];
}
function showHide(nm,ii,flag)
{
	thisStep=Math.floor(ii/2)+1;
	substep=ii%2;
	steptype=ii%2?1-flag:0+flag;
	stepfunc='hideIt';
	if (steptype)
	{
		stepfunc='showIt';
	}
	nexti=ii+1;
	thisTimeout=(thisStep+substep*(this.flashloops-2*thisStep))*this.flashinc;
	eval(stepfunc+'("'+nm+'")');
	if (ii<this.flashloops*2)
	{
		setTimeout(this.name+'.showHide("'+nm+'",'+nexti+','+flag+')',thisTimeout);
	}
}

