	//JQUERY EVENT HANDLEING SETUP
	var selectedWidget = 1;
	$(document).ready(function(){
	
			$("#overlay").css({ height: document.body.clientHeight + "px" });

			//remove a car
			$('div.headerBar a').click(function(){
					$(this).parents("div.selectedCar").addClass("noneSelected");
					$(this).parents("div.selectedCar").attr("trimId","0");
					return false;
				}
			);
			
			//show the add car popup
			$('div.selectedCar').click(function(){
					resetDropDowns();
					$("body").css({overflow: "hidden"});
					$("#popup").show();
					$("#popup").attr("selectedWidget",$(this).attr("id"));
					$("#overlay").show();
				}
			);

			
			//hide the popup when close clicked
			$('#popup h1 div').click(function(){
					$("body").css({overflow: "auto"});
					$("#popup").hide();
					$("#overlay").hide();

				}
			);	
			
			$('div.seeCompButton').click(function(){
			
					var url = "/cars-trucks/compare/";
					
					
					car0 = $("#carOne").attr("trimId");
					car1 = $("#carTwo").attr("trimId");
					car2 = $("#carThree").attr("trimId");
					
					if(typeof(car0) == "undefined") {car0=0;}
					if(typeof(car1) == "undefined") {car1=0;}
					if(typeof(car2) == "undefined") {car2=0;}
					
					url = url + $("#carOne").attr("trimId") + "+" + $("#carTwo").attr("trimId")  + "+" +  $("#carThree").attr("trimId");
					
					if((car0 !=0 && car1 !=0) || 
					   (car1 !=0 && car2 !=0) || 
					   (car0 !=0 && car2 !=0)){
						window.location.href = url;
					}
					
				}
			);
	
		}
	);