$(document).ready(function(){		

		var search_engine ="<div class=\"search_content\"><table valign=\"top\"  width=\"100%\" border=\"0\" cellpading=\"3\"><tr><td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Look in</b></td></tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"radio\" class=\"search_check\" name=\"search_engine\" value=\"g\" checked> Google  &nbsp;&nbsp;<input type =\"radio\" class=\"search_check\" name=\"search_engine\" value=\"c\"> Clusty </td></tr></table></div></form>";
		var people ="<div class=\"search_content\"><table valign=\"top\"  width=\"100%\" border=\"0\" cellpading=\"3\"><tr><td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Look in</b></td></tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"name\" value=\"n\" checked> Name  &nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"email\" value=\"e\" checked> Email </td>	</tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Include</b></td></tr><tr><td  height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"formerri\" value=\"f\"> Former RI Members  &nbsp;</td></tr></table></div></form>";
		var research ="<div class=\"search_content\"><table valign=\"top\"  width=\"100%\" border=\"0\" cellpading=\"3\"><tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Look in</b></td>		</tr>		<tr>		<td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" value='t' name=\"title\" checked> Title  &nbsp;&nbsp&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"description\" value='d' checked> Description </td>			</tr>	<tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Include</b></td>	</tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" value='i' name=\"inactiveproject\"> Inactive Projects </td>	</tr>	</table></div></form>";
		var publication ="<div class=\"search_content\"><table valign=\"top\"  width=\"100%\" border=\"0\" cellpading=\"3\"><tr><td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Look in</b></td></tr><tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"subject\" value='s' checked> Subject  &nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"author\" value='a' checked> Author </td>		</tr>			<tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"title\" value='t' checked> Title  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"abstract\" value='b' checked> Abstract </td>		</tr>	<tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Date Range</b></td>	</tr>	<tr>	<td  height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type=\"text\" size=\"10\" readonly name=\"start_date\" id=start_date>&nbsp;<a href=\"javascript:popupcal1();\"><img src=/images/site_images/calendar.gif border=0></a>&nbsp;</td>		</tr>			<tr>	<td  height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type=\"text\" size=\"10\" readonly name=\"end_date\" id=end_date>&nbsp;<a href=\"javascript:popupcal2();\"><img src=/images/site_images/calendar.gif border=0></a></td>	</tr>		</table></div></form>";
		var media ="<div class=\"search_content\"><table valign=\"top\" width=\"100%\" border=\"0\" cellpading=\"3\">	<tr>	<td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Look in</b></td>	</tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"title\" checked> Tile  &nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"title\" checked> Full-text</td>	</tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type =\"checkbox\" class=\"search_check\" name=\"title\" checked> Keywords</td>	</tr>	<tr><td height=\"18\" align=\"left\">&nbsp;&nbsp;<b>Date Range</b></td>	</tr>	<tr><td  height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type=\"text\" size=\"10\" readonly name=\"start_date\" id=start_date>&nbsp;<a href=\"javascript:popupcal1();\"><img src=/images/site_images/calendar.gif border=0></a></td>	</tr>	<tr><td  height=\"18\" align=\"left\">&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp;<input type=\"text\" size=\"10\" readonly name=\"end_date\" id=end_date>&nbsp;<a href=\"javascript:popupcal2();\"><img src=/images/site_images/calendar.gif border=0></a></td>	</tr>		</table></div></form>";

		$(".search_content").hide();	
		 $(".arrow_direction").click (function () {
							$(".search_content").toggle();	
							$("select option:selected").each( function () {
									var selectedVal = $(this).attr("value");	
									if( selectedVal != '99' ){
										$(".arrow_direction").toggleClass("arrow_direction1");
									}
							});
		});

	/**
		$(".expand_toggle").click (function () {
				 if ($("#expandedmenus").is(":hidden")) {
					$("#expandedmenus").slideDown("slow");					
				  } else {
					$("#expandedmenus").hide();
				 }				 
		});
	**/

		$("#search_category").change( function() {
				$("select:first option:selected").each( function () {
					var selectedVal = $(this).attr("value");							
					if(selectedVal =='01'){
						$(".search_content").remove();
						$("#search_div").append(people);
					}else if(selectedVal =='02'){			
						$(".search_content").remove();
						$("#search_div").append(research);
					}else if(selectedVal =='0307'){	
						$(".search_content").remove();
						$("#search_div").append(publication);
					}else if( (selectedVal =='04') || (selectedVal =='05') ) {						
						$(".search_content").remove();
						$("#search_div").append(media);
					}else if( (selectedVal =='00') || (selectedVal =='99') ) {
						$(".arrow_direction").addClass("arrow_direction");
						$(".search_content").remove();
						$("#search_div").append(search_engine);
					}
					$(".search_content").hide();	
				});
		});

		$('#start_date').datepicker( {showOn: "both", buttonImage: "/images/site_images/calendar.gif", buttonImageOnly: true} );	
		$('#end_date').datepicker( {showOn: "both", buttonImage: "/images/site_images/calendar.gif", buttonImageOnly: true} );	
		
  });

    function popupcal1(){
			$('.#start_date').datepicker({ buttonImageOnly: true});	
	}
	function popupcal2(){
			$('.#end_date').datepicker({ buttonImageOnly: true});	
	}

	function searchSubmit(){
		document.from0.submit();
	}
