function validateForm_LitRequest(the_form) {
	//alert('validateForm_LitRequest');
	return validateForm(the_form);
}


function validateForm_VendorOrder(the_form) {
	return validateForm(the_form);
}



 function swapGalleryImg(img) {
 	var main_img = document.getElementById('fullSizeImg');
 	//alert(main_img.src);	
 	//main_img.src = '/images/markets/' + img;
 	//alert(img);
 	main_img.src = img;
 }
 
 
 
 function swapGalleryText(text) {
 	var main_text = document.getElementById('fullSizeText');
 	//alert(main_text.childNode);
 	//alert(main_text.firstChild.nodeValue);	
 	main_text.firstChild.nodeValue = text;	
 }
 
  function swapGalleryTitle(text) {
 	var main_text = document.getElementById('fullSizeTitle');
 	//alert(main_text.childNode);
 	//alert(main_text.firstChild.nodeValue);	
 	main_text.firstChild.nodeValue = text;	
 }
 
 
 
 /*================================================
 	START DEALER LOCATER
 ================================================*/
 
 function initDealerMap() {
 	swapMap(show_map, hide_map, false);
 	
 	/*var image_map_node = document.getElementById('us_map');
 	var map_children = image_map_node.childNodes;
 	//alert (map_children.length);
 	var num_states = map_children.length;
 	for (var x=0; x<num_states; x++) {
 		if (map_children[x].nodeName == 'AREA') {
 			if (map_children[x].alt != 'International Sales') {
	 			map_children[x].onclick = clickMap;
 			}
 		}
 	}
 	
 	var image_map_node = document.getElementById('map_world');
 	var map_children = image_map_node.childNodes;
 	//alert (map_children.length);
 	var num_states = map_children.length;
 	for (var x=0; x<num_states; x++) {
 		if (map_children[x].nodeName == 'AREA') {
 			if (map_children[x].alt != 'United States') {
	 			map_children[x].onclick = internationalMap;
 			}
 		}
 	}
 	
 	
 	*/
 }
 
 function internationalMap() {
 	hideReps();
 	
 	var the_form = document.forms['us_map_search'];
 	the_form.show_map.value = 'intMap';
 	the_form.region.value = this.alt;
 	the_form.submit();
 }
 
 function clickMap() {
 	hideReps();
 	
 	
 	var the_form = document.forms['us_map_search'];
 	the_form.region.value = this.alt;
 	the_form.submit();
 }
 
function setFormMapValue(show_map) {
	var the_form = document.forms['us_map_search'];
 	the_form.show_map.value = show_map;
}
 
 function swapMap(show_map, hide_map, hideRepMainDiv) {
 	var img_node = document.getElementById(show_map);
 	img_node.style.display = 'block';

 	img_node = document.getElementById(hide_map);
 	img_node.style.display = 'none';
 	
 	setFormMapValue(show_map);
 	
 	/*if (hideRepMainDiv) {
 		hideReps();
 	}*/
 	
 }
 
 function hideReps() {
	 var node = document.getElementById('repMainDiv');
	 node.style.display = 'none';
 }
 
 
 
 function showRep(p_region) {
 	var the_form = document.forms['us_map_search'];
 	the_form.region.value = p_region;
 	the_form.submit();
 }
 
 
 /*================================================
 	END DEALER LOCATER
 ================================================*/
 
 
  
 /*================================================
 	START SWATCHES
 ================================================*/
 
 function initSwatchPage() {
 	
 	screenwidth_node = document.getElementById(screenwidth_id);
 	screenwidth_node.value = screen_width;
 	
	
	//pattern_node = document.getElementById(pattern_id);
	//green_node = document.getElementById(green_id);
 	
 	
 	// get the type node
 	//type_form_element_node = document.getElementById(type_form_element_id);
 	// set the event handler for when the user changes the type
 	//type_form_element_node.onchange = updateGradeOptions;	// this function has been taking on to many responsibilites. It may be time to create a generic onchageType(), or change how we assign functions to the event handler
 	
 	//in_out_node = document.getElementById(in_out_id);
 	
 	
 	// get the grade select node
 	grade_select_node = document.getElementById(grade_select_id);
 	
 	
 	collect_select_node = document.getElementById(collect_select_id);
 	
 	
	 grade_select_node.onchange = updateCollectionOptions;
 	
 	
 	updateGradeOptions();
 	
 	
 	// select the grade option based on the user action
 	var num_grade_options = grade_select_node.options.length;
 	//alert('search_form_vars[stID] = ' + search_form_vars['stID']);
 	for(var x=0; x<num_grade_options; x++) {
 		if (grade_select_node.options[x].value == search_form_vars['sgID']) {
 			//alert(grade_select_node.options[x].text);
 			grade_select_node.options[x].selected = true;
 		}
 	}
 	
 	updateCollectionOptions();
 	
 	//if (swatch_page_v2  != null) {
	 	// select the collection option based on the user action
	 	var num_col_options = collect_select_node.options.length;
	 	//alert('search_form_vars[stID] = ' + search_form_vars['stID']);
	 	for(var x=0; x<num_col_options; x++) {
	 		if (collect_select_node.options[x].value == search_form_vars['scID']) {
	 			//alert(grade_select_node.options[x].text);
	 			collect_select_node.options[x].selected = true;
	 		}
	 	}
 	//}
 	
 	
 	
 }
 
 
 
 //---------------------------------------------------------------------------
 
 function updateCollectionOptions() {
 	//alert('updateCollectionOptions');
 	

 	
 	// remove all the options from the menu
 	resetOptions(collect_select_node);
 	//alert('there are ' + collect_select_node.options.length + ' options in the menu');
 	
 	 	
 	
 	//stID = getSelectedTypeID();
 	sgID = getSelectedGradeID();
 	var grade_index = getSelectedGradeIndex(stID, sgID);
 	
 	//alert("stID = " + stID + "\n sgID = " + sgID + "\n grade_index = " + grade_index + " \n ");
 	
 	// set the first option to "All"
 	var num_options = 0;
 	collect_select_node.options[num_options++] = new Option('All', '');
 	

 	
 	// there is a grade seleted other than 'all'
 	if (grade_index > -1) {
	 	// get the collections that are available for this type/grade
	 	var type_grade_collection_options = grade_options[stID][grade_index]['collections'];
	 	//alert("stID = " + stID + "\n grade_index = " + grade_index + " \n type_grade_collection_options.length = " + type_grade_collection_options.length);
	 	
	 	for(var x=0; x< type_grade_collection_options.length; x++) {
	 		//alert(type_grade_options[x]['label']);
	 		var new_opt = new Option(type_grade_collection_options[x]['scName'], type_grade_collection_options[x]['scID']);
	 		//grade_select_node.options[ (x + num_options) ] = new_opt;
	 		collect_select_node.options[num_options++] = new_opt;
	 	}
 	} else {
 		
 		var num_grades = grade_options[stID].length;
 		//alert('grade_options length = ' + limit);
 		for (var g=0; g<num_grades; g++) {
 			var num_cols = grade_options[stID][g]['collections'].length;
 			for (var c=0; c<num_cols; c++) {
 				var new_opt = new Option( grade_options[stID][g]['collections'][c]['scName'], grade_options[stID][g]['collections'][c]['scID']);
 				collect_select_node.options[num_options++] = new_opt;
 			}
 		}
 	}

 }
 
 //---------------------------------------------------------------------------
 
 function getSelectedGradeIndex(stID, sgID) {
 	var limit = grade_options[stID].length;
 	var index = -1;
 	
 	for (var x=0; x < limit; x++) {
 		if (grade_options[stID][x]['value'] == sgID) {
 			index = x;
 			x = limit;	
 		}
 	}
 	
 	return index;
 }
 
 //---------------------------------------------------------------------------
 
 function getSelectedCollectionID() {
 	return collect_select_node.options[ collect_select_node.selectedIndex ].value;
 }
 
 //---------------------------------------------------------------------------
 
function updateGradeOptions() {
	// this function has been taking on to many responsibilites. It may be time to create a generic onchageType(), or change how we assign functions to the event handler
	
	
	resetOptions(grade_select_node);
	
 	//stID = getSelectedTypeID();
 	//alert('stID = ' + stID);
 	
 	// place the All option in the menu
 	grade_select_node.options[0] = new Option('All', '-1');
 	

 	// get the grades that are available for this type
 	var type_grade_options = grade_options[stID];
 
 	for(var x=0, z=1; x< type_grade_options.length; x++, z++) {
 		//alert(type_grade_options[x]['label']);
 		var new_opt = new Option(type_grade_options[x]['label'], type_grade_options[x]['value']);
 		//grade_select_node.options[ (x + num_options) ] = new_opt;
 		grade_select_node.options[z] = new_opt;
 	}
 	
 	updateCollectionOptions();
 	//displayInOut();
 	//displayPattern();
 	//displayGreen();
}
 
 //---------------------------------------------------------------------------
 /*
 function featureNotAvailable() {
 	alert('The current Type selected does not support this option.');
 	switch (this.type) {
 		case 'checkbox':
 			this.checked = false;
 			break;	
 		case 'select-one':
 			this.selectedIndex = 0;
 			break;	
 	}
 }*/
 
 //---------------------------------------------------------------------------
/*
   function displayGreen() {
 	//stID = getSelectedTypeID();
 	
 	if (stID == 2) {
 		//green_node.disabled = true;
 		green_node.onclick = featureNotAvailable;
 		green_node.checked = false;
 	} else {
 		//green_node.disabled = false;
 		green_node.onclick = null;
 	}
 	
 }*/
 
 //---------------------------------------------------------------------------
 
/*  function displayPattern() {
 	//stID = getSelectedTypeID();
 	
 	if (stID == 2) {
 		//pattern_node.disabled = true;
 		pattern_node.onchange = featureNotAvailable;
 		pattern_node.selectedIndex = 0;
 	} else {
 		//pattern_node.disabled = false;
 		pattern_node.onchange = null;
 	}
 	
 }*/
 
 //---------------------------------------------------------------------------
 /*
 function displayInOut() {
 	//stID = getSelectedTypeID();
 	
 	if (stID == 2) {
 		//in_out_node.disabled = false;
 		in_out_node.onclick = null;
 	} else {
 		//in_out_node.disabled = true;
 		//in_out_node.checked = false;
 		in_out_node.onclick = featureNotAvailable;
 		in_out_node.checked = false;
 	}
 	
 }*/
 
 //---------------------------------------------------------------------------
 
 function resetOptions(menu_node) {
 	
 	var num_options = menu_node.options.length;
 	/*if (swatch_page_v2  != null) {
 		alert('menu_node ' + menu_node.id + ' = ' + num_options);
 	}
 	*/
 	/*for(var x=0; x< num_options; x++) {
 		if (swatch_page_v2  != null) {
 			if (x < 5){
 				alert('x = ' + x + ' ' + menu_node.options[x].text);
 			}
 		}
 		menu_node.options[x] = null;
 	}*/
 	
 	if (num_options > 1) {
	 	for(var x=(num_options - 1); x>=0; x--) {
	 		/*if (swatch_page_v2  != null) {
	 			if (x < 5){
	 				alert('x = ' + x + ' ' + menu_node.options[x].text);
	 			}
	 		}*/
	 		menu_node.options[x] = null;
	 	}
 	}
 }
 
 //---------------------------------------------------------------------------
 /*
 function getSelectedTypeID() {
 	return type_form_element_node.options[ type_select_node.selectedIndex ].value;
 }
 */
 
 //---------------------------------------------------------------------------
 
  function getSelectedGradeID() {
 	return grade_select_node.options[ grade_select_node.selectedIndex ].value;
 }

 
 //---------------------------------------------------------------------------
 
 function fullSizeSwatch(state) {
 	var node_id = 'specFullSize';
 	var show = 'none';
 	var node = document.getElementById(node_id);
 	
 	if (state) {
 		show = 'block';
 	} 
 	
 	node.style.display = show;
 }
 
 /*================================================
 	END SWATCHES
 ================================================*/
 

 
 /*================================================
 	START GO SEAT
 ================================================*/
 

 
 function displayCaseStudyText(img, id) {
 	var state = '';
 	
 	if ( case_study[id] ) {
 		case_study[id] = false;
 		state = 'none';
 	} else {
 		case_study[id] = true;
 		state = 'block';
 	}
 	
 	
 	var text_node = document.getElementById(id);
 	text_node.style.display = state;
 	
 }
 
 
 /*================================================
 	END GO SEAT
 ================================================*/
 
 
 
 
 
function validateForm_emailRegistration(the_form) {
	
	var is_valid = true;	// we assume it is a valid form
	// custom code can be added to this fucntion if form specific actions are required
	
	// call the standard form validation function
	is_valid = validateForm(the_form);
	
	return is_valid;

}