function confirmten(fieldname,action){
	// Force Option Selection Choice by default
	var do_selection_check = true;
	var check_selections_rtn = true;

	//See if the optional parameter was passed to the
	//function to allow the option selection check to
	//be bypassed for sub-products where ignore_option_selections
	//is set in the database. Reminder: arrays in javascript
	//are zero based, so if the arguments array length is 3 the 3rd
	//argument is in arguments[2]
	
	if (arguments.length >= 3){
		if (arguments[2] == "no_selection_check"){
			do_selection_check = false;
		}
	}
	
	if 	(do_selection_check){
		if (check_selections() == false) return;
	}
	
	quantityvalue = eval('window.document.prodform.'+fieldname+'.value');
	
	if(quantityvalue > 10){
		if(confirm('You entered '+quantityvalue+' items in the quantity.  Are you sure you want this many?') == false ) return;
	}
	
	if(window.document.prodform.new_dependent_option_groups_trim.value!="" ||
		   window.document.prodform.new_dependent_option_groups_group1.value!="" ||
		   window.document.prodform.new_dependent_option_groups_group2.value!="" ||
		   window.document.prodform.new_dependent_option_groups_group3.value!=""){
		
		if (action=="addtowishlist") window.document.prodform.nextaction.value='addtowishlist';
		window.document.prodform.fuseaction.value='dpos';
	}
	else{
		if (action=="addtowishlist") window.document.prodform.fuseaction.value='addtowishlist';
	}
	
	window.document.prodform.submit();
}


//open file window
function openfilewindow(file_path,window_options){
	if(window_options){
		window.open(file_path,'filewindow',window_options);
	} 
	else{
		window.open(file_path,'filewindow','width=450,height=300,scrollbars=yes');
	}
}

function check_selections(){
	if (num_option_groups){
		for(option_group_step = 1;option_group_step <= num_option_groups;option_group_step ++){
			current_option_var = "option"+option_group_step;
			if(window.document.prodform[current_option_var][window.document.prodform[current_option_var].selectedIndex].value == ""){
				alert("Please Select a " + option_group_names[option_group_step] + ".");
				return false;
			}
		}
	}
	return true;
}

// Change visible product tab
function show_prod_tab(tab_no){
	var this_tab_button_left_id = "";
	var this_tab_button_id = "";
	var this_tab_button_right_id = "";
	var this_tab_button_left = "";
	var this_tab_button = "";
	var this_tab_button_right = "";
	var this_tab_id = "";
	var this_tab = "";

	
	for(x=0;x<=num_prod_tabs;x++){

		this_tab_button_left_id = "product_tab_button_left_" + x;
		this_tab_button_left = document.getElementById(this_tab_button_left_id);
		if(this_tab_button_left.className != "product_tab_button_closed_left"){
			this_tab_button_left.className = "product_tab_button_closed_left";
		}

		this_tab_button_id = "product_tab_button_" + x;
		this_tab_button = document.getElementById(this_tab_button_id);
		if(this_tab_button.className != "product_tab_button_closed"){
			this_tab_button.className = "product_tab_button_closed";
		}

		this_tab_button_right_id = "product_tab_button_right_" + x;
		this_tab_button_right = document.getElementById(this_tab_button_right_id);
		if(this_tab_button_right.className != "product_tab_button_closed_right"){
			this_tab_button_right.className = "product_tab_button_closed_right";
		}


		this_tab_id = "product_tab_" + x;
		this_tab = document.getElementById(this_tab_id);
		if (this_tab.style.display != "none"){
			this_tab.style.display = "none";
		}
	}

	this_tab_button_left_id = "product_tab_button_left_" + tab_no;
	this_tab_button_left = document.getElementById(this_tab_button_left_id);
	this_tab_button_left.className = "product_tab_button_open_left";

	this_tab_button_id = "product_tab_button_" + tab_no;
	this_tab_button = document.getElementById(this_tab_button_id);
	this_tab_button.className = "product_tab_button_open";

	this_tab_button_right_id = "product_tab_button_right_" + tab_no;
	this_tab_button_right = document.getElementById(this_tab_button_right_id);
	this_tab_button_right.className = "product_tab_button_open_right";

	this_tab_id = "product_tab_" + tab_no;
	this_tab = document.getElementById(this_tab_id);
	this_tab.style.display = "block";
}

// use onkeypress=trap_enter(); to prevent enter key from submitting form
function trap_enter(){
	return !(window.event && window.event.keyCode == 13);
}