jQuery.noConflict();

(function($){

    var dropdowns = {



			'Portfolio': [

							{label: 'Developments', url: 'http://abstractdevelopments.com/projects/index.php#developments'},

                            {label: 'Custom Builds', url: 'http://abstractdevelopments.com/projects/index.php'}



                        ]

    };

    $(document).ready(function(){

        $("#nav-primary li a").hover(function(){

            $("#jsdropdown").remove(); // Remove old menu from DOM



            // Get the position of the element you are hovering on

            var pos = $(this).offset(),

                current = $(this).text(); // Current menuitem



            // Choose which dropdown to use

            var dropdown = dropdowns[current];



            // Render the dropdown into the DOM

            var html = $("<ul></ul>")

                        .attr('id', 'jsdropdown')

                        .css('left', pos.left+'px')

                        .css('top', (pos.top+30)+'px')

                        .css('z-index', 9000);



            // Render the list items for this dropdown

            $(dropdown).each(function(){

                var a = $("<a></a>").attr('href', this.url).text(this.label),

                    li = $("<li></li>").prepend(a);



                $(html).prepend(li);

            });



            // Place the dropdown into the DOM

            $("body").prepend(html);



            // Bind hover event for the new dropdown to re-show the menu when you hover

            // off the parent LI

            $(html).hover(function(){

                $(this).show();

            },function(){

                $(this).hide();

            });

        }, function(){

            // The mouse has left the original LI, and can be anywhere on the page

            // OR is can be on the dropdown menu itself, we need to detect that

            var dropdown = $("#jsdropdown:visible");



            if(dropdown.length == 0){

                $("#jsdropdown").hide();

            }

        });

    });

})(jQuery);
