/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var rotationspeed_firstspeed= 1000;
var rotationspeed_speed= 5000;
var $i=0;
var startitemarray = Array('start-top-left','start-top-right','start-bottom-left','start-bottom-right');
var startseiteaktiv
var startallheight =0;
var startover=0
function startseite(){
    if($('startseite')!= null){
       startallheight = $('startseite').getScrollSize();
       $('startseite').innerHTML=$('first4').innerHTML+$('startseite').innerHTML;
       for($i=0;$i<$$('#first4 a').length;$i++){
           $$('#first4 a')[$i].id ='idn'+$i;
       }
       $('startseite').innerHTML='<div id="startwrapper">'+$('startseite').innerHTML+'</div>';
       $('startwrapper').setStyles({'height': startallheight.y});
       $('startwrapper').setStyle('margin-top', startallheight.y*-1);
       vartmpmargin=startallheight.y*-1
       startseiteaktiv = window.setInterval('picScrolnext()', rotationspeed_speed);
       // $$('.startro img')[0].setStyles({'postition': 'absolute','top':'-25'})
        $i=0;
        //$('startintro').innerHTML=$('first4').innerHTML+$('startintro').innerHTML
        $$(' #startintro a').each(function(el){
            el.hide_img = new Fx.Morph(el, {duration: '1300', transition: Fx.Transitions.Sine.easeOut});
            el.next_item = new Fx.Morph( el, {duration: '5500', transition: Fx.Transitions.Sine.easeOut});
            el.backgroundimage = '';
            el.mainimage = '';
            el.pos = 1
            el.ro = 0
            el.addEvents({
                'mouseover': function(){
                    if(this.ro != 1){
                       this.ro = 1
                        startover=1
                       this.hide_img.cancel();
                       this.hide_img = new Fx.Morph($$("#"+this.id+' .mainimage')[0], {duration: '800', transition: Fx.Transitions.Sine.easeOut});
                       this.hide_img.start({
                            'filter':'alpha(opacity=10)',
                            '-moz-opacity': '0',
                            'opacity': '0.01'
                        });
                    }
                },
                'mouseleave': function(){
                       this.ro = 0
                       startover=0
                       this.hide_img.cancel();
                       $($$("#"+this.id+' .mainimage')[0]).setStyles({
                            'filter':'alpha(opacity=0)',
                            '-moz-opacity': '0',
                            'opacity': '0.1'
                        });
                       //this.hide_img = new Fx.Morph($$("#"+this.id+' img')[0], {duration: '1800', transition: Fx.Transitions.Sine.easeOut});
                       this.hide_img.start({
                            'filter':'alpha(opacity=100)',
                            '-moz-opacity': '1',
                            'opacity': '1'
                        });
                }
            });
            $i++;
        });


    }
}
vartmpmargin=0
function picScrolnext(){
    if(startover==0){
        vartmpmargin=vartmpmargin+=221;
        if(vartmpmargin>0){
           startallheight = $('startseite').getScrollSize();
            $('startwrapper').setStyle('margin-top', startallheight.y*-1+221*2);
            vartmpmargin=(startallheight.y*-1+221*3);
        }
        morph_element($('startwrapper') ,1000 , {'margin-top': vartmpmargin})
    }
}


