<!--
/*	

check_required: error checking for contact form 
parameters: HTML form object
-----------------------------------------------------------------*/	

function check_required(form_results, section)
{

	/*	
	
	initialize alert string with first line
	-----------------------------------------------------------------*/	

	var string = "You did not fill out the following required field(s):\n\n";
	var flag = 0;

		/*	
		
		initialize a flag to indicate when an empty value has been detected. 
		check each of the required fields for empty values, and set the flag 
		if they are found, adding the name of the required field on to the alert
		string.
		-----------------------------------------------------------------*/	

	switch (section)
	{
		case "contact":
			if (form_results.elements[0].value == '')
			{ 
				string = string + "Your name\n";
				flag = 1;
			}
			if (form_results.elements[2].value == '')
			{ 
				string = string + "E-mail address\n";
				flag = 1; 	
			}
			if (form_results.elements[3].value == '')
			{ 
				string = string + "Phone number\n";
				flag = 1;
			}
		break;
		case "quote":
			if (form_results.elements[0].value == '')
			{ 
				string = string + "Your name\n";
				flag = 1;
			}
			if (form_results.elements[2].value == '')
			{ 
				string = string + "E-mail address\n";
				flag = 1; 	
			}
			if (form_results.elements[3].value == '')
			{ 
				string = string + "Phone number\n";
				flag = 1;
			}
			if (form_results.elements[10].value == "na")
			{ 
				string = string + "Quantity\n";
				flag = 1;
			}
		break;
		case "wacaa":
			if (form_results.form_contact.value == '')
			{ 
				string = string + "Your name\n";
				flag = 1;
			}
			if (form_results.form_phone.value == '')
			{ 
				string = string + "Your phone number\n";
				flag = 1;
			}

			if (form_results.form_email.value == '')
			{ 
				string = string + "E-mail address\n";
				flag = 1; 	
			}
		break;
 	}
 	
	/*	
	
 		if the flag has been set, print the accumulated alert string. 
	-----------------------------------------------------------------*/	

	if (flag == 1)
	{
		string = string + "\nPlease return to the form and supply the required information.";
		alert(string);
		return false;
	}
}

function pop_locations(location)
{
	window.open(location, 'locations', 'height=500,width=350,scrollbars=yes');
}

function show_location(query_string, loc_type)
{
	self.location = "http://www.shopqualit.com/wizards/wiz_locations.asp?location=" + query_string + "&loc_type=" + loc_type;	
}

var catalog = "";
function launch_catalog(category)
{
	document.menu.action='catalog/categoryList.asp';
	document.menu.lvl1.value='2';
	document.menu.submit(); 
}

/*	

change_diagram: changes diagram image in wizards for imprint/personalization locations
parameters: tag to indicate diagram to change, tag to indicate new image
--------------------------------------------------------------------------------------*/	

function change_diagram(which_diagram, new_img)
{
	if (which_diagram == "imp_diagram")
	{
		document.getElementById(which_diagram).src = '/images/wizard/locations/imp_' + new_img + '.gif';
	}
	else
	{	
		document.getElementById(which_diagram).src = '/images/wizard/locations/pers_' + new_img + '.gif';
	}
}
//-->