function RunFoo(img, file, width, height, color, vars){
	document.write('<object type="application/x-shockwave-flash" data="'+file+'" width="'+width+'" height="'+height+'">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+file+'" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="'+color+'" /><param name="wmode" value="transparent" />');
	if(vars)
		document.write('<param name="FLASHVARS" value="'+vars+'" />');
	document.write('</object>');
}
var announceContainer = 0;
var announces = new Array(), currentYear = 0, announce;

function processYear(data){
	currentYear = data.year;
	announces[data.year] = data.months;
	$.each(data.months,
		function(i, month){
			if( month.films.length > 0 )
				$(announce[i]).removeClass('locked');
		}
	)
}

$(
	function(){
		announce = $('.announce b');
		if( announce.length > 0 ){
			announce.addClass('locked').mouseover(
				function(event){
					var that = $(this);
					
					if( that.hasClass('locked') )
						return true;

					if( !announceContainer ){
						announceContainer = document.createElement('DIV');
						announceContainer.id = 'announces';
						announceContainer.style.position = 'absolute';
						announceContainer.style.width = '200px';
						$(document.body).append(announceContainer);
						announceContainer = $(announceContainer);
					}
					var content = '<ul>';

					$.each(announces[currentYear][announce.index(this)].films,
						function(i, film){
							content += '<li>' + film.name + ' <font color="#FFFFFF">(' + film.date + ')</font>' + '</li>';
						}
					);
					content += '</ul>';
					var top = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop:(document.body&&document.body.scrollTop?document.body.scrollTop:0);
					announceContainer.show();
					announceContainer.html(content);
					announceContainer.css('top', event.clientY + top + 'px').css('left', event.clientX + 'px');
					return false
				}
			).mouseout(
				function(){
					if( announceContainer )
						announceContainer.hide();
				}
			);

			$('.announce .header select').click(
				function(){
					currentYear = this.options[this.selectedIndex].value;
					announce.addClass('locked');
					if( !announces[currentYear] ){
						$.getJSON(document.location + 'announce/' + currentYear + '/', processYear);
					}
					else{
						$.each(announces[currentYear],
							function(i, month){
								if( month.films.length > 0 ){
									$(announce[i]).removeClass('locked');
								}
							}
						)
					}
				}
			).click();
		}
	}
)