function updateProductPrice(product_option_id,main_option_id)
{
	var price = base_price;
	price = base_price;


	for(var i=0;i<main_options_ar.length;i++){
		if ($('option_'+main_options_ar[i])){
			if (parent_option_value[main_options_ar[i]]){


				if ((option_value[$('option_'+parent_option_value[main_options_ar[i]]).value]) != (main_options_ar[i])){
					$('option_'+main_options_ar[i]).value = 0;
					$('option_'+main_options_ar[i]).disabled = true;
					$('option_section_'+main_options_ar[i]).hide();
				}
			}
			if ($('option_'+main_options_ar[i]).value > 0){

				
				price += parseFloat(option_prices[$('option_'+main_options_ar[i]).value]);
				
				if(option_value[$('option_'+main_options_ar[i]).value]){
					$('option_section_'+option_value[$('option_'+main_options_ar[i]).value]).show();
					$('option_'+option_value[$('option_'+main_options_ar[i]).value]).disabled = false;
				}
				
			}	
		}
	}

	if ($('main_price'))
		$('main_price').innerHTML  = addCommas(price.toFixed(2));	
	if ($('p_price'))	
		$('p_price').innerHTML  = addCommas(price.toFixed(2));	
	if ($('p_wire_price')){			
		wire_price = price - (price *.02);
		$('p_wire_price').innerHTML  = addCommas(wire_price.toFixed(2));
	}
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function checkProdFrm()
{
	var elmt;
	for (var x=0;x<document.theFrm.elements.length;x++) {
		elmt = document.theFrm.elements[x];
		if (elmt.name){

			if (elmt.name.substring(0,8) == 'options[' && !elmt.disabled && elmt.type != 'hidden') {
				if (elmt.selectedIndex == 0) {
					alert('Please make sure to select options.');
					elmt.focus();
					return false;
				}
			}
		}
	}

	return true;
}

function addADiamond() {
	document.forms.theFrm.action.value = "addDiamond";
	document.forms.theFrm.submit();
	return false;
}