// JavaScript Document

        //Submits Breeder Search Options form   
        function EduInfoSubmit(img, ref) 
        {
            document.forms.EduInfoForm.submit();
            return true;
        }
        //Submits Educational Info form
        function ClassifiedTermsSubmit(img, ref) 
        {
            if (document.forms.ClassifiedTerms.accept_terms.checked == false){
                alert("Please accept the terms of use.");
                return false;
            }
        document.forms.ClassifiedTerms.submit();
        //document.images[img].src = ref;
        return true;
            }


(function($){
    var jQuery=$;


    $(document).ready(function(){   

        //Hides the content in the divs                        
        $("a+div").css ({'display':'none'});                   

        //Display Content
        $("a[name]").click(function () {
            $(this).next().slideToggle("slow");
        });     
        
        //Finds anchor name in URL
        function extractPageName(hrefString)
        {
            var arr = hrefString.split('#');
            return arr [arr.length-1];                  
        }

        //Matches anchor in URl to anchor on page and opens the div.         
        var thisTarget = extractPageName(window.location.href);
        $('a[name='+thisTarget+']').next().slideToggle("slow"); 
            
        
        
        
        $("#termsAcceptance").dialog({
                    bgiframe: true,
                    height: 140,
                    modal: true,
                    autoOpen: false
                });

        
        $("form .navimage").bind("click", function(event){         
            
            if ( document.forms.ClassifiedTerms.accept_terms.checked == false) {
                // perhaps make this a jquery dialog???
                $("#termsAcceptance").dialog('open');
                //alert("Please accept the terms of use by clicking the 'I accept the above terms' after reading the specified term information.");                
            } else {
                document.forms.ClassifiedTerms.submit();                                
            }

        });
        
      
    });
    
    
    
    
    
})(jQuery);