function validate_order_form(mesg)
{
  var state = jQuery("input#order_validation").attr("checked");
  if(!state)
  {
	  alert(mesg);
	  return false;
  }
  else
  {
    return true;
  }
}

function update_quantity(id, val) {
	quantity = document.getElementById(id).value;
	quantity = 	parseInt(quantity) + parseInt(val);
	if (quantity < 1) { quantity = 1; }
	if (quantity > 99) { v = 99; }
	document.getElementById(id).value = quantity;
}

var current_step = 1;

function gotoPrevStep()
{
  gotoStep(current_step-1);
}

function gotoNextStep()
{
  gotoStep(current_step+1);
}

function gotoNextNextStep()
{
  gotoStep(current_step+2);
}

function gotoStep(step)
{
  if(typeof step !== 'number')
  {
    var step_number = parseInt(step.replace(new RegExp("[^0-9]",'g'),""));
  }
  else
  {
    var step_number = step;
  }

  for(var n=1;jQuery('#section'+n).length > 0;n++)
  {
    if(n<step_number)
    {
      jQuery('#section'+n+" .head").click(function() {
        gotoStep(jQuery(this).parent().attr('id'));
      });
      jQuery('#section'+n).addClass('allow');
    }
    else
    {
      jQuery('#section'+n+" .head").click(function() {});
      jQuery('#section'+n).removeClass('allow');
    }
    if(n==step_number)
    {
      jQuery('#section'+n+' .box').show();
      jQuery('#section'+n).addClass('active');
    }
    else
    {
      jQuery('#section'+n+' .box').hide();
      jQuery('#section'+n).removeClass('active');
    }
  }
  current_step = step_number;
}

