/* Google Maps */
function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("google_maps_small"));
        map.setMapType(G_NORMAL_MAP);
        var latLng=new GLatLng(51.506269,-0.090221);
        map.setCenter(latLng, 13);
         map.addOverlay(new GMarker(latLng));

        map.setUIToDefault();


      }
}
function SVinitialize() {
    if (GBrowserIsCompatible()) {
        var addison = new GLatLng(51.506269,-0.090221);
        myPOV = {yaw:-50};
panoramaOptions = {latlng:addison,pov:myPOV};
var myPano = new GStreetviewPanorama(document.getElementById("google_maps"), panoramaOptions);

      }
    }

/* End Google maps */

/*
 Main jquery code
 */
$(document).ready(function(){
     //$.preloadCssImages();

     // entire site fade in
     //$("body").hide();
     //$("body").fadeIn("slow");



     //slide show in portfolio
     $("#easy_slider").easySlider();

     $("#easy_slider2").easySlider({
         auto: true,
         continuous: false,
         speed:700,
         pause:2000


     });
     

   

     
     



     
	 /* Draggable */
	 $(".sub_nav").draggable();

         /* set height for sub nav if its under 235px */
        

         if (parseInt($(".page1 .sub_nav_content").height())<257)
             {
                 $(".page1 .sub_nav_content").css("height","257px");
             }

             if (parseInt($(".page2 .sub_nav_content").height())<257)
             {
                 $(".page2 .sub_nav_content").css("height","257px");
             }

             if (parseInt($(".page3 .sub_nav_content").height())<257)
             {
                 $(".page3 .sub_nav_content").css("height","257px");
             }
             if (parseInt($(".page4 .sub_nav_content").height())<257)
             {
                 $(".page4 .sub_nav_content").css("height","257px");
             }
         




        /* sub nav pager */
        var totalWidth=$("#home").width()+$("#home_page2").width()+$("#home_page3").width()+$("#home_page4").width();
        
        
        $("#home .right_arrow.page2").live("click",function(){
            $("body").css("width","400%");
            $("#home").css("width","25%");
            $("#home_page2").css("width","25%");
            $("#home_page3").css("width","25%");
            $("#home_page4").css("width","25%");

            

            $.scrollTo('#home_page2',700,{axis:'x'},{onAfter:function(){
                
                
                
                
                
            }});
        return false;
        });




        $("#home_page2 .left_arrow.page1").live("click",function(){
            


            
            $.scrollTo('#home',700,{onAfter:function(){
               
                
            }});
            return false;
        });


        $("#home_page2 .right_arrow.page3").live("click",function(){
            
            
            $.scrollTo('#home_page3',700,{onAfter:function(){
                
                
            }});
            return false;
        });


        $("#home_page3 .left_arrow.page2").live("click",function(){
            
            $.scrollTo('#home_page2',700,{onAfter:function(){
                
            }});
            return false;
        });
        
         $("#home_page3 .right_arrow.page4").live("click",function(){
            



            
            $.scrollTo('#home_page4',700,{onAfter:function(){
               
                
                
            }});
            return false;
        });


        $("#home_page4 .left_arrow.page3").live("click",function(){
            


            
            $.scrollTo('#home_page3',700,{onAfter:function(){
                

            }});
            return false;
        });





        /* end sub nav pager */









        $(".sub_nav").draggable();

        /* COLLAPSE SUBNAV */



         $(".sub_nav_collapse").live("click",function(){
             $(".sub_pager").toggle("fast",function(){
             });
             $(".right_arrow").toggle("fast",function(){
             });
             $(".left_arrow").toggle("fast",function(){
             });
             $(".sub_nav_content").slideToggle("fast",function(){
             });
             return false;
             });

        /* END COLLAPSE NAV */

                




           /* KEY PEOPLE filter menu */
            //all
            $(".key_people #filter_menu a[name='all']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".col1 div.people li").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".key_people #filter_menu a[name='A-E']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");

                $(".col1 div.people li").each(function(){
                    $(this).hide();
                });
                $(".col1 div.people li[title='A-E']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".key_people #filter_menu a[name='F-J']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".col1 div.people li").each(function(){
                    $(this).hide();
                });
                $(".col1 div.people li[title='F-J']").each(function(){
                    $(this).fadeIn("slow");
                });
               return false;
            });
            $(".key_people #filter_menu a[name='K-O']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".col1 div.people li").each(function(){
                    $(this).hide();
                });
                $(".col1 div.people li[title='K-O']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".key_people #filter_menu a[name='P-T']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".col1 div.people li").each(function(){
                    $(this).hide();
                });
                $(".col1 div.people li[title='P-T']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".key_people #filter_menu a[name='U-Z']").live("click",function(){
                $(".key_people #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".col1 div.people li").each(function(){
                    $(this).hide();
                });
                $(".col1 div.people li[title='U-Z']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
           
            /* END KEY PEOPLE filter menu */









            /* AREAS OF EXPERTISE filter menu */
            //all
            $(".expertise #filter_menu a[name='all']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='corporateReporting']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='corporateReporting']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='corporateResponsibilityReporting']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='corporateResponsibilityReporting']").each(function(){
                    $(this).fadeIn("slow");
                });
               return false;
            });
            $(".expertise #filter_menu a[name='corporateCommunications']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='corporateCommunications']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='internalCommunications']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='internalCommunications']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='corporateFinance']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='corporateFinance']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='corporateIdentityManagement']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='corporateIdentityManagement']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".expertise #filter_menu a[name='online']").live("click",function(){
                $(".expertise #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.Areas_Expertise").each(function(){
                    $(this).hide();
                });
                $("div[title='online']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            /* END AREAS OF EXPERTISE filter menu */




            /* OUR CAPABILITES filter menu */
            //all
            $(".capabilities #filter_menu a[name='all']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");


                $("div.our_capabilities").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".capabilities #filter_menu a[name='consultancy']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");

                $("div.our_capabilities").each(function(){
                    $(this).hide();
                });
                $("div[title='consultancy']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".capabilities #filter_menu a[name='design']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.our_capabilities").each(function(){
                    $(this).hide();
                });
                $("div[title='design']").each(function(){
                    $(this).fadeIn("slow");
                });
               return false;
            });
            $(".capabilities #filter_menu a[name='projectManagement']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.our_capabilities").each(function(){
                    $(this).hide();
                });
                $("div[title='projectManagement']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".capabilities #filter_menu a[name='production']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.our_capabilities").each(function(){
                    $(this).hide();
                });
                $("div[title='production']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });


            /* END OUR CAPABILITES filter menu */





            /* RESEARCH OVERVIEW filter menu */

            //all
            $(".overview #filter_menu a[name='all']").live("click",function(){
                $(".capabilities #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");


                $(".overview div.news").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".overview #filter_menu a[name='riskyBusiness']").live("click",function(){
                $(".overview #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");

                $(".overview div.news").each(function(){
                    $(this).hide();
                });
                $("div[title='riskyBusiness']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".overview #filter_menu a[name='unitedInDiversity']").live("click",function(){
                $(".overview #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".overview div.news").each(function(){
                    $(this).hide();
                });
                $("div[title='unitedInDiversity']").each(function(){
                    $(this).fadeIn("slow");
                });
               return false;
            });
            $(".overview #filter_menu a[name='merryGoRound']").live("click",function(){
                $(".overview #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".overview div.news").each(function(){
                    $(this).hide();
                });
                $("div[title='merryGoRound']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });
            $(".overview #filter_menu a[name='stormInTeacup']").live("click",function(){
                $(".overview #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".overview div.news").each(function(){
                    $(this).hide();
                });
                $("div[title='stormInTeacup']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });

            $(".overview #filter_menu a[name='reportAnalytics']").live("click",function(){
                $(".overview #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".overview div.news").each(function(){
                    $(this).hide();
                });
                $("div[title='reportAnalytics']").each(function(){
                    $(this).fadeIn("slow");
                });
                return false;
            });



            /* END RESEARCH OVERVIEW filter menu */



            


            /* TERMS filter menu */
            //all
            $("#filter_menu a[name='all']").live("click",function(){
                $("#terms #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.terms").each(function(){
                    $(this).fadeIn("slow")
                });
            });

            $("#filter_menu a[name='terms']").live("click",function(){
                $("#terms #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.terms").each(function(){
                    $(this).hide;
                });
                $("div[title='terms']").each(function(){
                    $(this).fadeIn("slow");
                });
            });

            $("#filter_menu a[name='privacy']").live("click",function(){
                $("#terms #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.terms").each(function(){
                    $(this).hide();
                });
                $("div[title='privacy']").each(function(){
                    $(this).fadeIn("slow");
                });
            });


            $("#filter_menu a[name='accessibility']").live("click",function(){
                $("#terms #filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $("div.terms").each(function(){
                    $(this).hide();
                });
                $("div[title='accessibility']").each(function(){
                    $(this).fadeIn("slow");
                });
            });

            /* END TERMS filter menu */





            /* KEY PEOPLE filter menu */
            //all
            $("#filter_menu a[name='all']").live("click",function(){
                $("div.people").each(function(){
                    $(this).css("display","block");
                });
            });

            /* END KEY PEOPLE filter menu */






            /* LATEST NEWS filter menu */

            

            // margin at top
            $(".latest .col1 .newsDate:first").css("margin-top","0");
            var theUrl=location.href;
            theUrl=theUrl.toLowerCase();

            if (theUrl.indexOf("/news/the_latest")>-1){
                $(".latest .2007").hide();
                $(".latest .2008").hide();
                
            };

            // ALL
            

            $("#filter_menu a[title='all_news']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .news").not(".2007").not(".2008").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });


            // NEW CLIENTS

            $("#filter_menu a[title='new_clients']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current"); 
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .new_clients").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });
            
            
            
            // NEW PROJECTS
            
            $("#filter_menu a[title='new_projects']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current"); 
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .new_projects").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });

            // NEW PEOPLE

            $("#filter_menu a[title='new_people']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .new_people").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                addDate();
                return false;
            });

            // THE LATEST
            $("#filter_menu a[title='the_latest']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .2009").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });

            // 2009
            $("#filter_menu a[title='2009']").live("click",function(){

                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .2009").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });


                addDate();
                return false;
            });

            // 2008
            $("#filter_menu a[title='2008']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .2008").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });


            // 2007
            $("#filter_menu a[title='2007']").live("click",function(){
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".latest .news").each(function(){
                    $(this).hide().addClass('hidden');

                });
                $(".latest .2007").each(function(){
                    $(this).fadeIn("slow").removeClass('hidden');

                });
                
                
                addDate();
                return false;
            });


            //Clever bit that adds the months
            function addDate(){
            $("p.newsDate").remove();
            $("p.newsDateTop").each(function(){
                $(this).remove();
            });

            for (i=1;i<5;i++){
                var thedate;

            switch(i)
            {
            case 1:
              thedate='09';
              break;
            case 2:
              thedate='08';
              break;
            case 3:
              thedate='07';
              break;
            case 4:
              thedate='10';
              break;
            };

            $(".jan"+thedate).each(function(){
               if ($(".jan"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">January '+thedate+'</p>');
               }
            });
            $(".feb"+thedate).each(function(){
               if ($(".feb"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">February '+thedate+'</p>');
               }
            });
            $(".mar"+thedate).each(function(){
               if ($(".mar"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">March '+thedate+'</p>');
               }
            });
            $(".apr"+thedate).each(function(){
               if ($(".apr"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">April '+thedate+'</p>');
               }
            });
            $(".may"+thedate).each(function(){
               if ($(".may"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">May '+thedate+'</p>');
               }
            });
            $(".jun"+thedate).each(function(){
               if ($(".jun"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">June '+thedate+'</p>');
               }
            });
            $(".jul"+thedate).each(function(){
               if ($(".jul"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">July '+thedate+'</p>');
               }
            });
            $(".aug"+thedate).each(function(){
               if ($(".aug"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">August '+thedate+'</p>');
               }
            });
            $(".sep"+thedate).each(function(){
               if ($(".sep"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">September '+thedate+'</p>');
               }
            });
            $(".oct"+thedate).each(function(){
               if ($(".oct"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">October '+thedate+'</p>');
               }
            });
            $(".nov"+thedate).each(function(){
               if ($(".nov"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">November '+thedate+'</p>');
               }
            });
            $(".dec"+thedate).each(function(){
               if ($(".dec"+thedate).not('.hidden').index(this)==0){
               $(this).before('<p class="newsDate">December '+thedate+'</p>');
               }
            });
            }; // end for loop

            








            /*
            // first date at top
            $("p.newsDate:first").not('.hidden').removeClass("newsDate").addClass("newsDateTop");
            // margin at top
            $(".latest .col1 .news:not('.hidden'):first").css("margin-top","0");
            */


            $("#news p.newsDate").eq(0).css("margin-top","0");
            };
        

            /* END LATEST NEWS filter menu */











            /* PORTFOLIO Filter Menu */
            // make menu appear on click of link
            // PORTFOLIO FILTER BY SECTION
            // Make dropdown appear
            var j=0;
            var k=0;
            $("#portfolio #filter").live("click",function(){
                $("ul.all_clients").css("background-color","#f8f8f7");
                k=k+1;
                if (k==1) {
                    $("#down_arrow").html('<img alt="" src="http://www.addison.co.uk/images/up_arrow.gif"/>');
                    
                }
                else if (k==2) {
                    $("#down_arrow").html('<img alt="" src="http://www.addison.co.uk/images/down_arrow.gif"/>');
                    k=0;
                };
                
                
                document.location.hash="view_all";
               $("#portfolio .view_all").hide();
               $("#portfolio #filter_menu").toggle("slow",function(){

                   $("ul.all_clients").css("background-color","transparent");
               });
               
               if (j<2){
               $("#portfolio h3").fadeOut(function(){
                 $("#portfolio h3").html("Projects");
               });

               $("#portfolio h3").fadeIn();
               };
               return false;

            });

            $("#portfolio .view_all").live("click",function(){
                j=j+1;
                document.location.hash="view_all";
                $(this).hide();
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $(".portfolio_item").fadeIn();
                if (j<=1){
                $("#portfolio h3").fadeOut(function(){
                 $("#portfolio h3").html("Projects");
                });

               $("#portfolio h3").fadeIn();
                };
               return false;

            });
             





            


            // Alphabetical
            $("#portfolio #filter_menu a[title='all']").live("click",function(){
                document.location.hash="view_all";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });


            $("#portfolio #filter_menu a[title='A-E']").live("click",function(){
                document.location.hash="a-e";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                $(".portfolio_item").hide();
                $("#portfolio [name='A-E']").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("#portfolio #filter_menu a[title='F-J']").live("click",function(){
                document.location.hash="f-j";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                $(".portfolio_item").hide();
                $("#portfolio [name='F-J']").fadeIn("slow");
               // var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("#portfolio #filter_menu a[title='K-O']").live("click",function(){
                document.location.hash="k-o";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                $(".portfolio_item").hide();
                $("#portfolio [name='K-O']").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("#portfolio #filter_menu a[title='P-T']").live("click",function(){
                document.location.hash="p-t";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                $(".portfolio_item").hide();
                $("#portfolio [name='P-T']").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });


            $("#portfolio #filter_menu a[title='U-Z']").live("click",function(){
                document.location.hash="u-z";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").fadeIn();
                $(".portfolio_item").hide();
                $("#portfolio [name='U-Z']").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            
            


            // end Alphabetical


            // Filter by discipline
            $("#portfolio #filter_menu a[title='all']").live("click",function(){
                document.location.hash="view_all";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".portfolio_item").fadeIn();
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });
            $("a[title='corporateReporting']").live("click",function(){
                document.location.hash="corporateReporting";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".corporateReporting").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("a[title='corporateResponsibility']").live("click",function(){
                document.location.hash="corporateResponsibility";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".corporateResponsibility").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });


            $("a[title='communications']").live("click",function(){
                document.location.hash="communications";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".communications").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("a[title='corporateFinance']").live("click",function(){
                document.location.hash="corporateFinance";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".corporateFinance").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("a[title='identityManagement']").live("click",function(){
                document.location.hash="identityManagement";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".identityManagement").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });

            $("a[title='online']").live("click",function(){
                document.location.hash="online_";
                $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $(this).addClass("current");
                $(".portfolio_item").hide();
                $(".online").fadeIn("slow");
                //var t=setTimeout('$("#portfolio #filter_menu").slideUp("slow")',2000);
                return false;
            });



            // END PORTFOLIO FILTER BY SECTION



            // If clicked through from online link - show online
            
            if (document.location.hash=="#online"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='online']").addClass("current");
                
                $(".online").fadeIn("slow");
                $("#portfolio h3").html("Online projects");

                
                $("#portfolio").show();
            };
            $("#portfolio #filter_menu a").live("click",function(){
                $("#portfolio h3").html("Projects");
            });
            // End  clicked through from online link - show online






            // Remember state if leaving to client page


            if (document.location.hash=="#view_all"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $(".portfolio_item").hide();
                $(".portfolio_item").fadeIn("slow");
                //$("#portfolio #filter_menu").slideDown("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
                
            };



            if (document.location.hash=="#a-e"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='A-E']").addClass("current");
                $(".portfolio_item").hide();
                $("#portfolio [name='A-E']").fadeIn("slow");
                $("#portfolio h3").html("Projects");
               $("#portfolio").show();
            };


            if (document.location.hash=="#f-j"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='F-J']").addClass("current");
                $(".portfolio_item").hide();
                $("#portfolio [name='F-J']").fadeIn("slow");
                $("#portfolio h3").html("Projects");
             $("#portfolio").show();
            };


            if (document.location.hash=="#k-o"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='K-O']").addClass("current");
                $(".portfolio_item").hide();
                $("#portfolio [name='K-O']").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            if (document.location.hash=="#p-t"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
            $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='P-T']").addClass("current");
                $(".portfolio_item").hide();
                $("#portfolio [name='P-T']").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };

            if (document.location.hash=="#u-z"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
            $("#featured_clients").hide();
                $(".portfolio_item").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='U-Z']").addClass("current");
                $(".portfolio_item").hide();
                $("#portfolio [name='U-Z']").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };

            if (document.location.hash=="#corporateReporting"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='corporateReporting']").addClass("current");
                $(".portfolio_item").hide();
                $(".corporateReporting").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            if (document.location.hash=="#corporateResponsibility"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='corporateResponsibility']").addClass("current");
                $(".portfolio_item").hide();
                $(".corporateResponsibility").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };



            if (document.location.hash=="#communications"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();;
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='communications']").addClass("current");
                $(".portfolio_item").hide();
                $(".communications").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            if (document.location.hash=="#corporateFinance"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='corporateFinance']").addClass("current");
                $(".portfolio_item").hide();
                $(".corporateFinance").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            if (document.location.hash=="#identityManagement"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='identityManagement']").addClass("current");
                $(".portfolio_item").hide();
                $(".identityManagement").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            if (document.location.hash=="#online_"){
                $(".portfolio_item").hide();
                $("#featured_clients").hide();
                $("#portfolio .view_all").hide();
                $("#filter_menu a").each(function(){
                   $(this).removeClass("current");
                });
                $("a[title='online']").addClass("current");
                $(".portfolio_item").hide();
                $(".online").fadeIn("slow");
                $("#portfolio h3").html("Projects");
                $("#portfolio").show();
            };


            // on load of page if hash blank make body visible
            if (document.location.hash==""){
                $("#portfolio").show();
            };

            // End Remember state if leaving to client page







            /* End PORTFOLIO Filter Menu */

            /* PORTFOLIO BACK LINK */
            $(".latest #back").live("click",function(){
               window.history.back();
            });
            /* END PORTFOLIO BACK LINK */


            

            // CASE STUDY LINKS OPEN IN BLANK WINDOW
            $('.project_overview .col2 a').live("click",function(){
            this.target = "_blank";
            });

            //Projects Page scroll
            var theUrl=location.href;
            theUrl=theUrl.toLowerCase();

            if (theUrl.indexOf("our_clients/projects/")>-1){
                $('html').css("overflow","auto");
            }
            


            // PORTFOLIO PAGE FLASHING FILTER

            var i=0;
            //fadeCount();
            function fadeCount()
            {
            $("h4.filter_dropdown").fadeOut("slow",function(){
                $("h4.filter_dropdown").fadeIn("slow");
            });
            i=i+1;
            if (i<4){
            if (i==0){
            t=setTimeout(fadeCount,8000);
            }
            else {
            t=setTimeout(fadeCount,4000);
            };
            };
            };
            
            

            // END PORTFOLIO PAGE FLASHING FILTER


            /* easy slider projects page */
            $('#easy_slider').append('<div class="white_opaque_bar">&nbsp;</div><div id="pager"><span class="thisPage">1</span>/<span class="totalPage"></span></div>');
              
             /* PORTFOLIO SLIDE SHOW */
           $("#pager .totalPage").html($("#easy_slider li").size());

           $("#nextBtn").live("click",function(){
               $("#pager .thisPage").html(parseInt($("#pager .thisPage").html())+1);
           });
           $("#prevBtn").live("click",function(){
               $("#pager .thisPage").html(parseInt($("#pager .thisPage").html())-1);
           });
           /* END PORTFOLIO SLIDE SHOW */


            /* End easy slider projects page */
            
            
            /* easy slider 2 projects page */
            
            $('#easy_slider2').append('<div class="white_opaque_bar">&nbsp;</div><div id="pager2"><span class="thisPage">1</span>/<span class="totalPage"></span></div>');

            /* INDIVIDUAL CLIENT PORTFOLIO SLIDE SHOW */
           $("#pager2 .totalPage").html($("#easy_slider2 li").size());

          // $("#nextBtn").live("click",function(){
              // $("#pager2 .thisPage").html(parseInt($("#pager2 .thisPage").html())+1);
           //});
          // $("#prevBtn").live("click",function(){
              // $("#pager2 .thisPage").html(parseInt($("#pager2 .thisPage").html())-1);
          // });
           /* END INDIVIDUAL CLIENT PORTFOLIO SLIDE SHOW */
            /* End easy slider 2 projects page */

            




            /* CAREER CV */
            $("#careers #file").live("change",function(){
                $("#careers #file_field").html($("#careers #file").val());
                ;
            });
            $("#careers #submit_career").live("click",function(){
                $("#cvForm").submit();
                $("#email_cv").css("display","none");
                $("#careers #thanks_cv").fadeIn("slow");
                return false;
            });
            
                $("#cvForm").ajaxForm(function(){
                   
                });
                
            
            /* END CAREER CV */


            /* links in blank windows */
            $(".blank").live("click",function(){
               this.target = "_blank";
            });


            /* CHANGE BACKGROUND IF THE USER HAS 1024 X 768 */
            if  ($(window).width()<1025){
                $(".sub_nav").css("top","50px");
                $("#home").css("background-image","url(images/risky_business_home_1024.jpg");
                $("#home_page2").css("background-image","url(images/heineken_online_bg_1024.jpg)");
                $("#home_page3").css("background-image","url(images/research_bg_1024.jpg)");
                $("#home_page4").css("background-image","url(images/risky_business_home_1024.jpg)");

                $("#about_us").css("background-image","url(../images/about_us_bg_1024.jpg)");
                $(".wpp").css("background-image","url(../images/wpp_bg_1024.jpg)");


                $("#what_we_do").css("background-image","url(../images/what_we_do_bg_1024.jpg)");


                $("#our_clients").css("background-image","url(../images/our_clients_bg_1024.jpg)");
                $("#our_clients.portfolio").css("background-image","none");



                $("#research").css("background-image","url(../images/research1_bg_1024.jpg)");
                $("#research.overview").css("background-image","none");

                

            };

});