var ie = (document.all) ? true : false;

function make_submit() {
	document.prod_form.submit();
}

function make_submit_day() {
	document.prod_form_day.submit();
}

function make_submit_night() {
	document.prod_form_night.submit();
}

function change_price(id, price, calc_id, add) {
	var price_text = (add) ? price : '';
	if(ie) {
		var price_set = eval('document.all.calc_'+id);
		if(!price_set) return false;
		price_set.innerHTML = price_text;
		var total_set = eval('document.all.calc_total_'+calc_id);
		total = get_total_value(total_set.innerHTML);
	}
	else {
		if(!document.getElementById('calc_'+id)) return false;
		document.getElementById('calc_'+id).innerHTML = price_text;
		total = get_total_value(document.getElementById('calc_total_'+calc_id).innerHTML);
	}
	if(add) total_new = roundnn((parseFloat(price) + parseFloat(total)),2);
	else total_new = roundnn(parseFloat(total) - (parseFloat(price)),2);
	if(ie) total_set.innerHTML = get_total_text(total_new);
	else document.getElementById('calc_total_'+calc_id).innerHTML = get_total_text(total_new);
}

function get_total_value(str) {
	split_string = str.split('<STRONG>');
	ret_str = split_string[1].split('</STRONG>');
	return ret_str[0];
}

function get_total_text(str) {
	return '<STRONG>'+str+'</STRONG>';
}

function roundnn(num,digit){
	var qwe = new String(''+num);
	find_e = qwe.indexOf("e-");
	if(find_e > 0) num = 0;
  if (isNaN (num)) num = 0;
  roll=Math.round((num-parseInt(num))*Math.pow(10,digit));
  roll=new String(''+Math.abs(roll));
  if(roll.length < digit)
    {
      if(roll >=10)
	for(i=0;i<(digit-roll.length);i++)
	  roll=roll+'0';
      else
	for(i=0;i<(digit-roll.length);i++)
	  roll='0'+roll;
    }
  else
    {
      if (roll.length == digit)
	{
          roll=roll.substring(0, digit);
        }
      else
        {
	  num  = parseInt(num) + 1;
	  roll = '00';
        }
    }
  return (parseInt(num)+'.'+roll);
}