window.dropDown = window.dropDown || {};

dropDown = {
    fadeInTime : 220,
    fadeOutTime : 220,
    topY : 115,
    bottomY : 170,
    show : function(section)
    {
        var dropDown = $(".dropDown");
                
        // fade in the first time
        if (dropDown.css("display") == 'none') {    
            dropDown.fadeIn(this.fadeInTime, function() {
                if(jQuery.browser.msie) {
                    this.style.removeAttribute('filter');
                }
            });
            $(".dropDown > ul").css("display", "none");
            $("ul." + section).fadeIn(this.fadeInTime);
            return;
        } 
        
        $(".dropDown > ul").css("display", "none");
        $("ul." + section).css("display", "block");
    },
    
    hide : function(mouseY)
    {
        if (!mouseY || (mouseY && !dropDown.mouseIsIn(mouseY))) {
            $(".dropDown").fadeOut(this.fadeOutTime, function() {
                if(jQuery.browser.msie) {
                    this.style.removeAttribute('filter');
                }
            });
            $(".dropDown > ul").fadeOut(this.fadeOutTime);
        }
    },
    
    mouseIsIn : function(y)
    {
        if (y < this.topY || y > this.bottomY) {
            return false;
        }
        return true;
    }
}

$(document).ready(function() {

    $("blockquote").prepend("<span class='openQuote'>&#8220;</span>");
    $("blockquote").append("<span class='closeQuote'>&#8221;</span><span class='superscript'>+</span>");

    $(".menu .about").hover(function() {
        dropDown.show('about');
    }, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".menu .solutions").hover(function() {
        dropDown.show('solutions');
    }, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".menu .methodology").hover(function() {
        dropDown.show('methodology');
    }, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".menu .knowledge").hover(function() {
        dropDown.show('knowledge');
    }, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".menu .contact").hover(function() {
        dropDown.show('contact');
    }, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".dropDown").hover(function() {}, function(e) {
        dropDown.hide(e.pageY);
    });

    $(".menu .home").hover(function() {
        dropDown.hide();
    });
 
});
