$(function(){


	$('.MoreInfoBox').hide();
	$('.SimilarBox').hide();
	$('#vehicleType').hide();
	$('#filters').hide();
	
	$('.moreinfo').livequery('click',function(event) {
	
		var index = $('.moreinfo').index(this);
		
		var sim = $('.similar')[index];
		sim.src = "/us/wgcsearch/images/similar.png";
		
		//next bit of code use to make sure the right image is replaced
		//IE resets the image src when using Ajax !
		var src = $(this).attr("src");
		var strMatch = /moreinfo.png/;
		var matchPos = src.search(strMatch);
		
		if(matchPos != -1) {
			$(this).attr("src","/us/wgcsearch/images/moreinfo-on.png");
		} else {
		
			$(this).attr("src","/us/wgcsearch/images/moreinfo.png");
		}
		
		$('#SimilarBox' + index).hide('slow', function() {
			$('#MoreInfoBox' + index).slideToggle('slow');
			if (jQuery.browser.msie)  
            this.style.removeAttribute('filter');
		});


	})
	
	$('.similar').livequery('click',function(event) {
	
		var index2 = $('.similar').index(this);
		
		var moreinfo = $('.moreinfo')[index2];
		moreinfo.src = "/us/wgcsearch/images/moreinfo.png";
		
		//next bit of code use to make sure the right image is replaced
		//IE resets the image src when using Ajax !
		var src = $(this).attr("src");
		var strMatch = /similar.png/;
		var matchPos = src.search(strMatch);
		
		if(matchPos != -1) {
			$(this).attr("src","/us/wgcsearch/images/similar-on.png");
		} else {
		
			$(this).attr("src","/us/wgcsearch/images/similar.png");
		}
		
		$('#MoreInfoBox' + index2).hide('slow', function() {
			$("#SimilarBox" + index2).slideToggle("slow");
			if (jQuery.browser.msie)  
            this.style.removeAttribute('filter');
		});
	})
	
	
	$('#showvtype').click(function(event) {
			 
			$("#vehicleType" ).slideToggle("slow");
	});
	
	$('#showfilter').click(function(event) {

			$("#filters" ).slideToggle("slow");
	});
	
	$('#criteria1').click(function(event) {

			$("#vehicleClass" ).slideToggle("slow");
	});


});