$(document).ready(function () {
	
	$('#advancedSearch').click(function(){
		
		if ($('#extraSearchOptions').css('display') == 'none'){
			$('#advancedSearch img').attr('src', '/images/small-minus-ms.gif');
		} else {
			$('#advancedSearch img').attr('src', '/images/small-plus-ms.gif')
		}
		$('#extraSearchOptions').slideToggle(700, 'easeOutExpo');
	});
	

	$('.lowerRads').click(function(){
		$(this).children("input:radio").attr("checked",true);
		$("input[name='SortBy']").parent().removeClass('lowerRadSelected');
		$("input[name='SortBy']:checked").parent().addClass('lowerRadSelected');
		
	});
	
	$('#searchLink').click(function(){
		SubmitQueryForm();
	});
	
	$('#frmSearch select').change(function(){
		if($(this).attr('id') == 'ManufacturerId'){
			clearmodel();
			showCustomer(true);
		} else {
			showCustomer(true);
		}
	});
	
	$('.searchType').click(function(){
		
		checkVal = $(this).attr('id');
		var currentClasses = $(this).attr('class');
		if(currentClasses.indexOf('searchTypeSelected') > -1){
			$(this).removeClass('searchTypeSelected');
			checkVal = "None";
		} else {
			$('.searchType').removeClass('searchTypeSelected');
			$(this).addClass('searchTypeSelected')
		}
		
		if(checkVal == "New"){
			$("select[name='ConditionId']").val('2');
			$("select[name='BodyTypeId']").val('-1');
			showCustomer(true);
		}
		if(checkVal == "Used"){
			$("select[name='ConditionId']").val('1');
			$("select[name='BodyTypeId']").val('-1');
			showCustomer(true);
		}
		if(checkVal == "Vans"){
			$("select[name='BodyTypeId']").val('1');
			$("select[name='ConditionId']").val('-1');
			showCustomer(true);
		}
		if(checkVal == "None"){
			$("select[name='BodyTypeId']").val('-1');
			$("select[name='ConditionId']").val('-1');
			showCustomer(true);
		}
	});
	
	showCustomer(true,-1,135);
	
	
});
