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