$(document).ready(function(){
	
	$('select#schools').change(function() {
		eval("parent.location='"+$(this).attr('value')+"'");
	});

	$('select#quicklinks').change(function() {
		eval("parent.location='"+$(this).attr('value')+"'");
	});
	   
    // Clear input boxes on focus
    $('.autoclear').autoClear();
    
	// Main Nav Dropdown
	$('.topNavigation li.children').hover(function(){
		$(this).addClass('open');
		$(this).children('ul').show();
	}, function(){
		$(this).removeClass('open');
		$(this).children('ul').hide();
	});
	
	// Don't let tertiary level dropdown
	$('.topNavigation ul li.children ul li.children').hover(function(){
		$(this).children('ul').hide();
	});    
	
	/* Quote Marks*/
    $('blockquote p').prepend(" <span class='bqstart'>&#8220;</span> ");
    $('blockquote p').append(" <span class='bqend'>&#8221;</span> ");
    
      //hide/show title/ 'x' when clicking input
    $('.text_filter input').blur(function() { 
	if( $('.text_filter input').val() == '' ) {
    	$(".text_filter .clear_button").hide();
	}
	}).focus(function() {
    	$(".text_filter .clear_button").show();
	});
    
    //hide 'x', show title when clicking 'x', reset filter
    $(".text_filter .clear_button").click(function(){
    	$(this).prev('input').val('');
    	$(this).prev('input').trigger('keyup');
    	$(this).hide();
    
	});
    
// end
});

/* INPUT AUTOCLEAR
-------------------------------------------------- */
(function($) {

    $.fn.autoClear = function() {	
        return this.each(function() {
            $(this).focus(function() {
                if( this.value == this.defaultValue ) {
                    this.value = "";
                }
            })
            .blur(function() {
                if( !this.value.length ) {
                    this.value = this.defaultValue;
                }
            });
        });
    };

})(jQuery);
