function OpenAppInfo() {
	var AppChoice = document.getElementById('AppList').value;
	window.document.location.href = 'PartsList.php?Make=' + AppChoice + '';
	return;
}

(function($) {
	var cache = [];
	// Arguments are image paths relative to the current page.
	$.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
			var cacheImage = document.createElement('img');
			cacheImage.src = arguments[i];
			cache.push(cacheImage);
		}
	}
})(jQuery)

$(document).ready(function(){
	$.preLoadImages("Images/panel1b.jpg","Images/panel2b.jpg","Images/panel3b.jpg","Images/panel4b.jpg","Images/panel5b.jpg","Images/panel6b.jpg")
	
	$(".PartPopUp").colorbox({innerWidth:"700px", innerHeight:"450px", opacity:0});

	$(".OtherImages").colorbox({innerWidth:"800px", innerHeight:"430px", opacity:0});
	
	$("#LeftNav img.menu").hover(
		function() {
			this.src = this.src.replace("a.","b.");
		},
		function() {
			this.src = this.src.replace("b.","a.");
		}
	);
	
	$("#LeftNav a#Applications").click(
		function() {
			$("#ApplicationsLayer").show("fast");
		}
	);
	
	$("#SampleRequest").submit(function() {
		var FieldArray = ['real name','company','address','city','state','zip','phone','email'];
		var FieldIndex;
		var SubmitOK = true;
		
		for (FieldIndex in FieldArray) {
			$('input[name=' + FieldArray[FieldIndex] + ']').each(function(index) {
				if ($(this).val() == "") {
					SubmitOK = false;
				}
			});
		}
		
		if (SubmitOK == false) {
			alert("Please complete the required fields marked with an asterisk before submitting.")
		}
		
		return SubmitOK;
	});
});
