//simple search, advanced search and search results functions

$(document).ready(function(){

	//jq tooltips  --  commented out because it's crashing IE7 on results page.

	$(".searchpage a.tooltip,.searchresults a.tooltip").Tooltip({track: true, showURL: false});
	$("a.tooltip").click(function () {		return false;	})//turn off clicking through if JS in enabled.
	//$("#donor_results th a").Tooltip({track: true, showURL: false});
	//$("#printresults").Tooltip({track: true, showURL: false});
	if (typeof document.body.style.maxHeight == 'undefined')  { // implement iframe tooltip fix in ie6 only
		$("#tooltip").bgiframe();
	}
	
	// donor page - mimic table striping on dls.
	$("#profile .infolisting dt:even, #profile .infolisting dd:even").addClass("evenrow");
	$("#profile .infolisting dt:even")
	.each(function(){
		var current = $(this);
		if(current.height() < current.next("dd").height()) current.height(current.next("dd").height());
	});





	// print function
	// (disabled by kf: using a url param to allow page expansion...)
	//$("#printresults").click(function () 	{window.print();}  	);

	//stripe donor results tables by adding a class to each even row
	//$("#donor_results tr:even, .data_chunk tr:even").addClass("evenrow");
	$("#donor_results, .data_chunk").each(function(){
		$(this).find("tr:even").addClass("evenrow");
	});


	// make the class stick when a 'must have' button is checked
	
	$("div.musthave label").click(function() {
	    $(this).toggleClass('musthavechecked');
	});



	// show/hide save search form
	$("#ImAHiddenDiv").toggleClass('hide2');
	$("#savesearch a").click( function() { $("#ImAHiddenDiv").toggleClass('hide2'); return false; });

	// remove tabs
	//$('#tabwrap li a').unbind("click");

	//$(".simplesearch #savesearch").click( function() { $("#ImAHiddenDiv").toggleClass('hide2'); });/*This one is a label - need it to return true.*/


	//load form customizer
/*
	$(".customize a").click(function () {
	 	$(".customizewrap").load("#APPLICATION.webroot#/Donor-Search/Search-Results/settingsForm.cfm",
			function() {
				$(this).slideToggle();
   			}//load func
		);//load

		return false;
	});
*/


/*
	//load form customizer
 	$(".customizewrap").load("#APPLICATION.webroot#/Donor-Search/Search-Results/settingsForm.cfm");//load

	$('.customizewrap').jqm({
		//ajax: '#APPLICATION.webroot#/Donor-Search/Search-Results/settingsForm.cfm',
		overlay: 50,
	    overlayClass: 'modal_overlay'
		});
*/
});//doc ready
