/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
                
function handleEnter (field, event) 
  {
  var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  if (keyCode == 13) 
	{
	return false;
  	} 
  else
  return true;
  }      

 
function  doMath() 
  {
  var cassettes = eval(document.myform.cassettes.value)
  var number_dvds = cassettes
  var number_sets = eval(document.myform.extra_sets.value)
  var number_copies = number_sets
  var total_dvds = number_dvds + number_copies
  var shipping_choice = eval(document.myform.shipping.value)

  if (shipping_choice == 1)  <!-- Priority Mail choice --> 
  { 
  shipping_cost = 7
    if (total_dvds > 4)
    {
      var extra_shipping = (total_dvds - 4) * 0.42  
      <!-- First 4 DVD's cost $7 to ship.  Each additional DVD adds 42 cents. -->
      shipping_cost = Math.round(shipping_cost + extra_shipping)
    }
    if (shipping_cost >=19) 
    {
      shipping_cost = 19 
    }
  } 
  if (shipping_choice == 2)  <!-- Express Mail choice --> 
  { 
  shipping_cost = 18
    if (total_dvds > 4)
    {
    var extra_shipping = (total_dvds - 4) * 1.55  
    <!-- First 4 DVD's cost $18 to ship.  Each additional DVD adds $1.55 -->
    shipping_cost = Math.round(shipping_cost + extra_shipping)
    }
  }   

  var copies_cost = Math.round(5*number_copies)
  var menus = 0
  var edits = 0
  var chapters = 0
  var pictures = 0
	var covers = 0
	
  if (document.myform.Menu[0].checked)
  {
  menus = 0
  }
  if (document.myform.Menu[1].checked)
  {
  menus = 5
  }
  if (document.myform.Chapters[0].checked)
  {
  chapters = 0
  }
  if (document.myform.Chapters[1].checked)
  {
  chapters = 4
  }
  if (document.myform.edits[0].checked)
  {
  edits = 0
  }
  if (document.myform.edits[1].checked)
  {
  edits = 8
  }
  if (document.myform.cover_and_label[0].checked)
  {
  pictures = 0
  }
  if (document.myform.cover_and_label[1].checked)
  {
  pictures = 5
  }
// Paper envelopes or plastic cases?
	
	if (document.myform.DVD_container[0].checked)
  {
  covers = 0
  }
  if (document.myform.DVD_container[1].checked)
  {
  covers = 5
  }
	
  var conversion_cost = number_dvds*(15 + menus + chapters + edits + pictures + covers)
  var conversion_cost_text = "$"+conversion_cost
  var total_cost = ( conversion_cost + copies_cost + shipping_cost )
	
	/* Minimum order price:  $30 */
	if (total_cost<30)
	{
	total_cost=30
	}
	
  var total_cost_text = "$"+total_cost

  document.myform.total_amount.value=total_cost_text;
  document.myform.total_amount_again.value=total_cost_text;
  document.myform.copies_amount.value="$"+copies_cost;
  document.myform.DVDs.value=number_dvds;
  document.myform.conversion_amount.value="$"+conversion_cost;
  document.myform.shipping_amount.value="$"+shipping_cost;
  document.myform.copies.value=number_copies;
  document.myform.total_number_of_DVDs.value=total_dvds;
}


function popMeUp() 
{
var newWindow = window.open("menu layout.html", "", "width=800","height=900");
}

function pop(url, title, width, height)
  {
  var winstr = '<html>';
  winstr+='<scr'+'ipt language=javascript>';
  winstr+='function fnStop()';
  winstr+='{';
  winstr+='if(window.event.button == 2)';
  winstr+='{';
  winstr+='alert(\"Menu Layout\");';
  winstr+='}'
  winstr+='}'
  winstr+='<\/scr'+'ipt>';
  winstr+='<body leftmargin=0 topmargin=0 onmousedown=\"fnStop()\" >';
  winstr+='<img src=\"'+url+'\"><\/body><\/html>';
  popup = window.open("", "",'width=' + width + ',' + 'height=' + height +',left=100, top=0')
  popup.document.open();
  popup.document.write(winstr);
  popup.document.close();
  } 
  
function passData()
{
name1 = document.forms[0].elements[43].name
value1 = document.forms[0].elements[43].value
var w = open("confirmorder.html?"+ name1 + '=' + value1);
}