

        //Browser Detection code
        
        var margin_top;
		var margin_left_shift;
		var CurrentActiveTab;
		
        var bname = navigator.appName;
        if (bname.search(/netscape/i) == 0) {
            margin_top = '-41px';
			margin_left_shift=40;
        }
        else if (bname.search(/microsoft/i) == 0) {
            margin_top = '-41px';
			margin_left_shift=40;
        }
        else {
            margin_top = '-41px';
			margin_left_shift=40;
        }

        // END Browser Detection code
       
       function ShowTab(ID) {

            HideTab();
            			
            switch (ID) {

                case '1':
                    {
                        $('#Tab1').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': -1 +margin_left_shift+'px' }).show();
                        break;
                    }

                case '2':
                    {
                        $('#Tab2').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 143+margin_left_shift+'px' }).show();
                    
                        break;
                    }

                case '3':
                    {
                        $('#Tab3').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 270 +margin_left_shift+'px', 'margin-right': '0px', 'margin-bottom': '0px' }).show();
                      
                        break;
                    }
                case '4':
                    {
                        $('#Tab4').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 390 +margin_left_shift+'px' }).show();

                        break;
                    }

                case '5':
                    {
                        $('#Tab5').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': '-42px', 'margin-left': 521+margin_left_shift+'px' }).show();

                        break;
                    }

                case '6':
                    {
                        $('#Tab6').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 644+margin_left_shift+'px' }).show();

                        break;
                    }

                case '7':
                    { 
                        $('#Tab7').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 764+margin_left_shift+'px' }).show();

                        break;
                    }
					case '8':
                    { 
                        $('#Tab8').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': margin_top, 'margin-left': 876+margin_left_shift+'px' }).show();

                        break;
                    }
            }


        }

	 
	  
	  
        function ShowMenu(ID) {

            HideMenu();
            			
            switch (ID) {

                case '1':
                    {
                        ShowTab('1');
                        break;
                    }

                case '2':
                    {
                     				  
					   ShowTab('2'); 
					   $('#Menu2').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': '0px', 'margin-left': 144 +margin_left_shift+'px' }).show();
					 
                        break;
                    }

                case '3':
                    {
                        
                       ShowTab('3');			   
					   $('#Menu3').css({ 'position': 'absolute', 'z-index': '10000', 'margin-top': '0px', 'margin-left': 272 +margin_left_shift+'px' }).show();
					   

                        break;
                    }
                case '4':
                    {
                       	ShowTab('4');
                        break;
                    }

                case '5':
                    {
                        ShowTab('5');
                        break;
                    }

                case '6':
                    {
                        ShowTab('6');
                        break;
                    }

                case '7':
                    { 
                       	ShowTab('7');
                        break;
                    }
					case '8':
                    { 
                       	ShowTab('8');
                        break;
                    }
            }


        }

        function HideMenu() {


            $('#Tab1').hide();

            $('#Tab2').hide();
            $('#Menu2').hide();

            $('#Tab3').hide();
            $('#Menu3').hide();

            $('#Tab4').hide();

            $('#Tab5').hide();

            $('#Tab6').hide();
            
            $('#Tab7').hide();
			
			$('#Tab8').hide();
			
			//ShowTab(CurrentActiveTab);

        }
		
		
		function HideTab() {


            $('#Tab1').hide();

            $('#Tab2').hide();
           
            $('#Tab3').hide();
           
            $('#Tab4').hide();

            $('#Tab5').hide();

            $('#Tab6').hide();
            
            $('#Tab7').hide();
			
			 $('#Tab8').hide();
			
			//$('#Tab'+ CurrentActiveTab).show();


        }

		function SetTabByURL()
		{
		 
		 	 var CurrentURL=document.location.href; 
			
             if(CurrentURL.indexOf('http://www.bonitatrust.org')!=-1)
			 {
					CurrentActiveTab=1;
					ShowTab('1');
				
						 
			 }
			 else if((CurrentURL.indexOf('/about.html')!=-1)||(CurrentURL.indexOf('/about-trustees.html')!=-1)||(CurrentURL.indexOf('/about-management.html')!=-1)||(CurrentURL.indexOf('/about-board.html')!=-1)||(CurrentURL.indexOf('/about-mission.html')!=-1)||(CurrentURL.indexOf('/about-news.html')!=-1))
			 {
				   CurrentActiveTab=2;
				   ShowTab('2');	
			 }
			 else if((CurrentURL.indexOf('/projects.html')!=-1)||(CurrentURL.indexOf('/gibprojects.html')!=-1)||(CurrentURL.indexOf('/ukprojects.html')!=-1)||(CurrentURL.indexOf('/indiaprojects.html')!=-1)||(CurrentURL.indexOf('/israelprojects.html')!=-1))
			 {
				   CurrentActiveTab=3;
				   ShowTab('3');	
			 }
			 else if(CurrentURL.indexOf('/grant.html')!=-1)
			 { 	   
			 	   CurrentActiveTab=4;
			       ShowTab('4');	
			 }
			  else if(CurrentURL.indexOf('/contact.html')!=-1)
			 {
			       CurrentActiveTab=5;
				   ShowTab('5');	
			 }
			  else if(CurrentURL.indexOf('/what-we-do.html')!=-1)
			 {
			  		CurrentActiveTab=6;
					ShowTab('6');	
			 }
			  else if(CurrentURL.indexOf('/contact.html')!=-1)
			 {
			  		CurrentActiveTab=7;
					ShowTab('7');	
			 }
		
		}

        $().ready(function() { $('#middle').mouseover(function() { HideMenu();SetTabByURL(); }); });
       
	    $().ready(function(){ SetTabByURL();});


