
   $(document).ready(function(){
         	$("#footer li:last,#subnav li:last").addClass("last");
         	$("#subnav").append("<li class='cls'></li>");
			$("#subnav li:first").addClass("first");
			
			$("#nav li:last").parent().parent().addClass("last");
			
			//adds a hover class subnav li on hover for ie6
			$("#subnav li").hover(function(){
			    $(this).addClass("hover");
            },function(){
                $(this).removeClass("hover");
            });
			
			//hides and shows dropdowns for main nav
			//$("#nav li ul").hide();
			$("#nav li").hover(function(){
			    $(this).addClass("hover").find("ul");
            },function(){
                 $(this).removeClass("hover").find("ul");
                });
                
              // adds span to sidebar h3 to have arrow apart of last word for wrapping
              var h3Text = '';
              $('#lsidebar h3, #rsidebar h3').each(function() {
                var h3Array = $(this).text().split(' ');
                if(h3Array.length > 1){
                    h3Text  = $(this).text().replace(/ (\S+)$/,'&nbsp;<span>$1</span>');
                    $(this).html(h3Text);
                }else{
                    h3Text = $(this).text().replace(/(\S+)/,'<span>$1</span>');
                    $(this).html(h3Text);   
                }
              });
              
              // adds span to content h2#pagetitle to have arrow apart of last word for wrapping
               var h2Text = '';
               $('h2#pagetitle').each(function() {
                var h2Array = $(this).text().split(' ');
                if(h2Array.length > 1){
                    h2Text  = $(this).text().replace(/ (\S+)$/,'&nbsp;<span>$1</span>');
                    $(this).html(h2Text);
                    $(this).append("<div></div>");
                }else{
                    h2Text = $(this).text().replace(/(\S+)/,'<span>$1</span>');
                    $(this).html(h2Text);   
                    $(this).append("<div></div>");
                }
              });
            
            $('input.clickClear').focus(function() {
                startText = $(this).val();
                $(this).val('');
            });
            $('input.clickClear').blur(function() {
                blurText = $(this).val();
                if (blurText == '') {
                    $(this).val(startText);
                 };
            });
            
            //any element with .video class with href to flv or h.264 will pull up flash player in thickbox.
            $("a.video").click(function(){
                       var v = $(this).attr('href');
                TB_show('','/ajaxvideo.php?height=300&width=480&modal=true&vidurl='+v+"&TB_iframe=true",false);
                 return false;
            });
            
            $("#breadcrumbs").prepend("<a href='/'>Home > </a>");
            
   $('#subnav ul ').hide(); 
   $('#subnav li.current ul').show();
   $("#subnav li.current li:last").addClass('last');
   
   if($("#subnav li.current ul").length > 0){
       $("#subnav li.current").addClass("open"); 
   }
   
   
   //removes overview from subnav item
   var ov = $('#subnav li a').filter(":contains(Overview)").text();
   $('#subnav li a').filter(":contains(Overview)").text(ov.replace("Overview",""));
   
   
   //this removew pdf from any list item with an anchor that has a class of pdf and applies the class to the parent list item.
   $(".section li a.pdf").each(function(){
        $(this).removeClass("pdf");
        $(this).parent().addClass("pdf"); 
        
   });
   
   $("li.pdf").parent().addClass("pdful"); 
         
   // show and hide polls      
   /*$("#poll").hide();
		$("#opinion img").click(function(){
		    $("#poll").fadeIn("normal");
		    $(this).hide();
		    return false;
        });  */     

    //extracts http from links with mailto in them so mailto will work properly
    //var htp = $("#footer li a[href*='mailto']").attr("href");  
    //var rpl = htp.replace('http://','');
    
    //$("#footer li a[href*='mailto']").attr("href",rpl);
    
    $("#footer li a").each(function(){
        
        var t = $(this).attr("href"); 
        $(this).attr("href",t.replace("http://",""));
        
    });
   
        
});
     
     
