var root = "http://www.ff-luedenscheid.de/";
var mf; 
var news_con;

window.addEvent('domready',function(){
  $$('a').addEvent('click', function() {
    this.blur();
  });
  $$('a.newW').setProperty('target','_blank');
});

function imageflow() {
  var simages_src = new Array();
  $('slider').setStyle('display','block');
  var simages = $$('#studio_images img');
  simages.each(function(s){
    simages_src.push(s.getProperty('src'));
  })
  new Asset.images(simages_src, {
              onComplete:  function() {
                $('loader').setStyle('display','none');
                $('studio_images').setStyle('position','relative');
                $$('#studio_images img').setStyles({
                  'position': 'absolute',
                  'border':   'none'
                });
                imgs = x = Math.round($$('#studio_images img').length / 2);
              	mf = new MooFlow({
              		container: 'imageflow',
              		imgContainer: 'studio_images',
              		images: '#studio_images img',
              		caption: 'captions',
              		slider: {slider:'slider_inner',knob:'knob'},
              		useMouseWheel: true,
              		useKeyInput: true,
              		reflection: 0.8,
              		startIndex: imgs-1
              	});
              	$('knob').setStyle('width','47px');
              	$('studio_images').setStyle('display','block');
	 }
  });
};

function newsUpdate() {
  $$('#inner_menu a').each(function(news){
    news.setProperty('href','#');
    news.setProperty('onclick','return false');
    news.addEvent('click', function(){
      this.blur();
      if ($('fullview').getProperty('class') != this.getProperty('id').split('n')[1]) {
        $('fullview').setProperty('class', this.getProperty('id').split('n')[1]);
        $$('#inner_menu a.active').setProperty('class','');
        this.setProperty('class','active');
        new Ajax(
          root + "req_news.php?id=" + news.getProperty('id').split('n')[1],
          {
            method:     'get',
            onComplete: function(request) {
              new Fx.Style('fullview', 'opacity', 
                {
                  duration:   400,
                  onComplete: function() {
                    $('fullview').setHTML(request);
                    new Fx.Style('fullview', 'opacity', {duration: 400}).start(0,1);
                    
                  }
                }            
              ).start(1,0);
            }
          }
        ).request();
      }
    });
  });
}

function teamUpdate() {
  $$('.staff .more_about').setStyle('display','block');
  $$('.staff .more_about a').each(function(el){
    el.addEvent('click', function(){
      this.blur();
      
    });
  });
}


