		
	//  code to float the table headers and retain it on top the webpage   

	  /* this is for morningstar page */ 

        function scrollsubheader1() {					
            $("div.floatingsubheaddiv").each(function() {
                offset = $(this).offset();                
                scrollTop = $(window).scrollTop();                  
               
                if (scrollTop > offset.top) 
                {                                 
                    $(".scrollingsubhead", this).css("display", "block");                                                                                                                                          
                    //$(".scrollingsubhead", this).css("top", Math.min(scrollTop - offset.top - 5, $("div.container").height() + ($(document).scrollTop() + $(window).scrollTop()+ $(this).height() - 20)) + "px");                                                           
                    //**************************************
                  
                    $(".scrollingsubhead", this).css("top", Math.min(scrollTop - offset.top, $("span.container").height()) + "px");                                                                                
                }
                
               else {
				    $(".scrollingsubhead", this).css("display", "none");                                                                           
                    $(".scrollingsubhead", this).css("top", "0px");
			    }                        
            })
        }
            
        
        $(document).ready(function() {			
			//keep this to maintain the width of the table at all times			
			//$("table.floatingsubheaderClass").css("width", "850px");									
            $("table.floatingsubheadClass").each(function() {			
                $(this).wrap("<div class=\"floatingsubheaddiv\" style=\"position:relative\"></div>");           
                $("tr:first", this).before($("tr:first", this).clone());
                clonedHeaderRow = $("tr:first", this)
                clonedHeaderRow.addClass("scrollingsubhead");                
                clonedHeaderRow.css("position", "absolute");
                clonedHeaderRow.css("top", "-10px");
                clonedHeaderRow.css("left", "0px");                                
                clonedHeaderRow.css("display", "none");                
            });
            
            scrollsubheader1();
            $(window).scroll(scrollsubheader1);                       
                                          
        });        
           
           
        function scrolltableheader2() {					
            $("div.floatinghead").each(function() {
                offset = $(this).offset();
                scrollTop = $(window).scrollTop();           			
                if ((scrollTop > offset.top) && (scrollTop < offset.top + $(this).height())) {
                    $(".scrollheader", this).css("display", "block");                    
                    $(".scrollheader", this).css("top", Math.min(scrollTop - offset.top + 20, $(this).height() - $(".scrollheader", this).height()) + "px");                    
                }
                else {
                    $(".scrollheader", this).css("display", "none");
                    $(".scrollheader", this).css("top", "0px");
                }                             
            })
        }
        
        $(document).ready(function() {			
			//keep this to maintain the width of the table at all times			
			//$("table.floatingheaderClass").css("width", "850px");
			
			if ($.browser.mozilla) { 
				//alert(document.body.offsetWidth); //900														
				//alert($("tr:first").width()); //459
				
			};   		 						
            $("table.floatingheaderClass").each(function() {
			
                $(this).wrap("<div class=\"floatinghead\" style=\"position:relative\"></div>");               
                $("tr:first", this).before($("tr:first", this).clone());
                $("tr").css("width", "850px"); //needed for firefox to keep the header width intact
                clonedHeaderRow = $("tr:first", this)
                clonedHeaderRow.addClass("scrollheader");                
                clonedHeaderRow.css("position", "absolute");
                clonedHeaderRow.css("top", "0px");
                clonedHeaderRow.css("left", "0px");                
                clonedHeaderRow.css("display", "none");                
            });
            
            scrolltableheader2();
            $(window).scroll(scrolltableheader2);            
                                          
        });        
                       
            
        /* this is for Performance page */ 

        function scrolltopheader() {					
            $("div.floatingtopheaderdiv").each(function() {
                offset = $(this).offset();                
                scrollTop = $(window).scrollTop();                   
                //alert($(window).height());
                if (scrollTop > offset.top) 
                {
                    $(".scrollingtopheader", this).css("display", "block");                                                                           
                    $(".scrollingtopheader", this).css("top",Math.min(scrollTop - offset.top, $("div.container").height() + ($(document).scrollTop() + $(window).scrollTop())) + "px");                                        
                   
                }
               else {
					$(".scrollingtopheader", this).css("display", "none");                                                                           
                    $(".scrollingtopheader", this).css("top", "0px");
				}                        
            })
        }            
        
        $(document).ready(function() {			
			//keep this to maintain the width of the table at all times			
			//$("table.floatingsubheaderClass").css("width", "850px");
									
            $("table.topheaderClass").each(function() {			
                $(this).wrap("<div class=\"floatingtopheaderdiv\" style=\"position:relative\"></div>");               
                $("tr:first", this).before($("tr:first", this).clone());
                clonedHeaderRow = $("tr:first", this)
                clonedHeaderRow.addClass("scrollingtopheader");                
                clonedHeaderRow.css("position", "absolute");
                clonedHeaderRow.css("top", "0px");
                clonedHeaderRow.css("left", "0px");                                
                clonedHeaderRow.css("display", "none");                
            });
            
            scrolltopheader();
            $(window).scroll(scrolltopheader);                       
                                          
        });        


        function scrollsubheader() {					
            $("div.floatingsubheaderdiv").each(function() {
                offset = $(this).offset();                
                scrollTop = $(window).scrollTop();                   
                //alert($(window).height());
                if (scrollTop > offset.top) 
                {
                    $(".scrollingsubheader", this).css("display", "block");                                                                           
                    $(".scrollingsubheader", this).css("top",Math.min(scrollTop - offset.top+20, $("div.container").height() + ($(document).scrollTop() + $(window).scrollTop())) + "px");                                        
                   //Math.min(scrollTop - offset.top, $("div.container").height() + ($(document).scrollTop() + $(window).scrollTop()+ $(this).height() - 20)) + "px");                       
                }
               else {
					$(".scrollingsubheader", this).css("display", "none");                                                                           
                    $(".scrollingsubheader", this).css("top", "0px");
				}                        
            })
        }            
        
        $(document).ready(function() {			
			
									
            $("table.subheaderClass").each(function() {			
                $(this).wrap("<div class=\"floatingsubheaderdiv\" style=\"position:relative\"></div>");               
                $("tr:first", this).before($("tr:first", this).clone());
                clonedHeaderRow = $("tr:first", this)
                clonedHeaderRow.addClass("scrollingsubheader");                
                clonedHeaderRow.css("position", "absolute");
                clonedHeaderRow.css("top", "0px");
                clonedHeaderRow.css("left", "0px");                                
                clonedHeaderRow.css("display", "none");                
            });
            
            scrollsubheader();
            $(window).scroll(scrollsubheader);                       
                                          
        });        
           
        function scrolltableheader() {					
            $("div.floatingheaderdiv").each(function() {
                offset = $(this).offset();
                scrollTop = $(window).scrollTop();           			
                if ((scrollTop > offset.top) && (scrollTop < offset.top + $(this).height())) {
                    $(".scrollingheader", this).css("display", "block");                    
                    $(".scrollingheader", this).css("top", Math.min(scrollTop - offset.top + 40, $(this).height() - $(".scrollingheader", this).height()) + "px");                    
                }
                else {
                    $(".scrollingheader", this).css("display", "none");
                    $(".scrollingheader", this).css("top", "0px");
                }                             
            })
        }
        
        $(document).ready(function() {			
			
			if ($.browser.mozilla) { 
				//alert(document.body.offsetWidth); //900														
				//alert($("tr:first").width()); //459
				
			};   		 						
            $("table.floatingheaderClass3").each(function() {
			
                $(this).wrap("<div class=\"floatingheaderdiv\" style=\"position:relative\"></div>");               
                $("tr:first", this).before($("tr:first", this).clone());
                 $("tr").css("width", "850px"); //needed for firefox to keep the header width intact
                clonedHeaderRow = $("tr:first", this)
                clonedHeaderRow.addClass("scrollingheader");                
                clonedHeaderRow.css("position", "absolute");
                clonedHeaderRow.css("top", "0px");
                clonedHeaderRow.css("left", "0px");                
                clonedHeaderRow.css("display", "none");                
            });
            
            scrolltableheader();
            $(window).scroll(scrolltableheader);     
                                          
        });        
           