
var ffwClickForCode = {

	init : function (el) { // verify ability, find targetted lists
		if (!bv) return; // require bv_utilities.js
		var Trg = bv.dom.getElementsByClassName(document.getElementById('mainContent'), 'div', 'clickForCode');
		for (var xx=0, el=null; el = Trg[xx]; xx++) {
			var Imgs     = el.getElementsByTagName('img');
			var Fieldset = el.getElementsByTagName('fieldset')[0];
			var Output   = el.getElementsByTagName('textarea')[0];
			bv.event.add(Output, 'focus', function () { this.select(); } );
			for (var ii=0, img=null; img = Imgs[ii]; ii++) {
				bv.event.add(img, 'click', function(house,target) {
						return function () {
							if (! house || ! target) alert('bad args');
							var src = this.src.replace(/^.*\//, '');
							target.value = '<a href="http://filmfestivalworld.com/"><img src="http://filmfestivalworld.com/fileadmin/img/ffw/'+ src +'" width="'+ this.width +'" height="'+ this.height +'" alt="'+ this.alt +'" /></a>';
							target.select();
							bv.css.addClass(house, 'set');
						};
					}(Fieldset,Output)
				);
			}
		}
	},
	
	complete : true
}

if (bv && bv.event) bv.event.add(window, "domready", ffwClickForCode.init);



