function fixpng(){
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ((version >= 5.5) && (document.body.filters) && (version < 7)){
		var png_images = $$('.pngfix');	
		png_images.each(function(element) {
			if(!$(element).hasClass('pngfixed')){
				$(element).addClass('pngfixed');
				var img = $(element);
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.getProperty('width') + "px; height:" + img.getProperty('height') + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML					
			}
		});
	} else {
		$$('.pngfix').addClass('pngfixed');
	}
}

var slideshowcounter = 0;
function reload(){
	if(slideshowcounter){
		new Fx.Tween($('newsitem_'+slideshowcounter), {duration: 1000}).start('opacity', $('newsitem_'+slideshowcounter).getStyle('opacity'), 0);
	}
	slideshowcounter++;
	if(slideshowcounter-1 == $$('.newsitem').length){ slideshowcounter = 1 }
	new Fx.Tween($('newsitem_'+slideshowcounter), {duration: 1000}).start('opacity', $('newsitem_'+slideshowcounter).getStyle('opacity'), 1);
	if($$('.newsitem').length > 1){
		setTimeout('reload()', 5000);
	}
}

function init(){
	fix();
	fixpng();
	
	if(IS_HOME && HAS_OVER){
	
		$('logo').addEvent('mouseenter', function(){ $('over').setStyle('display', 'block'); });
		$('logo').addEvent('mouseleave', function(){ $('over').setStyle('display', 'none'); });
		
		$$('.block').addEvent('mouseenter', function(){ this.getFirst('.over').setStyle('display', 'block'); this.getFirst('.out').setStyle('display', 'none'); });
		$$('.block').addEvent('mouseleave', function(){ this.getFirst('.over').setStyle('display', 'none'); this.getFirst('.out').setStyle('display', 'block'); });
		
		$$('.newsitem').setStyles({'opacity': 0, 'display': 'block'});
		reload();
		
	}
	
	$('payoff').addEvent('mouseenter', function(){ $('baloon').setStyle('display', 'block'); });
	$('payoff').addEvent('mouseleave', function(){ $('baloon').setStyle('display', 'none'); });
	
}

function fix(){
	
}

window.addEvent('load', init);
window.addEvent('resize', fix);
