        jQuery(function(){$(document).ready(function() {
        var n=0;
        function preload()
        {
                //fade things out
               
                $("#big-text").fadeOut('fast');
                $("#content-inner").fadeOut('fast');
                 $("#content-window").fadeOut('fast');
                
          
                //empty content for next load
                $("#content-body").empty();
                $("#content-left-nav-box").hide();
          
                //make sure we don't visit the page
                //$(this).attr("href",'#');
        }
        function postload(){
                //fade it in
          $("#content-left-nav-box").show();
          $("#content-inner").fadeIn('fast');
          $("#content-window").fadeIn('fast');
        }
        
        $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };
        
        
        //this function needs troubleshooting
        function prepare_anchors(){
                $('a').each(
                        function(i){
                                href_value = $(this).attr("href");
                                //alert("a[href='"+href_value+"']");
                                $("a[href='"+href_value+"']").click(function(event){
                                        preload();
                                       //load the page
                                        $.ajax({
                                                url: href_value,
                                                cache: false,
                                                success: function(html){
                                                        $("#content-body").append(html);
                                                }
                                        }
                                        );
        
                                
                                postload();
                                return false;
                                }
                                );
                        }
                );
        }
   
        
        //jaxify is can be used with prepare anchors once we figure what iz ronk!
        function jaxify(href_value,n){
                preload();
                       
                $.ajax({
                        url: href_value,
                        cache: false,
                        success: function(html){
                                $("#content-body").append(html);
                        }   
                });
                
        
        
                postload();
               
                
        }
        
        function add_menu(href_value,n){
               
                $("#content-left-nav-box").empty();
                 
                $.ajax({
                        url: href_value,
                        cache: false,
                        success: function(html){
                                
                                $("#content-left-nav-box").append(html);
                        }   
                });
                
                return 0;
        

        }
        
        jaxify_menus();
        jaxify_content();
                               

        
        $("#content-window-close").mouseover(function(event){
                $(this).css("background-image", "url('./newimages/x-selected.png')");
                }).mouseout(function(event){
                        $(this).css("background-image", "url('./newimages/x.png')");
        });
        $("#content-window-close").click(function(event){
                $("#content-window").fadeOut('1000');
                $("#big-text").fadeIn("1000");
        });
  
        
        function jaxify_menus(){
                
             
                //investigation/discovery
                $("a[href='./newsite/investigation-discovery.html']").click(function(event){
                //load the page
                
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                
                //strategy-exploration
                $("a[href='./newsite/strategy-exploration.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                
                //solutions-development
                $("a[href='./newsite/solutions-development.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                
                //implementation
                $("a[href='./newsite/implementation.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                
                //Karl-Kim
                $("a[href='./newsite/karl-kim.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                //bob-sawey
                $("a[href='./newsite/bob-sawey.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                //paul-wahlus
                $("a[href='./newsite/paul-wahlus.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                //who-we-are
                $("a[href='./newsite/who-we-are.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                //how-we-do-it
                $("a[href='./newsite/how-we-do-it.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                //Values
                $("a[href='./newsite/values.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
                
                //Orbik Logo
                 $("a[href='./newsite/orbik-logo.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'));
                //by returning false we avoid leaving the current page        
                return false;
                });
        }
        function jaxify_content(){
        $("a[href='./newsite/what-we-do.html']").click(function(event){
                //load the page
                jaxify($(this).attr('href'),n);
                add_menu('./newsite/menus/default-menu.html');
                //by returning false we avoid leaving the current page        
                return false;
        });
        
        
        }
        });
        });
        
        
function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});
	$('ul.menu li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}
$(document).ready(function() {initMenus();});

