function calcForm(id)  {
  $('prodForm').fade('out');
    var xmlhttp;
  if (window.XMLHttpRequest)
    {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else if (window.ActiveXObject)
    {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  else
    {
    alert("Your browser does not support XMLHTTP!");
    }
  xmlhttp.onreadystatechange=function()
  {
  if(xmlhttp.readyState==4)
    {
      document.getElementById('prodForm').innerHTML=xmlhttp.responseText
      $('prodForm').fade('hide');
      $('prodForm').fade('in');
    }
  }
  xmlhttp.open("GET","forms.php?id="+id,true);
  xmlhttp.send(null);
  s.pageName=getPageName(id);
  void(s.t());
}

function getPageName(pg) {
	if(pg=="busCardForm")
		return "Business Cards";
	if(pg=="envelopeform")
		return "Envelopes";
	if(pg=="letterheadForm")
		return "Letter Head";
	if(pg=="calendarForm")
		return "Calendars";
	if(pg=="greetingCardForm")
		return "Greeting Cards";
	if(pg=="newsletterForm")
		return "Newsletters";
	if(pg=="postCardForm")
		return "Post Cards";
	if(pg=="brochureForm")
		return "Brochures";
	if(pg=="busforms")
		return "Carbon Free Multiple Part Forms";
	if(pg=="")
		return "";
}

function showprods(id)  {
  $('prod-content').fade('out');
  $('prod-content').innerHTML = "<div align='center'><img src='/images/loading.gif'></div>";
  $('prod-content').fade('in');
    var xmlhttp;
  if (window.XMLHttpRequest)
    {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else if (window.ActiveXObject)
    {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  else
    {
    alert("Your browser does not support XMLHTTP!");

    }
  xmlhttp.onreadystatechange=function()
  {
  if(xmlhttp.readyState==4)
    {
      document.getElementById('prod-content').innerHTML=xmlhttp.responseText
      $('prod-content').fade('hide');
      $('prod-content').fade('in');
    }
  }
  xmlhttp.open("GET","showprods.php?id="+id,true);
  xmlhttp.send(null);
}


function buscardcolor(bval) {
  if(bval == "magnekote") {
    document.getElementById('color').innerHTML = "<select name='color' id='color-select' onchange='buscardcalc()'><option value='20'>2 / 0</option><option value='40'>4 / 0</option><option value='10'>1 / 0</option></select>";
    
  }  
  else {
  	 document.getElementById('color').innerHTML = "<select name='color' id='color-select' onchange='buscardcalc()'><option value='22'> 2 / 2 </option><option value='21'> 2 / 1 </option><option value='20'> 2 / 0 </option><option value='40'> 4 / 0 </option><option value='44'> 4 / 4 </option><option value='41'> 4 / 1 </option></select>";
  	 document.forms[0].color[document.forms[0].color.selectedIndex].value = "22";
  }
}

// BUSINESS CARDS
function buscardcalc()  {
  var change;
  // setting base values
  var buscard_quantity = document.forms[0].quantity.value;
  var buscard_color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;
  var aqueous = document.getElementById('aqueous-right').checked;
  var paper_upgrades = "";
  var magnekote = document.getElementById('magnekote-right').checked;
  var addto = 0;
  var buscard_base = 0;
  
  
  
  if(aqueous == true)
	 paper_upgrades += "Aqueous";
	
	if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";
	if(magnekote == true)  {
	 paper_type = "Magnekote";
	 paper_upgrades = "";
	}
	
	
	 
  
  if(matte == true || gloss == true)  {
    buscard_base += .02;
    document.getElementById('right-sub-opt').style.display = "block";
  }
  else   {
    document.getElementById('right-sub-opt').style.display = "none";
    document.getElementById('aqueous-right').checked = false;
    document.getElementById('none-right').checked = true;
    aqueous = false;
  }

  if(buscard_quantity < 101)  {
    if(buscard_color == "40")
      buscard_base += .40;
    if(buscard_color == "44")
      buscard_base += .65;
    if(buscard_color == "41")
      buscard_base += .60;
    if(buscard_color == "20")
      buscard_base += .35;
    if(buscard_color == "22")
      buscard_base += .60;
    if(buscard_color == "21")
      buscard_base += .55;
    //magnekote
    if(magnekote == true) {
      buscard_base += .15;
    }
    //aqueous
    if(aqueous == true) {
      addto += 5;
      buscard_base += .02
    }
  }
  if(buscard_quantity < 251 && buscard_quantity > 100)  {
    if(buscard_color == "40")
      buscard_base += .17;
    if(buscard_color == "44")
      buscard_base += .35;
    if(buscard_color == "41")
      buscard_base += .30;
    if(buscard_color == "20")
      buscard_base += .15;
    if(buscard_color == "22")
      buscard_base += .30;
    if(buscard_color == "21")
      buscard_base += .25;
    //magnekote
    if(magnekote == true) {
      buscard_base += .12;
    }
    //aqueous
    if(aqueous == true) {
      addto += 5;
      buscard_base += .02
    }
  }
  if(buscard_quantity < 501 && buscard_quantity > 250)  {
    if(buscard_color == "40")
      buscard_base += .09;
    if(buscard_color == "44")
      buscard_base += .20;
    if(buscard_color == "41")
      buscard_base += .17;
    if(buscard_color == "20")
      buscard_base += .08;
    if(buscard_color == "22")
      buscard_base += .18;
    if(buscard_color == "21")
      buscard_base += .18;
    //magnekote
    if(magnekote == true) {
      buscard_base += .09;
    }
    //aqueous
    if(aqueous == true) {
      addto += 6;
      buscard_base += .02
    }
  }
  if(buscard_quantity < 1001 && buscard_quantity > 500)  {
    if(buscard_color == "40")
      buscard_base += .08;
    if(buscard_color == "44")
      buscard_base += .12;
    if(buscard_color == "41")
      buscard_base += .10;
    if(buscard_color == "20")
      buscard_base += .07;
    if(buscard_color == "22")
      buscard_base += .14;
    if(buscard_color == "21")
      buscard_base += .09;
    //magnekote
    if(magnekote == true) {
      buscard_base += .09;
    }
    //aqueous
    if(aqueous == true) {
      addto += 7;
      buscard_base += .02
    }
  }
  if(buscard_quantity > 1000)  {
    if(buscard_color == "40")
      buscard_base += .07;
    if(buscard_color == "44")
      buscard_base += .10;
    if(buscard_color == "41")
      buscard_base += .08;
    if(buscard_color == "20")
      buscard_base += .06;
    if(buscard_color == "22")
      buscard_base += .09;
    if(buscard_color == "21")
      buscard_base += .08;
    //magnekote
    if(magnekote == true) {
      buscard_base += .09;
    }
    //aqueous
    if(aqueous == true) {
      addto += 8;
      buscard_base += .02
    }
  }
  
  var price = (buscard_quantity * buscard_base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades; 
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
  
  // Blur everything so IE will work
  //document.getElementById('quantity').focus();
}

// POST CARDS
function postcardcalc() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;
  var addto = 0;
  var base = 0;
  
  var aqueous = document.getElementById('aqueous-right').checked;
  var paper_upgrades = "";
  
  
  
	if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";
  
  if(matte == true || gloss == true)  {
    base += .02;
    document.getElementById('right-sub-opt').style.display = "block";
  }
  else   {
    document.getElementById('right-sub-opt').style.display = "none";
    document.getElementById('aqueous-right').checked = false;
    aqueous = false;
  }
  if(aqueous == true)
	 paper_upgrades += "Aqueous,";
	 
  // Size 4x6
  if(size == "4x6") {
    if(quantity < 101)  {
      if(color == "40")
        base += .7;
      if(color == "44")
        base += 1.15;
      if(color == "41")
        base += .90;
      if(color == "20")
        base += .5;
      if(color == "22")
        base += .95;
      if(color == "21")
        base += .70;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity < 251 && quantity > 100)  {
      if(color == "40")
        base += .3;
      if(color == "44")
        base += .45;
      if(color == "41")
        base += .4;
      if(color == "20")
        base += .25;
      if(color == "22")
        base += .4;
      if(color == "21")
        base += .35;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .18;
      if(color == "44")
        base += .26;
      if(color == "41")
        base += .23;
      if(color == "20")
        base += .15;
      if(color == "22")
        base += .23;
      if(color == "21")
        base += .2;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .1;
      if(color == "44")
        base += .15;
      if(color == "41")
        base += .13;
      if(color == "20")
        base += .09;
      if(color == "22")
        base += .14;
      if(color == "21")
        base += .12;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .07;
      if(color == "44")
        base += .09;
      if(color == "41")
        base += .08;
      if(color == "20")
        base += .06;
      if(color == "22")
        base += .08;
      if(color == "21")
        base += .07;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  
  // Size 5x7
  if(size == "5x7") {
    if(quantity < 101)  {
      if(color == "40")
        base += 1.2;
      if(color == "44")
        base += 1.80;
      if(color == "41")
        base += 1.4;
      if(color == "20")
        base += .8;
      if(color == "22")
        base += 1.2;
      if(color == "21")
        base += 1.05;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity < 251 && quantity > 100)  {
      if(color == "40")
        base += .49;
      if(color == "44")
        base += .85;
      if(color == "41")
        base += .70;
      if(color == "20")
        base += .36;
      if(color == "22")
        base += .56;
      if(color == "21")
        base += .51;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .28;
      if(color == "44")
        base += .43;
      if(color == "41")
        base += .38;
      if(color == "20")
        base += .25;
      if(color == "22")
        base += .36;
      if(color == "21")
        base += .35;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .16;
      if(color == "44")
        base += .23;
      if(color == "41")
        base += .23;
      if(color == "20")
        base += .14;
      if(color == "22")
        base += .20;
      if(color == "21")
        base += .19;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .11;
      if(color == "44")
        base += .13;
      if(color == "41")
        base += .14;
      if(color == "20")
        base += .09;
      if(color == "22")
        base += .11;
      if(color == "21")
        base += .11;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  
  // Size 6x9
  if(size == "6x9") {
    if(quantity < 101)  {
      if(color == "40")
        base += 1.25;
      if(color == "44")
        base += 2.25;
      if(color == "41")
        base += 2.10;
      if(color == "20")
        base += .9;
      if(color == "22")
        base += 1.70;
      if(color == "21")
        base += 1.55;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity < 251 && quantity > 100)  {
      if(color == "40")
        base += .55;
      if(color == "44")
        base += .85;
      if(color == "41")
        base += .70;
      if(color == "20")
        base += .36;
      if(color == "22")
        base += .56;
      if(color == "21")
        base += .51;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .28;
      if(color == "44")
        base += .43;
      if(color == "41")
        base += .38;
      if(color == "20")
        base += .25;
      if(color == "22")
        base += .36;
      if(color == "21")
        base += .35;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .16;
      if(color == "44")
        base += .23;
      if(color == "41")
        base += .23;
      if(color == "20")
        base += .14;
      if(color == "22")
        base += .20;
      if(color == "21")
        base += .19;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .11;
      if(color == "44")
        base += .13;
      if(color == "41")
        base += .14;
      if(color == "20")
        base += .09;
      if(color == "22")
        base += .11;
      if(color == "21")
        base += .11;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

function greetingcalc() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;
  
  var aqueous = document.getElementById("aqueous-right").checked;
  var fold = document.getElementById("fold-right").checked;
  var envelope = document.forms[0].envelope[document.forms[0].envelope.selectedIndex].value;
  var addto = 0;
  var base = 0;
  
  if(matte == true || gloss == true)  {
    base += .02;
    document.getElementById('right-sub-opt').style.display = "block";
  }
  else   {
    document.getElementById('right-sub-opt').style.display = "none";
    document.getElementById('aqueous-right').checked = false;
    aqueous = false;
  }
  
  var paper_upgrades = "";
  var paper_type = "";
  
  if(aqueous == true)
	 paper_upgrades += "Aqueous,";
	if(fold == true)
	 paper_upgrades += "Half fold,";  
  
  if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";
  
  //setting piece price for envelopes
  if(envelope == "blank")
    base += .06;
  if(envelope == "print")
    base += .12;
    
  //setting piece price for folds
  if(fold == true)
    base += .01;
    
  //setting piece price for dull
  if(matte == true)
    base += .02;
  
  if(quantity < 101)  {
    if(color == "40")
      base += 1.45;
    if(color == "44")
      base += 2.25;
    if(color == "41")
      base += 2.10;
    if(color == "20")
      base += .9;
    if(color == "22")
      base += 1.70;
    if(color == "21")
      base += 1.55;
    //aqueous
    if(aqueous == true) {
      addto += 8;
      base += .02
    }
  }
  if(quantity > 100 && quantity < 251)  {
    if(color == "40")
      base += .6;
    if(color == "44")
      base += 1.03;
    if(color == "41")
      base += .8;
    if(color == "20")
      base += .37;
    if(color == "22")
      base += .79;
    if(color == "21")
      base += .57;
    //aqueous
    if(aqueous == true) {
      addto += 12;
      base += .02
    }
  }
  if(quantity > 250 && quantity < 501)  {
    if(color == "40")
      base += .35;
    if(color == "44")
      base += .55;
    if(color == "41")
      base += .44;
    if(color == "20")
      base += .20;
    if(color == "22")
      base += .40;
    if(color == "21")
      base += .29;
    //aqueous
    if(aqueous == true) {
      addto += 16;
      base += .02
    }
  }
  if(quantity > 500 && quantity < 1001)  {
    if(color == "40")
      base += .2;
    if(color == "44")
      base += .32;
    if(color == "41")
      base += .26;
    if(color == "20")
      base += .12;
    if(color == "22")
      base += .22;
    if(color == "21")
      base += .18;
    //aqueous
    if(aqueous == true) {
      addto += 20;
      base += .02
    }
  }
  if(quantity > 1000)  {
    if(color == "40")
      base += .12;
    if(color == "44")
      base += .17;
    if(color == "41")
      base += .16;
    if(color == "20")
      base += .07;
    if(color == "22")
      base += .12;
    if(color == "21")
      base += .11;
    //aqueous
    if(aqueous == true) {
      addto += 20;
      base += .02
    }
  }
  var price = (quantity * base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

//Set fold value for newsletters
function newsfold(val)  {
  document.getElementById('fold-right').value = val;
}

function newlettersize()  {
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  if(size == "8.5x11")
    document.getElementById('fold-right').value = "none";  
}

//Newsletters
function newslettercalc() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  var aqueous = document.getElementById("aqueous-right").checked;
  
  // paper choices
  var environment = document.getElementById('environment-right').checked;
  var glossright80 = document.getElementById('gloss-right80').checked;
  var matteright80 = document.getElementById('matte-right80').checked;
  var glossright = document.getElementById('gloss-right').checked;
  
  if(environment == true)
	 paper_type = "Environment";
	if(glossright80 == true)
	 paper_type = "80 lb. Recycled Gloss";
	if(matteright80 == true)
	 paper_type = "80 lb. Recycled Matte";
	if(glossright == true) {
	 paper_type = "100 lb. Recycled Gloss";
	 document.getElementById('right-sub-opt').style.display = "block";
	}
	else   {
    document.getElementById('right-sub-opt').style.display = "none";
    document.getElementById('aqueous-right').checked = false;
    aqueous = false;
  }
  
  var fold = document.getElementById('fold-right').value;
  
  
  if(size == "11x17")
    document.getElementById('right-sub-opt2').style.display = "block";
  else  {
    document.getElementById('right-sub-opt2').style.display = "none"; 
  }
  
  document.getElementById('foldname').innerHTML = fold;
  document.forms[0].fold.value = fold;
  var addto = 0;
  var base = 0;
  
  var paper_upgrades = "";
  
  if(aqueous == true)
	 paper_upgrades += "Aqueous,";
  
  //setting piece price for folds
  if(fold != "none")
    base += .01;
  
  //8.5 x 11
  if(size == "8.5x11")  {
    if(quantity < 101)  {
      if(color == "44")
        base += 3;
      if(color == "41")
        base += 2.5;
      if(color == "11")
        base += .96;
      if(color == "22")
        base += 1.26;
      if(color == "21")
        base += 1.16;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "44")
        base += 1.24;
      if(color == "41")
        base += 1.09;
      if(color == "11")
        base += .40;
      if(color == "22")
        base += .53;
      if(color == "21")
        base += .5;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "44")
        base += .65;
      if(color == "41")
        base += .55;
      if(color == "11")
        base += .23;
      if(color == "22")
        base += .32;
      if(color == "21")
        base += .29;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "44")
        base += .35;
      if(color == "41")
        base += .27;
      if(color == "11")
        base += .13;
      if(color == "22")
        base += .19;
      if(color == "21")
        base += .17;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "44")
        base += .2;
      if(color == "41")
        base += .16;
      if(color == "11")
        base += .09;
      if(color == "22")
        base += .12;
      if(color == "21")
        base += .11;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  //SIZE 11x17
  if(size == "11x17")  {
    if(quantity < 101)  {
      if(color == "44")
        base += 3.5;
      if(color == "41")
        base += 3;
      if(color == "11")
        base += 1.2;
      if(color == "22")
        base += 1.5;
      if(color == "21")
        base += 1.4;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "44")
        base += 1.46;
      if(color == "41")
        base += 1.31;
      if(color == "11")
        base += .5;
      if(color == "22")
        base += .63;
      if(color == "21")
        base += .6;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "44")
        base += .8;
      if(color == "41")
        base += .7;
      if(color == "11")
        base += .3;
      if(color == "22")
        base += .39;
      if(color == "21")
        base += .36;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "44")
        base += .42;
      if(color == "41")
        base += .34;
      if(color == "11")
        base += .18;
      if(color == "22")
        base += .24;
      if(color == "21")
        base += .22;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "44")
        base += .22;
      if(color == "41")
        base += .18;
      if(color == "11")
        base += .12;
      if(color == "22")
        base += .15;
      if(color == "21")
        base += .14;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

//Letterhead

function newsfold(val)  {
  document.getElementById('fold-right').value = val;
}

function newlettersize()  {
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  if(size == "8.5x11")
    document.getElementById('fold-right').value = "none";  
}

function letterheadcalc() {
  // setting base values
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;
  
  var quantity = document.forms.letterhead.quantity.value;
  var color = document.forms.letterhead.color[document.forms.letterhead.color.selectedIndex].value;
  var second = document.getElementById('secondsheet').checked;
  var addto = 0;
  var base = 0;
  var paper_upgrades = "";
	 
	if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";

  if(second == true)  {
    base += .04;
    paper_upgrades = "Blank Second Sheet";
  }
  
  if(matte == true || gloss == true)  {
    base += .02;
  } 
  
if(quantity < 101)  {
    if(color == "40")
      base += 1.5;
    if(color == "44")
      base += 2.5;
    if(color == "41")
      base += 1.8;
    if(color == "20")
      base += 1;
    if(color == "22")
      base += 1.75;
    if(color == "21")
      base += 1.25;
  }
  if(quantity > 100 && quantity < 251)  {
    if(color == "40")
      base += .6;
    if(color == "44")
      base += 1;
    if(color == "41")
      base += .8;
    if(color == "20")
      base += .45;
    if(color == "22")
      base += .8;
    if(color == "21")
      base += .6;
  }
  if(quantity > 250 && quantity < 501)  {
    if(color == "40")
      base += .35;
    if(color == "44")
      base += .55;
    if(color == "41")
      base += .45;
    if(color == "20")
      base += .25;
    if(color == "22")
      base += .40;
    if(color == "21")
      base += .33;
  }
  if(quantity > 500 && quantity < 1001)  {
    if(color == "40")
      base += .2;
    if(color == "44")
      base += .3;
    if(color == "41")
      base += .24;
    if(color == "20")
      base += .15;
    if(color == "22")
      base += .23;
    if(color == "21")
      base += .18;
  }
  if(quantity > 1000)  {
    if(color == "40")
      base += .14;
    if(color == "44")
      base += .17;
    if(color == "41")
      base += .16;
    if(color == "20")
      base += .1;
    if(color == "22")
      base += .13;
    if(color == "21")
      base += .12;
  }
  var price = (quantity * base) + addto;
  document.forms.letterhead.price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades;
  document.forms.letterhead.upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

function brofold(val)  {
  document.getElementById('fold-right').value = val;
}

function brochuresize()  {
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  if(size == "8.5x11")
    document.getElementById('fold-right').value = "none";  
}

function brochurecalc() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  var aqueous = document.getElementById("aqueous-right").checked;
  
  if(size == "8.5x14")
    document.getElementById('right-sub-opt2').style.display = "block";
  else  {
    document.getElementById('right-sub-opt2').style.display = "none"; 
  }

  // paper types
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;

  if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";
	 
	if(matte == true || gloss == true)  {
    document.getElementById('right-sub-opt').style.display = "block";
  }
  else   {
    document.getElementById('right-sub-opt').style.display = "none";
    document.getElementById('aqueous-right').checked = false;
    aqueous = false;
  }

  var fold = document.getElementById('fold-right').value;
  document.getElementById('foldname').innerHTML = fold;
  document.forms[0].fold.value = fold;
  var addto = 0;
  var base = 0;
  
  var paper_upgrades = "";
  
  if(aqueous == true)
	 paper_upgrades += "Aqueous,";
  
  //setting piece price for folds
  if(fold != "none")
    base += .01;
  
  //8.5 x 11
  if(size == "8.5x11")  {
    if(quantity < 101)  {
      if(color == "11")
        base += .96;
      if(color == "22")
        base += 1.1;
      if(color == "44")
        base += 1.8;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "11")
        base += .4;
      if(color == "22")
        base += .6;
      if(color == "44")
        base += .75;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "11")
        base += .23;
      if(color == "22")
        base += .35;
      if(color == "44")
        base += .45;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "11")
        base += .13;
      if(color == "22")
        base += .22;
      if(color == "44")
        base += .3;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "11")
        base += .09;
      if(color == "22")
        base += .14;
      if(color == "44")
        base += .18;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  //SIZE 14x8.5
  if(size == "8.5x14")  {
    if(quantity < 101)  {
      if(color == "11")
        base += 1.2;
      if(color == "22")
        base += 2.6;
      if(color == "44")
        base += 3.1;
      //aqueous
      if(aqueous == true) {
        addto += 8;
        base += .02
      }
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "11")
        base += .5;
      if(color == "22")
        base += 1.1;
      if(color == "44")
        base += 1.25;
      //aqueous
      if(aqueous == true) {
        addto += 12;
        base += .02
      }
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "11")
        base += .3;
      if(color == "22")
        base += .55;
      if(color == "44")
        base += .65;
      //aqueous
      if(aqueous == true) {
        addto += 16;
        base += .02
      }
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "11")
        base += .18;
      if(color == "22")
        base += .27;
      if(color == "44")
        base += .35;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
    if(quantity > 1000)  {
      if(color == "11")
        base += .12;
      if(color == "22")
        base += .18;
      if(color == "44")
        base += .22;
      //aqueous
      if(aqueous == true) {
        addto += 20;
        base += .02
      }
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms.brochure.price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms.brochure.upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

// CALENDAR
function calendarcalc() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var papertype = document.forms[0].papertype.value;
  var matte = document.getElementById('matte-right').checked;
  var gloss = document.getElementById('gloss-right').checked;
  var environment = document.getElementById('environment-right').checked;
  var addto = 0;
  var base = 0;
  
  var aqueous = document.getElementById("aqueous-right").checked;
  
  if(matte == true)
	 paper_type = "Recycled Matte";
	if(gloss == true)
	 paper_type = "Recycled Gloss";
	if(environment == true)
	 paper_type = "Environment";

  if(matte == true || gloss == true)  {
    base += .02;
  }
  
  var paper_upgrades = "";
  
  if(aqueous == true)
	 paper_upgrades += "Aqueous,";
  
  if(papertype != "gloss")
    base += .1;
  
  if(quantity < 101)  {
    if(color == "44")
      base += 26.99;
    if(color == "22")
      base += 19.99;
    if(color == "11")
      base += 12.99;
    if(color == "4422")
      base += 21.99;
    if(color == "4411")
      base += 14.99;
    //aqueous
    if(aqueous == true) {
      addto += 5;
      base += .02
    }
  }
  if(quantity > 100 && quantity < 251)  {
    if(color == "44")
      base += 11.99;
    if(color == "22")
      base += 8.59;
    if(color == "11")
      base += 5.99;
    if(color == "4422")
      base += 9.99;
    if(color == "4411")
      base += 6.59;
    //aqueous
    if(aqueous == true) {
      addto += 5;
      base += .02
    }
  }
  if(quantity > 250 && quantity < 501)  {
    if(color == "44")
      base += 6.59;
    if(color == "22")
      base += 5.59;
    if(color == "11")
      base += 3.99;
    if(color == "4422")
      base += 6.49;
    if(color == "4411")
      base += 4.59;
    //aqueous
    if(aqueous == true) {
      addto += 6;
      base += .02
    }
  }
  if(quantity > 500 && quantity < 1001)  {
    if(color == "44")
      base += 3.99;
    if(color == "22")
      base += 3.39;
    if(color == "11")
      base += 2.39;
    if(color == "4422")
      base += 3.99;
    if(color == "4411")
      base += 2.69;
    //aqueous
    if(aqueous == true) {
      addto += 7;
      base += .02
    }
  }
  if(quantity > 1000)  {
    if(color == "44")
      base += 2.50;
    if(color == "22")
      base += 1.99;
    if(color == "11")
      base += 1.39;
    if(color == "4422")
      base += 2.09;
    if(color == "4411")
      base += 1.49;
    //aqueous
    if(aqueous == true) {
      addto += 8;
      base += .02
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades;
  document.forms[0].papertype.value = paper_type;
  document.getElementById('paper-type').innerHTML = paper_type;
}

// ENVELOPES
function setenvelope(type)  {
  document.getElementById("envelopestyle").innerHTML = type;
  document.forms.envelope.envtype.value = type;
}

function envelopecalc() {
  // setting base values
  var quantity = document.forms.envelope.quantity.value;
  var color = document.forms.envelope.color[document.forms.envelope.color.selectedIndex].value;
  var addto = 0;
  var base = 0;
  
  var envtype = document.forms.envelope.envtype.value;
  
  
  if(envtype == "10 Regular" || envtype == "9 Regular" || envtype == "6 Regular") {
    if(quantity < 101)  {
      if(color == "40")
        base += .95;
      if(color == "41")
        base += 1.45;
      if(color == "20")
        base += .7;
      if(color == "10")
        base += .5;
      if(color == "21")
        base += .9;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .40;
      if(color == "41")
        base += .60;
      if(color == "20")
        base += .30;
      if(color == "10")
        base += .25;
      if(color == "21")
        base += .40;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .30;
      if(color == "41")
        base += .40;
      if(color == "20")
        base += .17;
      if(color == "10")
        base += .15;
      if(color == "21")
        base += .22;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .20;
      if(color == "41")
        base += .26;
      if(color == "20")
        base += .10;
      if(color == "10")
        base += .09;
      if(color == "21")
        base += .12;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .13;
      if(color == "41")
        base += .16;
      if(color == "20")
        base += .06;
      if(color == "10")
        base += .05;
      if(color == "21")
        base += .07;
    }
  }
  
  if(envtype == "10 Window") {
    if(quantity < 101)  {
      if(color == "40")
        base += .96;
      if(color == "41")
        base += 1.46;
      if(color == "20")
        base += .71;
      if(color == "10")
        base += .51;
      if(color == "21")
        base += .91;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .41;
      if(color == "41")
        base += .61;
      if(color == "20")
        base += .31;
      if(color == "10")
        base += .26;
      if(color == "21")
        base += .41;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .31;
      if(color == "41")
        base += .41;
      if(color == "20")
        base += .18;
      if(color == "10")
        base += .16;
      if(color == "21")
        base += .23;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .21;
      if(color == "41")
        base += .27;
      if(color == "20")
        base += .11;
      if(color == "10")
        base += .1;
      if(color == "21")
        base += .13;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .14;
      if(color == "41")
        base += .17;
      if(color == "20")
        base += .07;
      if(color == "10")
        base += .06;
      if(color == "21")
        base += .08;
    }
  }
  
  if(envtype == "9x12 Regular") {
    if(quantity < 101)  {
      if(color == "40")
        base += .98;
      if(color == "41")
        base += 1.48;
      if(color == "20")
        base += .73;
      if(color == "10")
        base += .53;
      if(color == "21")
        base += .93;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .43;
      if(color == "41")
        base += .63;
      if(color == "20")
        base += .33;
      if(color == "10")
        base += .28;
      if(color == "21")
        base += .43;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .33;
      if(color == "41")
        base += .43;
      if(color == "20")
        base += .20;
      if(color == "10")
        base += .18;
      if(color == "21")
        base += .25;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .23;
      if(color == "41")
        base += .29;
      if(color == "20")
        base += .13;
      if(color == "10")
        base += .12;
      if(color == "21")
        base += .15;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .16;
      if(color == "41")
        base += .19;
      if(color == "20")
        base += .09;
      if(color == "10")
        base += .08;
      if(color == "21")
        base += .1;
    }
  }
  
  if(envtype == "6x9 Regular") {
    if(quantity < 101)  {
      if(color == "40")
        base += .97;
      if(color == "41")
        base += 1.47;
      if(color == "20")
        base += .72;
      if(color == "10")
        base += .52;
      if(color == "21")
        base += .92;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .42;
      if(color == "41")
        base += .62;
      if(color == "20")
        base += .32;
      if(color == "10")
        base += .27;
      if(color == "21")
        base += .42;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .32;
      if(color == "41")
        base += .42;
      if(color == "20")
        base += .19;
      if(color == "10")
        base += .17;
      if(color == "21")
        base += .24;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .22;
      if(color == "41")
        base += .28;
      if(color == "20")
        base += .12;
      if(color == "10")
        base += .11;
      if(color == "21")
        base += .14;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .15;
      if(color == "41")
        base += .18;
      if(color == "20")
        base += .08;
      if(color == "10")
        base += .07;
      if(color == "21")
        base += .09;
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms.envelope.price.value = price.toFixed(2);
  //document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  //document.forms.envelope.upgrades.value = paper_upgrades;
}

// BUSINESS FORMS
function busforms() {
  // setting base values
  var quantity = document.forms[0].quantity.value;
  var color = document.forms[0].color[document.forms[0].color.selectedIndex].value;
  var size = document.forms[0].size[document.forms[0].size.selectedIndex].value;
  var addto = 0;
  var base = 0;
  
  var perforation = document.getElementById('perforation').checked;
  var numbering = document.getElementById('numbering').checked;
  var numberingval = document.getElementById('numbering-val').value;
  var numberingcolor = document.getElementById('numbering-color').selectedIndex.value;
  
  var paper_upgrades = "";
  
  if(perforation == true) {
    base += .01;
    paper_upgrades += "Perforation,";
  }
  if(numbering == true) {
    base += .02;
    document.getElementById('right-sub-opt').style.display = "block";
    paper_upgrades += "Numbering,";
  }
  else
    document.getElementById('right-sub-opt').style.display = "none";
  
  if(size == "8.5 x 11") {
    if(quantity < 101)  {
      if(color == "40")
        base += .57;
      if(color == "41")
        base += .77;
      if(color == "20")
        base += .42;
      if(color == "21")
        base += .62;
      if(color == "10")
        base += .4;
      if(color == "11")
        base += .6;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .47;
      if(color == "41")
        base += .62;
      if(color == "20")
        base += .37;
      if(color == "21")
        base += .52;
      if(color == "10")
        base += .24;
      if(color == "11")
        base += .39;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .37;
      if(color == "41")
        base += .47;
      if(color == "20")
        base += .27;
      if(color == "21")
        base += .37;
      if(color == "10")
        base += .2;
      if(color == "11")
        base += .3;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .22;
      if(color == "41")
        base += .29;
      if(color == "20")
        base += .2;
      if(color == "21")
        base += .27;
      if(color == "10")
        base += .15;
      if(color == "11")
        base += .22;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .17;
      if(color == "41")
        base += .22;
      if(color == "20")
        base += .12;
      if(color == "21")
        base += .17;
      if(color == "10")
        base += .11;
      if(color == "11")
        base += .16;
    }
  }
  
  if(size == "8.5 x 5.5") {
    if(quantity < 101)  {
      if(color == "40")
        base += .28;
      if(color == "41")
        base += .38;
      if(color == "20")
        base += .21;
      if(color == "21")
        base += .31;
      if(color == "10")
        base += .2;
      if(color == "11")
        base += .3;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .23;
      if(color == "41")
        base += .31;
      if(color == "20")
        base += .18;
      if(color == "21")
        base += .26;
      if(color == "10")
        base += .12;
      if(color == "11")
        base += .19;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .18;
      if(color == "41")
        base += .23;
      if(color == "20")
        base += .13;
      if(color == "21")
        base += .18;
      if(color == "10")
        base += .1;
      if(color == "11")
        base += .15;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .11;
      if(color == "41")
        base += .14;
      if(color == "20")
        base += .1;
      if(color == "21")
        base += .13;
      if(color == "10")
        base += .07;
      if(color == "11")
        base += .11;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .08;
      if(color == "41")
        base += .11;
      if(color == "20")
        base += .06;
      if(color == "21")
        base += .08;
      if(color == "10")
        base += .05;
      if(color == "11")
        base += .08;
    }
  }
  
  if(size == "4 x 5") {
    if(quantity < 101)  {
      if(color == "40")
        base += .14;
      if(color == "41")
        base += .19;
      if(color == "20")
        base += .1;
      if(color == "21")
        base += .15;
      if(color == "10")
        base += .1;
      if(color == "11")
        base += .15;
    }
    if(quantity > 100 && quantity < 251)  {
      if(color == "40")
        base += .12;
      if(color == "41")
        base += .15;
      if(color == "20")
        base += .09;
      if(color == "21")
        base += .13;
      if(color == "10")
        base += .06;
      if(color == "11")
        base += .1;
    }
    if(quantity > 250 && quantity < 501)  {
      if(color == "40")
        base += .09;
      if(color == "41")
        base += .12;
      if(color == "20")
        base += .07;
      if(color == "21")
        base += .09;
      if(color == "10")
        base += .05;
      if(color == "11")
        base += .07;
    }
    if(quantity > 500 && quantity < 1001)  {
      if(color == "40")
        base += .05;
      if(color == "41")
        base += .07;
      if(color == "20")
        base += .05;
      if(color == "21")
        base += .07;
      if(color == "10")
        base += .04;
      if(color == "11")
        base += .05;
    }
    if(quantity > 1000)  {
      if(color == "40")
        base += .04;
      if(color == "41")
        base += .05;
      if(color == "20")
        base += .03;
      if(color == "21")
        base += .04;
      if(color == "10")
        base += .03;
      if(color == "11")
        base += .04;
    }
  }
  
  var price = (quantity * base) + addto;
  document.forms[0].price.value = price.toFixed(2);
  document.getElementById('paper-upgrades').innerHTML = paper_upgrades.replace(/,/g,"<br />");
  document.forms[0].upgrades.value = paper_upgrades;
}