function rotate(src, rotator_box , height, width) {
	var html = '<div id="' + rotator_box + '_box" >  </div>';
	$( '#' + rotator_box).html( html );
	var flashvars = {};
	var params = {
		wmode: 'opaque'
	};
	swfobject.embedSWF(src, rotator_box + '_box', width, height, '9.0.0', false, flashvars, params);
}

function initiateRotation( config ) {
	// addres of items to be rotated used in $()
	var items_selector = ' #' + config.rotator_id + ' .' + config.container_class + ' a';
	var items = $(items_selector);
	
	// address of box where curent item is displayed
	var box_selector = ' #' + config.rotator_id + ' #' + config.rotator_box;
   
	
	
	var imageInterval = config.time * items.length;
	
	config['items'] = items;
	
	$(document).data('config_' + config.rotator_box, config);
	//alert('#' + config.rotator_id);
	
	for( var i = 0; i < items.length; i++ ) {
		//send first vawe of rotations
		setTimeout("rotate( '" + $(items[i]).attr('href') + "', '" + config.rotator_box + "' , '" + config.height + "' , '" + config.width + "' );",i*config.time );
		
		//send the rest in setInterval
		setTimeout('setInterval(\'rotate( \"' + $( items[i]).attr('href')  + '\", \"' + config.rotator_box + '\" , \"' + config.height + '\" , \"' + config.width + '\" );\', '+imageInterval+');', i*config.time);
	}  
}