document.addEvent('domready',function()
{
//    if(Browser.ie6 == true)
//    {
//        return;
//    }
//    else
//    {
        if(Browser.ie6 == true)
        {
            var overOffset = 15;
        }
        else
        {
            var overOffset = 30;
        }
        var fxTime = 500;
        var curLoc = window.location.toString();

        if (curLoc.contains("/clients"))
        {
            initClientsMenu();
        }
        else if(curLoc.contains("/work"))
        {
            initWorkMenu();
        }

        else if(curLoc.contains("/contact"))
        {
            initContactMenu();
        }
        else
        {
            initMenu();
        }

        function initMenu()
        {
            // SLIDERS -------------------------------------------------------------

            var clientsSlider = new Fx.Slide('testimonials',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            var workSlider = new Fx.Slide('awards',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            var contactSlider = new Fx.Slide('contactNav',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            clientsSlider.hide();
            workSlider.hide();
            contactSlider.hide();

            //CLIENT FX ----------------------------------------------------------------

            var clientFx = new Fx.Tween('clientsParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            clientFx.addEvent('complete',function()
            {

                if($('clientsParent').getStyle('padding-top') == overOffset + "px")
                {
                    clientsSlider.slideIn();
                }
                else if ($('clientsParent').getStyle('padding-top') == "0px")
                {
                    clientsSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            clientFx.addEvent('cancel',function()
            {
                clientFx.start('padding-top','0')
            })

            // WORK FX -----------------------------------------------------------------

            var workFx = new Fx.Tween('workParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })



            workFx.addEvent('complete',function()
            {

                if($('workParent').getStyle('padding-top') == overOffset + "px")
                {
                    workSlider.slideIn();
                }
                else if ($('workParent').getStyle('padding-top') == "0px")
                {
                    workSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            workFx.addEvent('cancel',function()
            {
                workFx.start('padding-top','0')
            })

            //CONTACT FX ---------------------------------------------------------------

            var contactFx = new Fx.Tween('contactParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            contactFx.addEvent('complete',function()
            {

                if($('contactParent').getStyle('padding-top') == overOffset + "px")
                {
                    contactSlider.slideIn();
                }
                else if ($('contactParent').getStyle('padding-top') == "0px")
                {
                    contactSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            contactFx.addEvent('cancel',function()
            {
                contactFx.start('padding-top','0')
            })

            //NODROP FX ----------------------------------------------------------------

            var morphOptions = {link:'cancel',duration:fxTime,transition:'expo:in:out'}

            $$('.noDrop').forEach(function(item)
            {
                item.set('morph',morphOptions);
                item.addEvents(
                {
                    'mouseenter':function(){this.morph({'padding-top':overOffset})},
                    'mouseleave':function(){this.morph({'padding-top':'0'})}
                })
            })

            //EVENT HANDLERS -----------------------------------------------------------

            $('clientsParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('clientsIEFix')
                    }

                    clientFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    clientFx.start('padding-top','0')
                }
            })

            clientsSlider.addEvent('complete',function()
            {
                if(clientsSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('clientsParent').removeClass('clientsIEFix')
                }
            })

            $('workParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.ie6 || Browser.ie7)
                    {
                        this.addClass('workIEFix')
                    }
                   workFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    workFx.start('padding-top','0')
                }
            })

            workSlider.addEvent('complete',function()
            {
                if(workSlider.open == false && Browser.ie6 || Browser.ie7)
                {
                    $('workParent').removeClass('workIEFix')
                }
            })

            $('contactParent').addEvents(
            {
                'mouseenter':function()
                {
                     if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('contactIEFix')
                        $('contactNav').addClass('contactNavIEFix')
                    }
                   contactFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {

                    contactFx.start('padding-top','0')
                }
            })

            contactSlider.addEvent('complete',function()
            {
                if(contactSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('contactParent').removeClass('contactIEFix');
                    $('contactNav').removeClass('contactNavIEFix');
                }
            })

            var subMove = -15;

            $('testimonials').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('awards').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('aus').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('nz').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('usa').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })
        }

        function initClientsMenu()
        {
            // SLIDERS -------------------------------------------------------------



            var workSlider = new Fx.Slide('awards',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            var contactSlider = new Fx.Slide('contactNav',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            workSlider.hide();
            contactSlider.hide();


            // WORK FX -----------------------------------------------------------------

            var workFx = new Fx.Tween('workParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })



            workFx.addEvent('complete',function()
            {

                if($('workParent').getStyle('padding-top') == overOffset + "px")
                {
                    workSlider.slideIn();
                }
                else if ($('workParent').getStyle('padding-top') == "0px")
                {
                    workSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            workFx.addEvent('cancel',function()
            {
                workFx.start('padding-top','0')
            })

            //CONTACT FX ---------------------------------------------------------------

            var contactFx = new Fx.Tween('contactParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            contactFx.addEvent('complete',function()
            {

                if($('contactParent').getStyle('padding-top') == overOffset + "px")
                {
                    contactSlider.slideIn();
                }
                else if ($('contactParent').getStyle('padding-top') == "0px")
                {
                    contactSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            contactFx.addEvent('cancel',function()
            {
                contactFx.start('padding-top','0')
            })

            //NODROP FX ----------------------------------------------------------------

            var morphOptions = {link:'cancel',duration:fxTime,transition:'expo:in:out'}

            $$('.noDrop').forEach(function(item)
            {
                item.set('morph',morphOptions);
                item.addEvents(
                {
                    'mouseenter':function(){this.morph({'padding-top':overOffset})},
                    'mouseleave':function(){this.morph({'padding-top':'0'})}
                })
            })

            //EVENT HANDLERS -----------------------------------------------------------


            $('workParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('workIEFix')
                    }

                   workFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    workFx.start('padding-top','0')
                }
            })

            workSlider.addEvent('complete',function()
            {
                if(workSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('workParent').removeClass('workIEFix')
                }
            })

            $('contactParent').addEvents(
            {
                'mouseenter':function()
                {
                     if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('contactIEFix')
                        $('contactNav').addClass('contactNavIEFix')
                    }
                   contactFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    contactFx.start('padding-top','0')
                }
            })

            contactSlider.addEvent('complete',function()
            {
                if(contactSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('contactParent').removeClass('contactIEFix');
                    $('contactNav').removeClass('contactNavIEFix');
                }
            })

            var subMove = -15;

            if(curLoc.contains("/clients") && curLoc.contains("/testimonials")!=true)
                {
                    $('testPage').addEvents(
                    {
                        'mouseenter':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':subMove})
                        },
                        'mouseleave':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':'0'})
                        }
                    })
                }
            else
                {
                    $('clientsPage').addEvents(
                    {
                        'mouseenter':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':subMove})
                        },
                        'mouseleave':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':'0'})
                        }
                    })
                }



            $('awards').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('aus').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('nz').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('usa').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })
        }

        function initWorkMenu()
        {
            // SLIDERS -------------------------------------------------------------

            var clientsSlider = new Fx.Slide('testimonials',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });



            var contactSlider = new Fx.Slide('contactNav',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            clientsSlider.hide();
            contactSlider.hide();

            //CLIENT FX ----------------------------------------------------------------

            var clientFx = new Fx.Tween('clientsParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            clientFx.addEvent('complete',function()
            {

                if($('clientsParent').getStyle('padding-top') == overOffset + "px")
                {
                    clientsSlider.slideIn();
                }
                else if ($('clientsParent').getStyle('padding-top') == "0px")
                {
                    clientsSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            clientFx.addEvent('cancel',function()
            {
                clientFx.start('padding-top','0')
            })



            //CONTACT FX ---------------------------------------------------------------

            var contactFx = new Fx.Tween('contactParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            contactFx.addEvent('complete',function()
            {

                if($('contactParent').getStyle('padding-top') == overOffset + "px")
                {
                    contactSlider.slideIn();
                }
                else if ($('contactParent').getStyle('padding-top') == "0px")
                {
                    contactSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            contactFx.addEvent('cancel',function()
            {
                contactFx.start('padding-top','0')
            })

            //NODROP FX ----------------------------------------------------------------

            var morphOptions = {link:'cancel',duration:fxTime,transition:'expo:in:out'}

            $$('.noDrop').forEach(function(item)
            {
                item.set('morph',morphOptions);
                item.addEvents(
                {
                    'mouseenter':function(){this.morph({'padding-top':overOffset})},
                    'mouseleave':function(){this.morph({'padding-top':'0'})}
                })
            })

            //EVENT HANDLERS -----------------------------------------------------------

            $('clientsParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('clientsIEFix')
                    }

                    clientFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    clientFx.start('padding-top','0')
                }
            })

            clientsSlider.addEvent('complete',function()
            {
                if(clientsSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('clientsParent').removeClass('clientsIEFix')
                }
            })


            $('contactParent').addEvents(
            {
                'mouseenter':function()
                {
                     if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('contactIEFix')
                        $('contactNav').addClass('contactNavIEFix')
                    }
                   contactFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {

                    contactFx.start('padding-top','0')
                }
            })

            contactSlider.addEvent('complete',function()
            {
                if(contactSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('contactParent').removeClass('contactIEFix');
                    $('contactNav').removeClass('contactNavIEFix');
                }
            })

            var subMove = -15;

            $('testimonials').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            if(curLoc.contains("/work") && curLoc.contains("/awards")!=true)
                {
                    $('awardsPage').addEvents(
                    {
                        'mouseenter':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':subMove})
                        },
                        'mouseleave':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':'0'})
                        }
                    })
                }
            else
                {
                    $('workPage').addEvents(
                    {
                        'mouseenter':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':subMove})
                        },
                        'mouseleave':function()
                        {
                           this.set('morph',morphOptions);
                           this.morph({'margin-top':'0'})
                        }
                    })
                }

            $('aus').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('nz').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('usa').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })
        }

        function initContactMenu()
        {
            // SLIDERS -------------------------------------------------------------

            var clientsSlider = new Fx.Slide('testimonials',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });

            var workSlider = new Fx.Slide('awards',
            {
                mode:'horizontal',
                duration: fxTime,
                link:'cancel',
                transition: Fx.Transitions.Expo.easeOut
            });



            clientsSlider.hide();
            workSlider.hide();

            //CLIENT FX ----------------------------------------------------------------

            var clientFx = new Fx.Tween('clientsParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })

            clientFx.addEvent('complete',function()
            {

                if($('clientsParent').getStyle('padding-top') == overOffset + "px")
                {
                    clientsSlider.slideIn();
                }
                else if ($('clientsParent').getStyle('padding-top') == "0px")
                {
                    clientsSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            clientFx.addEvent('cancel',function()
            {
                clientFx.start('padding-top','0')
            })

            // WORK FX -----------------------------------------------------------------

            var workFx = new Fx.Tween('workParent',
            {
                link:'cancel',
                duration:fxTime,
                transition:'expo:in:out'
            })



            workFx.addEvent('complete',function()
            {

                if($('workParent').getStyle('padding-top') == overOffset + "px")
                {
                    workSlider.slideIn();
                }
                else if ($('workParent').getStyle('padding-top') == "0px")
                {
                    workSlider.slideOut();
                }
                else
                {
                    return;
                }
            })

            workFx.addEvent('cancel',function()
            {
                workFx.start('padding-top','0')
            })

            //CONTACT FX ---------------------------------------------------------------



            //NODROP FX ----------------------------------------------------------------

            var morphOptions = {link:'cancel',duration:fxTime,transition:'expo:in:out'}

            $$('.noDrop').forEach(function(item)
            {
                item.set('morph',morphOptions);
                item.addEvents(
                {
                    'mouseenter':function(){this.morph({'padding-top':overOffset})},
                    'mouseleave':function(){this.morph({'padding-top':'0'})}
                })
            })

            //EVENT HANDLERS -----------------------------------------------------------

            $('clientsParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('clientsIEFix')
                    }

                    clientFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    clientFx.start('padding-top','0')
                }
            })

            clientsSlider.addEvent('complete',function()
            {
                if(clientsSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('clientsParent').removeClass('clientsIEFix')
                }
            })

            $('workParent').addEvents(
            {
                'mouseenter':function()
                {
                    if(Browser.Engine.trident == true && Browser.Engine.version <=4)
                    {
                        this.addClass('workIEFix')
                    }

                   workFx.start('padding-top',overOffset)
                },
                'mouseleave':function()
                {
                    workFx.start('padding-top','0')
                }
            })

            workSlider.addEvent('complete',function()
            {
                if(workSlider.open == false && Browser.Engine.trident == true && Browser.Engine.version <=4)
                {
                    $('workParent').removeClass('workIEFix')
                }
            })


            var subMove = -15;

            $('testimonials').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('awards').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('ausPage').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('nzPage').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })

            $('usaPage').addEvents(
            {
                'mouseenter':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':subMove})
                },
                'mouseleave':function()
                {
                   this.set('morph',morphOptions);
                   this.morph({'margin-top':'0'})
                }
            })
        }
//    }
    
    
    
    
})

