// JavaScript Document
var fcounter = 0;
var current_custom_select_selected_pointer;



function cdb_open()
{
	fcounter = fcounter + 1;
	//alert("open " + fcounter);
}

function cdb_close()
{
	fcounter = fcounter + 1;
	//alert("close" + fcounter);
}

function cdb_final()
{

	fcounter = fcounter + 1;
	//alert("final " + fcounter);
	//alert(fcounter);
	if (fcounter == "1" || fcounter == 1)
	{
		//alert ("$$1");
		var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
		custom_select_optionsarea_pointer.style.display = "none";
	}
	else if (fcounter == "2" || fcounter == 2)
	{
		//alert ("$$2");
		var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
		custom_select_optionsarea_pointer.style.display = "block";
	}
	else if (fcounter == "3" || fcounter == "4" || fcounter == 3 || fcounter == 4)
	{
		//alert ("$$34");
		var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
		custom_select_optionsarea_pointer.style.display = "none";
	}
	
	
	/*switch(fcounter)
	{
		case 1:
			var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
			custom_select_optionsarea_pointer.style.display = "none";
		break;
		case 2:
			var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
			custom_select_optionsarea_pointer.style.display = "";
		break;
		case 3: case 4:
			var custom_select_optionsarea_pointer = document.getElementById("custom_select_optionsarea");
			custom_select_optionsarea_pointer.style.display = "none";
		break;
	}*/
	
	fcounter = 0;
}






function custom_select_setvalue(option_value, this_element_pointer)
{
	optionsarea_pointer = document.getElementById("custom_select_optionsarea");
	product_dimensions_pointer = document.getElementById("product_dimensions");
	custom_select_selected_pointer = document.getElementById("custom_select_selected");
	
	//copy chosen dimensions to display box
	custom_select_selected_pointer.innerHTML = this_element_pointer.innerHTML;

	//unmark previous selected option
	if (current_custom_select_selected_pointer != undefined)
		current_custom_select_selected_pointer.className = 'custom_select_option';
	//mark the current selected option and remember which one it was
	this_element_pointer.className = 'custom_select_option_selected';
	current_custom_select_selected_pointer = this_element_pointer;
	
	

	product_dimensions_pointer.value = option_value;
	
	switch_options();
	fcounter++;
}