$(document).ready(function() {
	$('.slideshow').cycle({
		// fx: 'fade' choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed: 5000
	});
	
	 $('#ajaxSearch_input').focus(function () {
		if ($(this).val() == 'Search here...')
		$(this).val('');
	});

	// fancybox - lightbox alternatve
	$('a.lightbox').fancybox({
		'titlePosition'	: 'over'
	});


	$("a[href*=.pdf]:not(form a)").attr({"target":"_blank"});

	// hide select option list and submit button
	$('#msds_file').hide();
	$('#msds_file option:first').remove();
	$('#msds_form .ac_submit_btn').hide();
	// add in text box for autocomplete
	$('#msds_file').after('<input id="msds_code" name="msds_code" />');
	// build member options array
	var member_data=new Array();
	$('#msds_file option').each(function(){
		member_data.push($(this).html());
	});
	// autocomplete
	$("#msds_code").autocomplete(member_data,{
		matchContains:1,
		max:100
	});
	// autocomplete result
	$("#msds_code").result(function(event, data, formatted) {
		if (data)
			$('#msds_file option').each(function(){
				if (data[0] == $(this).html()){
					//$(this).attr('selected','selected');
			    		//var url ='/members/display?msds_file=' + $(this).attr('value');
			    		//window.location = url;
			    		$('#msds_search_res').html('<span>Download:</span><a href="/assets/files/members/msds/' + $(this).attr('value') + '" target="_blank">' + $(this).html() + '</a>');
			    	}
			});
	});

	
});



