window.addEvent('resize', windowResize);

function windowResize(){
   var currentSize = window.getSize();
   var teaser = document.id('teaser');

   
  if((currentSize.x > 1214 && currentSize.x != 1214))
  {
   teaser.setStyles({'width':currentSize.x - 678, 'margin-left': 0})
  }
  else if((currentSize.x == 1214))
  {
   teaser.setStyles({'width':536, 'margin-left': 0})
  }
  else if((currentSize.x < 1214))
  {
   teaser.setStyles({'width':536, 'margin-left': -(1214-currentSize.x)})
  }
  if((currentSize.y > 909))
  {
   teaser.setStyles({'margn-top':(teaser.getSize().y/2)})
  }
  else if((currentSize.y < 909))
  {
   teaser.setStyles({'margn-top':0})
  }
}

window.addEvent('domready',function() {
	
	windowResize();

    Cufon.replace('h2, h3, h4, #topnavi a')

	$$('#topnavi li').each(function(e) {
		var button = e.getElement('a').set('tween',{ duration: 150 }).addEvents({
			mouseenter: function(a) { 
		     if((button.hasClass('inactive')) == 1)
		     {
				button.tween('opacity',0.6);
		     }
			},
			mouseleave:function(a) {
		     if((button.hasClass('inactive')) == 1)
		     {
				button.tween('opacity',1);	
		     }
			}
		 });
	});

});
