

$(document).ready(
	function()
	{
		$('#myAccordion').Accordion(
			{
				headerSelector	: 'dt',
				panelSelector	: 'dd',
				activeClass		: 'myAccordionActive',
				hoverClass		: 'myAccordionHover',
				panelHeight		: 150,
				speed			: 300
			}
		);
		
		$('#warrant_search').submit(function()
	   	{
	   		jQuery.ajax(
	   		{
	   			type: "POST",
	   			data: {term: $("#search_term").val()},
	   			url: "/warrants/search.html",
	   			dataType: "html",
	   			timeout: 15000,
	   			error: function() {alert(r)},
	   			success: function(r) {$("#search_results").html(r)}
	   		});
	   		return false;
	   	});
	   	
	   	$('#search_term').ajaxStart(function(){
		   $("img#searching").attr("src","/images/28-1.gif");
		 });
		 
		$('#search_term').ajaxStop(function(){
		   $("img#searching").attr("src","/images/blank.png");
		 });
		 
		 $('#warrants h1 a').hover(function(){
		   $(this).animate({color: '#008400'}, "fast");
		},function(){
		   $(this).animate({color: '#006ec1'}, "fast");
		});
		
		$('#warrants_text p').hover(function(){
		   $(this).animate({backgroundImage: 'none', backgroundColor: '#618DAF', color: 'white'}, "fast");
		},function(){
		   $(this).animate({backgroundImage: 'url(../images/green_background_pattern.png)', color: 'black'}, "fast");
		});
		
		$('form[@name="info_form"]').livequery('submit', function()
		{
			$.fn.vals = function()
			{
				data = [];
				this.each(function(){ data.push(this.value); });
				return data;
			}
			var this_data = $("#search_results").find('input[@name="warrant_number[]"]').vals();
			
			jQuery.ajax(
	   		{
	   			type: "POST",
	   			data: $("#search_results").find('input[@name="warrant_number[]"][@checked]').serialize() + '&first_name='+$('input[@name="first_name"]').val() + '&last_name='+$('input[@name="last_name"]').val() + '&address='+$('textarea[@name="address"]').val() + '&city='+$('input[@name="city"]').val() + '&state='+$('select[@name="state"] option:selected').val() + '&zip='+$('input[@name="zip"]').val() + '&phone='+$('input[@name="phone"]').val() + '&email='+$('input[@name="email"]').val() + '&cc_type='+$('select[@name="cc_type"] option:selected').val() + '&cc_num='+$('input[@name="cc_num"]').val() + '&cc_month='+$('select[@name="cc_month"] option:selected').val() + '&cc_year='+$('select[@name="cc_year"] option:selected').val() + '&cvmvalue='+$('input[@name="cvmvalue"]').val(),
	   			url: $(this).attr('action'),
	   			dataType: "html",
	   			timeout: 15000,
	   			error: function() {alert(r)},
	   			success: function(r) {$("#payment_info").html(r)}
	   		});
	   		return false;
		});
});