jQuery.noConflict();
jQuery(document).ready(function() {
   
	// we add divs around dropdown or else they just vanish in IE6
	jQuery('#nav ul').wrap("<div></div>");
	
	jQuery('#nav > ol li').hover(
		function () {
			jQuery(this).find('ul').show();
		},
		function () {
			jQuery(this).find('ul').hide();
		}
	);
    
    if (jQuery('.autoclear').length) {
        jQuery(".autoclear").attr().focus(function(){
             
                var initial_values = ["Enter Text", "Enter Notes", "Enter Comment.", "USERNAME", "PASSWORD", "Enter Question", "Start typing school's name", "No data entered.", "Enter Subject", "Enter your name", "Enter your email", "Enter phone/email", "Enter location"];
            
                if(jQuery.inArray(jQuery(this).val(), initial_values) != -1){
                   jQuery(this).val("");
                }
                
                
                
           });
    }
    
    if ( jQuery('#addschool_input').length ){
        jQuery("#addschool_input").autocomplete("_inc/autocomplete.inc.php",
        {
            delay: 10,
            maxItemsToShow:10

        }
        ); 
    }
    
    if (jQuery('.section_info').length) {
        jQuery(".section_info").tooltip({
            
            fixPNG: true,
            showURL: false,
            showBody: "%-%"
            
        });
    }

// Monday, January 11, 2010 additions
    
	// we setup the collapsed states
	jQuery('.collapsing').hide().addClass("collapsed");
	jQuery('.trigger').addClass("collapsed");
	jQuery('.trigger').click(function() {
		if (jQuery(this).hasClass("collapsed")) {
			jQuery(this).removeClass("collapsed");
			jQuery(this).next(".collapsing").slideDown("slow").removeClass("collapsed");
		} else {
			jQuery(this).addClass("collapsed");
			jQuery(this).next(".collapsing").slideUp("slow").addClass("collapsed");
		}
	});
	
// Wednesday, April 7, 2010
	
	jQuery("#categories ul li").css('cursor', 'pointer'); // so it looks like a link
	jQuery("#categories ul li").click(function() {
		jQuery('.collapsing').slideUp("slow").addClass("collapsed");
		jQuery('.trigger').addClass("collapsed");
		var section = jQuery(this).attr("id").replace(/id/i, "section");
		var section = '#'+section + ' h3';
		if (jQuery(section).hasClass("collapsed")) {
			jQuery(section).removeClass("collapsed");
			jQuery(section).next(".collapsing").slideDown("slow").removeClass("collapsed");
		}
	});
	
	
});

function confirmSchoolDelete(id) {
    if (confirm("Are you sure you want to remove this school?")) {
        window.location = "dashboard.php?mode=ds&id=" + id
    } 
}

function showManualScore() {
    jQuery('#manual_score').show();
}

function toggleOther() {
    
    var other_choices = ['1','2','6'];
            
    if(jQuery.inArray(jQuery('#wdyh').val(), other_choices) != -1){
        jQuery('#wdyh_other').show();             
    } else {
        jQuery('#wdyh_other').hide();
    }
    
}





