$(document).ready(function()
{
	// Drop-down menu
	$('#big-nav').droppy();
	 
	// Drop-down search options
	$("#search-form input").focus(function() {
		$("#search-options").slideDown();
	});

	//search filters
	$("#search-form").submit(function() {
		
		var defaultAction = $("#search-form").attr("action");
		
		if($("#search-options #fs").is(':checked')) { //is staff search 
			$("#search-form").attr("action", defaultAction + "contact/staff-directory");
		}
			
		if($("#search-options #go").is(':checked')) { //is giving opps
			$("#search-form input#filter").attr("value", "giving");
			$("#search-form").attr("action", "/search");			
		}
	});

	//Hide the search options when anywhere outside element is clicked
	$('body').click(function(e) {
		var clicked=$(e.target); // get the element clicked
			if(clicked.is('input, #search-options, span') || clicked.parent().attr('id') == 'search-options') { 
		} else { 
			$("#search-options").slideUp();
		}
	}); 


	//clear search field onclick
	$("input#q").focus(function() {
		if (this.value == 'Search') {$(this).val("")}
	});
	$("input#q").blur(function() {
//		if (this.value == '') {$(this).val("Search")}
	});	

	// Pretty checkboxes for search options
	$('#search-options input[type=radio]').prettyCheckboxes({ //pretty checkboxes
		checkboxWidth: 17, // The width of your custom checkbox
		checkboxHeight: 12 // The height of your custom checkbox
	});
	
	// Homepage campus slider
    $("#bottom li:has(a.slide)").hover(function()
        {
			if ($(this).children("a.slide").is(':hidden')) {
				$(this).children("a.slide").slideDown("normal");
			}
       	},
     function() {
        $(this).children("a.slide").slideUp("fast");
     });	
 
 	//scroll to top
	 $('a[@href="#"]').click(function(){
				$('html, body').animate({scrollTop:0}, 'slow'); 
	        	return false;
	}); 

if ($('a.clueTip').cluetip) {
    $('a.clueTip').cluetip({
    local:        true,
    hideLocal: false,
    titleAttribute:   'title',
    showTitle: false 
  });
}

if ($('#houdini').cluetip) {
$('#houdini').cluetip({
    local: true,
    showTitle: false // hide the clueTip's heading
  });
}



});