// Swaps out an image based on the values of pull-down menues
// Defaults to Black ink on Gold Foil, Style AP1
function swapStyleFoilColorImage() {
	var sealStyle = (document.maverick.style.value) ? document.maverick.style.value : 'USS1';

	switch (sealStyle) {
		case '1861':
		sealStyle = 'USS1';
		break;
		case '1862':
		sealStyle = 'USS2';
		break;
		case '1863':
		sealStyle = 'USS3';
		break;
		case '1864':
		sealStyle = 'USS4';		
		break;
		case '1865':
		sealStyle = 'USS5';
		break;
		case '1866':
		sealStyle = 'USS6';
		break;
		case '1867':
		sealStyle = 'USS7';		
	}

	
	swapImage = document.getElementById('swap_image');
	swapImage.src = "/images/usa_stickers/mouseover_images/" + sealStyle + ".gif";
}

// Swaps out an image based on the values of pull-down menues
// Defaults to Black ink on Gold Foil, Style AP1
function mouseOverSwapStyleFoilColorImage(sealStyle) {
	
	switch (sealStyle) {
		case '1861':
		sealStyle = 'USS1';
		break;
		case '1862':
		sealStyle = 'USS2';
		break;
		case '1863':
		sealStyle = 'USS3';
		break;
		case '1864':
		sealStyle = 'USS4';		
		break;
		case '1865':
		sealStyle = 'USS5';
		break;
		case '1866':
		sealStyle = 'USS6';
		break;
		case '1867':
		sealStyle = 'USS7';		
	}
	
	
	swapImage = document.getElementById('swap_image');
	swapImage.src = "/images/usa_stickers/mouseover_images/" + sealStyle + ".gif";
}		
	
// This is for when the user clicks on a seal style, the menu will reflect that clicked choice
// It also runs the function to show or hide the optional wording field. 
function setStyleMenu(sealType) {
	document.maverick.style.value = sealType;
}		

// Checking the required form fields for values
function checkFormFields(form) {		
	// Make sure the error string is empty
	var i = 0;
	var error_string = '';
		
	// Get the style info for the required fields and set them to no border
	var quantityStyle = document.getElementById("quantity_box").style;
	var companyStyle = document.getElementById("company_box").style;
		
	// reset the border styles of fields that were corrected
	quantityStyle.border = "solid white 1px";
		
	// Make sure that the quantity is a number
	if (document.maverick.quantity.value == '') {
		i++;
		error_string += i + ") Please select a Quantity\n";
		quantityStyle.border = "solid red 1px";
	}	
	
	if (document.maverick.company_name.value == '') {
		i++;
		error_string += i + ") Please enter a Company Name.\n";
		companyStyle.border = "solid red 1px";	
	}	

	// If there were any errors, make an alert box and prevent submission
	if (error_string != "") {
		var fieldCount;
		if (i == 1) { fieldCount = "field"; }
		else { fieldCount = i + " fields"; }
		alert(error_string + "\nThe error/missing required " + fieldCount + " will be outlined in red"); 
		return false;
	}
}
function makeCaps(fieldText,fieldID) {
	fieldHandle = document.getElementById(fieldID);
	fieldHandle.value = fieldText.toUpperCase();
}
