dojo.require("dojo._base.html");
dojo.require("dojo._base.fx");
dojo.require("dojo.fx");
dojo.require("dojo.fx.easing");
    
  dojo.addOnLoad(function(){ 
     // our dom is ready, get the node: 

         if ( dojo.query('.home_slider_container_screen') ) {
             xoContentViews = dojo.query('.home_slider_container_screen');
                 xoContents = dojo.query('.home_slider_container',xoContentViews[0]);
                 xoElements = dojo.query('li',xoContents[0]);
                 var xnWidth = Number()
                 for ( var i=0; i<xoElements.length; i++ ) {
                        xnWidth = xnWidth + dojo._getMarginBox(xoElements[i]).w;
                 }
                 if ( xnWidth > dojo._getMarginBox(xoContentViews[0]).w ) {

                         dojo._setMarginBox(xoContents[0],0,0,xnWidth);
                         xoMouseOverLefts = dojo.query('.mouseOverLeft', xoContentViews[0] );
                         xoMouseOverRights = dojo.query('.mouseOverRight', xoContentViews[0] );
                         
                         dojo._event_listener.add( xoMouseOverLefts[0]
                                ,
                                'mouseover',
                                function() {
                                        f_gotoRight(xoContentViews[0]);                         });
                         dojo._event_listener.add( xoMouseOverLefts[0]
                                ,
                                'mouseout',
                                function() {
                                        anim1.stop();
                                });
                                
                         dojo._event_listener.add( xoMouseOverRights[0]
                                ,
                                'mouseover',
                                function() {
                                        f_gotoLeft(xoContentViews[0]);

                                });
                         dojo._event_listener.add( xoMouseOverRights[0]
                                ,
                                'mouseout',
                                function() {
                                        anim2.stop();
                                });
                                
                 }
                
                 
        }
  });
                
  function f_gotoLeft (xoContentView) {
        /*
                Pixel nach links bererchnen
        */
        xoContentViewMarginBox = dojo._getMarginBox(xoContentView);
        xoContents = dojo.query('.home_slider_container',xoContentView);
        xoContent = xoContents[0];
        xoContentMarginBox = dojo._getMarginBox(xoContent);
        xnDuration = (xoContentMarginBox.w-xoContentViewMarginBox.w+xoContentMarginBox.l)*8;

        xoAnimLeft = {
                node: xoContent,
                left: xoContentViewMarginBox.w-xoContentMarginBox.w,
                duration:xnDuration,
                easing:dojo.fx.easing.linear,
                units:'px'
        };
        anim1=dojo.fx.slideTo(xoAnimLeft).play();
  }
        
        
  function f_gotoRight (xoContentView) {
        /*
                Pixel nach links bererchnen
        */
        xoContentViewMarginBox = dojo._getMarginBox(xoContentView);
        xoContents = dojo.query('.home_slider_container',xoContentView);
        xoContent = xoContents[0];
        xoContentMarginBox = dojo._getMarginBox(xoContent);
        xnDuration = -(xoContentMarginBox.l)*8;
        xoAnimRight = {
                node: xoContent,
                left: -1,
                duration:xnDuration,
                easing:dojo.fx.easing.linear,
                units:'px'
        };
        anim2=dojo.fx.slideTo(xoAnimRight).play();
  }       
   
