    package com.bluefire.flexDemo.view
    {
        import com.adobe.cairngorm.view.ViewHelper;
        import mx.events.EffectEvent;
        import mx.effects.Resize;
        import mx.styles.StyleManager;
        import com.bluefire.flexDemo.model.DemoModelLocator;

        public class MainViewHelper extends ViewHelper
        {

            public var model:DemoModelLocator = DemoModelLocator.getInstance();
            public var styleMode2:Boolean = false;

            public function MainViewHelper()
            {
                super();    //super the constructor
            }

            /********************************************************
             * autoCloseSidePanel
             * function to close or open the side panel
             *******************************************************/
             public function autoCloseSidePanel(toClose:Boolean):void
             {
                 //view keyword refers to main.mxml in which this viewhelper resides
                 var sidePanelEffect:Resize = (view.showPanelEffect as Resize);
                 if(toClose)
                 {
                     sidePanelEffect.widthTo = 200;
                 }
                 else
                 {
                     sidePanelEffect.widthTo = 0;
                 }

                 sidePanelEffect.play();
             }

            /*************************************************
             * onSidePanelEffect Events
             * Event handlers for the sidePanel resize effect
             ***************************************************/
            public function onSidePanelEffectEnd(e:EffectEvent):void
            {

            }

            public function onSidePanelEffectStart(e:EffectEvent):void
            {

            }

            /*************************************************
             * slideshow Navigation
             * Handlers advancing the slideshow frames
             ***************************************************/
            public function slideshowNavigation(nav:String,num:Number=-1):void
            {
                switch(nav){
                case "forward":
                    if(view.slidePresentation.currentFrame+1 <= view.slidePresentation.totalFrames)
                        view.slidePresentation.gotoAndStop(view.slidePresentation.currentFrame+1);
                    else
                        view.slidePresentation.gotoAndStop(1);
                    break;
                case "back":
                    if(view.slidePresentation.currentFrame-1 >= 1)
                        view.slidePresentation.gotoAndStop(view.slidePresentation.currentFrame-1);
                    else
                        view.slidePresentation.gotoAndStop(view.slidePresentation.totalFrames);
                    break;
                case "slideNum":
                    if((num <= view.slidePresentation.totalFrames) && (num > 0))
                    {
                        view.slidePresentation.gotoAndStop(num);
                    }
                }

                if (view.slidePresentation.currentFrame == view.model.demo.style2)
                {
                    StyleManager.loadStyleDeclarations("assets/style2.swf");
                    view.logo.gotoAndStop("darkLogo");
                    styleMode2 = true;
                }
                else if (styleMode2)
                {
                    StyleManager.loadStyleDeclarations("assets/style1.swf");
                    view.logo.gotoAndPlay(1);
                }

            }

        }
    }