function checkVariations() {
	//	Gets the font value selected from the pull down menu
	var font_value = document.mainform.select_107.value;
	
	// Arial-Black does not have a Bold or Italic, hide these buttons
	if (font_value == 618) {
		var bold_98 = document.getElementById("bold_98");
	    bold_98.style.visibility = "hidden";
	    bold_98.style.display = "inline";	
	   
		var bold_99 = document.getElementById("bold_99");
	    bold_99.style.visibility = "hidden";
	    bold_99.style.display = "inline";	
	    
		var bold_100 = document.getElementById("bold_100");
	    bold_100.style.visibility = "hidden";
	    bold_100.style.display = "inline";
	    
		var italic_101 = document.getElementById("italic_101");
	    italic_101.style.visibility = "hidden";
	    italic_101.style.display = "inline";	
	   
		var italic_102 = document.getElementById("italic_102");
	    italic_102.style.visibility = "hidden";
	    italic_102.style.display = "inline";	
	    
		var italic_103 = document.getElementById("italic_103");
	    italic_103.style.visibility = "hidden";
	    italic_103.style.display = "inline";	    
	}
	//	ComicSansMS does not have an Italic, hide this button
	else if (font_value == 620) {
		var bold_98 = document.getElementById("bold_98");
	    bold_98.style.visibility = "visible";
	    bold_98.style.display = "inline";		
	   
		var bold_99 = document.getElementById("bold_99");
	    bold_99.style.visibility = "visible";
	    bold_99.style.display = "inline";	
	    
		var bold_100 = document.getElementById("bold_100");
	    bold_100.style.visibility = "visible";
	    bold_100.style.display = "inline";
	    
		var italic_101 = document.getElementById("italic_101");
	    italic_101.style.visibility = "hidden";
	    italic_101.style.display = "inline";	
	   
		var italic_102 = document.getElementById("italic_102");
	    italic_102.style.visibility = "hidden";
	    italic_102.style.display = "inline";	
	    
		var italic_103 = document.getElementById("italic_103");
	    italic_103.style.visibility = "hidden";
	    italic_103.style.display = "inline";		    
	}
	else {
		var bold_98 = document.getElementById("bold_98");
	    bold_98.style.visibility = "visible";
	    bold_98.style.display = "inline";		
	   
		var bold_99 = document.getElementById("bold_99");
	    bold_99.style.visibility = "visible";
	    bold_99.display = "inline";	
	    
		var bold_100 = document.getElementById("bold_100");
	    bold_100.style.visibility = "visible";
	    bold_100.style.display = "inline";
	    
		var italic_101 = document.getElementById("italic_101");
	    italic_101.style.visibility = "visible";
	    italic_101.style.display = "inline";	
	   
		var italic_102 = document.getElementById("italic_102");
	    italic_102.style.visibility = "visible";
	    italic_102.style.display = "inline";	
	    
		var italic_103 = document.getElementById("italic_103");
	    italic_103.style.visibility = "visible";
	    italic_103.style.display = "inline";		    
	}	
}

function validate_form(form) {
	// Only validate if going to the quoter
	if (form.action.indexOf('PP-quoter') < 0)
	{
		return true;
	}

	// Only validate if we haven't validated yet
	var has_validated = document.getElementById('has_validated');
	if (has_validated.value != '')
	{
		return (has_validated.value == '1');
	}

	// Do the validation
	var qty = null;
	var len = form.elements.length;
	for (var i=0;i<len;i++) {
		var c = form.elements[i];
		if (c.name == 'qty' || c.name == 'qty[]') {
			qty = c;
			break;
		}
	}
	if (!qty) {
		has_validated.value = '1';
		return true;
	}
	qty = qty.value;
	var q = qty.split('/');
	if (!q[0]) {
		alert('Please enter a quantity.');
		has_validated.value = '';
		return false;
	}
	if (q[0] > 5000) {
		alert('For quantities over 5,000\nPlease contact a Customer Care Rep\n(800) 537-8816');
		has_validated.value = '';
		return false;
	}

	// Find out if should validate the logo
	var template = document.getElementById('template');
	if (template) {
		var pos = template.value.indexOf('-');
		if (pos > -1) {
			if (template.value.substring(pos,template.value.length).indexOf('L') > -1) {
				// Make sure there's a logo
				var logo_filename = document.getElementById('logo_filename');
				if (logo_filename) { logo_filename = logo_filename.value; }
				if (!logo_filename) {
					var r = confirm('You have choosen a design that uses a logo but you haven\'t uploaded an image for your logo. The "Your Logo Here" graphic in the preview is for illustrative purposes. That area will remain blank. Are you sure you want to quote without a logo?');
					if (!r) {
						has_validated.value = '';
						return false;
					}
					else {
						var blank_logo = document.getElementById('blank_logo');
						if (blank_logo) { blank_logo.value = 'true'; }
					}
				}
			}
		}
	}
	has_validated.value = '1';
	return true;
}

function get_frame(i) {
	switch (i) {
	case 1:
	case '1':
		return 999;
	case 2:
	case '2':
		return 1000;
	case 3:
	case '3':
		return 1002;
	case 4:
	case '4':
		return 1001;
	case 5:
	case '5':
		return 1003;
	case 6:
	case '6':
		return 999;
	case 7:
	case '7':
		return 1000;
	case 8:
	case '8':
		return 1002;
	case 9:
	case '9':
		return 1001;
	case 10:
	case '10':
		return 1003;
	case 11:
	case '11':
		return 999;
	case 12:
	case '12':
		return 1000;
	case 13:
	case '13':
		return 1003;
	}
	return 999;
}

function get_text_color(i) {
	switch (i) {
	case 1:
	case '1':
		return 1;
	case 2:
	case '2':
		return 1;
	case 3:
	case '3':
		return 1;
	case 4:
	case '4':
		return -1;
	case 5:
	case '5':
		return -1;
	case 6:
	case '6':
		return 1;
	case 7:
	case '7':
		return 1;
	case 8:
	case '8':
		return 1;
	case 9:
	case '9':
		return -1;
	case 10:
	case '10':
		return -1;
	}
	return 1;
}

function get_line4_color(i) {
	switch (i) {
	case 1:
	case '1':
		return 1;
	case 2:
	case '2':
		return 1;
	case 3:
	case '3':
		return -1;
	case 4:
	case '4':
		return 1;
	case 5:
	case '5':
		return -1;
	case 6:
	case '6':
		return 1;
	case 7:
	case '7':
		return 1;
	case 8:
	case '8':
		return -1;
	case 9:
	case '9':
		return 1;
	case 10:
	case '10':
		return -1;
	}
	return 1;
}
