
function initialize()
{
	brandshop_teaser.init();
	iBox.initialize();

}
Element.observe( window, 'load', initialize, false );

var brandshop_teaser = {
	init: function() {
		var folder = DOM_getText( $('brandshop_imagefolder') );
		var container = $('brandshops_logos');
		var clearer = $('brandshops_clearer');
		if( empty(folder) || empty(container) ) return;
		var brands = $$('#brandshop_selection li a');
		var selected = [];
		for( var i=0; i<5 && 0<brands.length; i++ ) {
			var index = Math.floor( Math.random() * brands.length );
			var dom = brands.splice( index, 1 )[0];
			var brandurl = dom.href;
			var brandname = DOM_getText( dom );
			var filename = labelToFilename( brandname ) + '.png';
			var imageurl = folder + filename;
			
			var newLogo = document.createElement('a');
			newLogo.className = "logo";
			newLogo.href = brandurl;
			newLogo.alt = brandname;
			newLogo.title = '';
			
			var newSpan = document.createElement('span');
			newSpan.style.backgroundImage = 'url(' + imageurl + ')';
			newLogo.insertBefore( newSpan, null );
			
			container.insertBefore( newLogo, clearer );
		}
	}
};

