		$(document).ready(function()
		{
			$('#searchfloat').Draggable(
					{
						zIndex: 	20,
						ghosting:	false,
						opacity: 	0.7,
						handle:	'#searchfloatheading'
					}
				);	
			$('#searchfloat_form').ajaxForm({
				target: '#content',
				success: function() 
				{
					$("#searchfloat").hide();
				}				
			});			
			$("#searchfloat").hide();
						
			$('.searchdropdown').click(function()
			{
				method 		= this.id;
				selected	= $("#" + method + "val").val();
				name		= $("#" + method + "val").attr("name");
				$.ajax({
					type: "GET",
					url: "/search.php",
					data: "searchmethod=" + method + "&selected=" + selected,
					success: function(msg){
						$("#searchfloattitle").html(name);
						$("#searchfloatcontents").html(msg);
    					$("#searchfloat").fadeIn("fast");
   }
					});
			});
			
			
			
			$('#closesearchfloat').click(function()
			{
				$("#searchfloat").fadeOut("medium");
			});
			
			$(".searchcb").click(function()
			{
				alert('clicked');
				this.attr({ src: "/images/checked.gif" });
			});
		});

function searchcb(id) {
	
	var src = $('#searchoptionsrc' + id).attr("src");
	if (src == '/images/unchecked.gif')
		$('#searchoptionsrc' + id).attr({ src: "/images/checked.gif" });
	else
		$('#searchoptionsrc' + id).attr({ src: "/images/unchecked.gif" });
	
}

function applysearchopt(method) {
	
	var j = 0;
	var k = 0
	var selected = '';
	
	$(".searchcbimg").each(function (i, domEle) {
		var src = $(domEle).attr("src");
		k = k + 1;
		if (src == '/images/checked.gif') {
				var eleId		= this.id;
				var selectedId	= eleId.split("src");
				selected	= selected + selectedId[1] + ',';
				j = j + 1;
			}		
		 });

	var methodname = $("#" + method + "val").attr("name");
		
	if (j > 0 && j < k) {
		$("#" + method).html("- Select " + methodname + " -");
		$("#" + method + "val").val(selected);
	} else {
		$("#" + method).html("- Any " + methodname + " -");
		$("#" + method + "val").val('');
	}
		
	
		$("#searchfloat").fadeOut("medium");

}

function checkall() {
	$(".searchcbimg").attr({ src: "/images/checked.gif" });
}

function uncheckall() {
	$(".searchcbimg").attr({ src: "/images/unchecked.gif" });
}

function changedisplay (toShow, toShow2, toHide, toHide2) {
			$("#" + toHide).hide();
			$("#" + toHide2).hide();
			$("#" + toShow).show();
			$("#" + toShow2).show();
}

function clearInput(val) {
	var cVal = $('#keyword').val();
	if (cVal == val)
	$('#keyword').val(' ');
	
}