//<!--

//Load images for Javascript manipulation

  if(document.images) {
    footer_out=new Image
    footer_over=new Image
    snack_attack=new Image
    premium=new Image
    standard=new Image
    cheeze_lover=new Image
    blank_pack=new Image
    choice=new Image
    traditional=new Image
    blank_std=new Image

    footer_out.src="images/ftr_right_out.gif"
    footer_over.src="images/ftr_right_ovr.gif"
    snack_attack.src="images/snack_attack.gif"
    premium.src="images/premium.gif"
    standard.src="images/standard.gif"
    cheeze_lover.src="images/cheeze_lover.gif"
    blank_pack.src="images/blank_pack.gif"
    choice.src="images/choice.gif"
    traditional.src="images/traditional.gif"
    blank_std.src="images/blank_std.gif"
  }

  else {
    footer_out=""
    footer_over=""
    snack_attack=""
    premium=""
    standard=""
    cheeze_lover=""
    blank_pack=""
    choice=""
    traditional=""
    blank_std=""
    document.links=""
  }


// 664210870
// This script is (C) Copyright 2004 Jim Tucek
// Leave these comments alone!  For more info, visit
// www.jracademy.com/~jtucek/email/ 

function have(steel,sponge,shrub) {
  steel += ' ';
  var cleverness = steel.length;
  var atmosphere = 0;
  var camera = '';
  for(var fuel = 0; fuel < cleverness; fuel++) {
    atmosphere = 0;
    while(steel.charCodeAt(fuel) != 32) {
      atmosphere = atmosphere * 10;
      atmosphere = atmosphere + steel.charCodeAt(fuel)-48;
      fuel++;
    }
    camera += String.fromCharCode(overtake(atmosphere,sponge,shrub));
  }
  parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+camera;
}

function know(opposite,drawing,money) {
  opposite += ' ';
  var emotion = opposite.length;
  var encounter = 0;
  for(var space = 0; space < emotion; space++) {
    encounter = 0;
    while(opposite.charCodeAt(space) != 32) {
      encounter = encounter * 10;
      encounter = encounter + opposite.charCodeAt(space)-48;
      space++;
    }
    //document.write('&');
    //document.write('#');
    //document.write(overtake(encounter,drawing,money));
    document.write(String.fromCharCode(overtake(encounter,drawing,money)));
  }
}

function overtake(hope,fraction,icon) {
  if (icon % 2 == 0) {
    incredulity = 1;
    for(var pencil = 1; pencil <= icon/2; pencil++) {
      integrity = (hope*hope) % fraction;
      incredulity = (integrity*incredulity) % fraction;
    }
  } else {
    incredulity = hope;
    for(var month = 1; month <= icon/2; month++) {
      integrity = (hope*hope) % fraction;
      incredulity = (integrity*incredulity) % fraction;
    }
  }
  return incredulity;
}


// Sets Special Assortment selections
//
function setSpecialAssortment() {

  var temp = document.getElementById('spec0').value; 
  document.getElementById('4opt0').value = temp;
  document.getElementById('5opt0').value = temp;

  var temp = document.getElementById('spec1').value; 
  document.getElementById('4opt1').value = temp;
  document.getElementById('5opt1').value = temp;

  var temp = document.getElementById('spec2').value; 
  document.getElementById('4opt2').value = temp;
  document.getElementById('5opt2').value = temp;
}


// Calculates Goody Box price from selected items and loads price form field
// 
function setGBPrice(product){
  var opt0Val = "";
  var count;
  var shipUnit;
  var tempVal;
  var temp;


  temp = document.getElementById('item' + product + '0').value; 
  if (temp != "Item 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (j=i+1; j<temp.length; j++) {
          opt0Val = opt0Val + temp.charAt(j);
        }
      }
    }
  }
  opt0Val = (+opt0Val);
  var runningTotal = opt0Val;

  for (count=1; count<24; count++) {
    tempVal="";
    try {
      temp = document.getElementById('item' + product + count).value;
      if (temp != "Item " + count + 1) {
        for (i=0; i<temp.length; i++) {
          if (temp.charAt(i) == ";") {
            for (j=i+1; j<temp.length; j++) {
              tempVal = tempVal + temp.charAt(j);
            }
          }
        }
      }
    }
    catch(err) { }
    tempVal = (+tempVal);
    runningTotal = runningTotal + tempVal;
  }

  document.getElementById('p' + product).value = "$" + runningTotal.toFixed(2);
}


// First step of the build-your-own popcorn tin selection tool
// Calculates and loads a page based on the size & fill input form fields
//
function selectTinPage() {
  var size;
  var fill;
  var newPage;

  size = document.getElementById('getSize').value;

  if (size == "") {
    return;
  }
  if (size == "10") {
    newPage = 'http://www.dadscookies.com/select101.htm';
    window.location.href = newPage;
    return;
  }

  fill = document.getElementById('getFill').value;
  if (fill == "") {
    return;
  }

  newPage = 'http://www.dadscookies.com/select' + size + fill + '.htm';
  window.location.href = newPage;
}


// Second step of the build-your-own popcorn tin selection tool
// Calculates total price from selected flavors and loads price form field
// 
function setSelectPrice(prodnum){
  var opt0Val = "";
  var opt1Val = "";
  var opt2Val = "";
  var temp;

  temp = document.getElementById('flavor' + prodnum + '0').value; 
  if (temp != "Flavor 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (j=i+1; j<temp.length; j++) {
          opt0Val = opt0Val + temp.charAt(j);
        }
      }
    }
  }
  opt0Val = (+opt0Val);

  try {
    temp = document.getElementById('flavor' + prodnum + '1').value;
    if (temp != "Flavor 2;n") {
      for (i=0; i<temp.length; i++) {
        if (temp.charAt(i) == ";") {
          for (j=i+1; j<temp.length; j++) {
            opt1Val = opt1Val + temp.charAt(j);
          }
        }
      }
    }
  }
  catch(err) { }
  opt1Val = (+opt1Val);

  try {
    temp = document.getElementById('flavor' + prodnum + '2').value;
    if (temp != "Flavor 3;n") {
      for (i=0; i<temp.length; i++) {
        if (temp.charAt(i) == ";") {
          for (j=i+1; j<temp.length; j++) {
            opt2Val = opt2Val + temp.charAt(j);
          }
        }
      }
    }
  }
  catch(err) { }
  opt2Val = (+opt2Val);

  var finalValue = opt0Val + opt1Val + opt2Val 
  document.getElementById('tin' + prodnum).value = "$" + finalValue.toFixed(2);
}


// First step of single-flavor popcorn tin selection
// Sets price in price form field
//
function setSinglePrice() {
  var price = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Flavor 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (j=i+1; j<temp.length; j++) {
          price = price + temp.charAt(j);
        }
      }
    }
  }
  price = (+price);

  document.getElementById('tinprice').value = "$" + price.toFixed(2);
}


// Second step of single-flavor popcorn tin selection
// Loads selected flavor, tin decoration, and quantity in the form fields
// then submits the form to ShopSite when the Add To Cart button is clicked
//
function submitSingleTin() {
  var prodnum = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Flavor 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
	for (k=0; k<i; k++) {
          prodnum = prodnum + temp.charAt(k);
        }
      }
    }
  }
  prodnum = (+prodnum);

  // customer MUST select a flavor to continue
  if (prodnum == "Flavor 1;n") {
    return;
  }

  // get tin decoration
  var tinstyle = document.getElementById('tintype').value;

  // load selected values into form input tags
  document.getElementById('tin' + prodnum).value = tinstyle;

  // submit the selected form
  switch(prodnum) {
    case 7 :	document.item7.submit();	break;
    case 8 :	document.item8.submit();	break;
    case 9 :	document.item9.submit();	break;
    case 10 :	document.item10.submit();	break;
    case 11 :	document.item11.submit();	break;
    case 12 :	document.item12.submit();	break;

    case 27 :	document.item27.submit();	break;
    case 28 :	document.item28.submit();	break;
    case 29 :	document.item29.submit();	break;

    case 30 :	document.item30.submit();	break;
    case 31 :	document.item31.submit();	break;
    case 32 :	document.item32.submit();	break;
    case 33 :	document.item33.submit();	break;
    case 34 :	document.item34.submit();	break;
    case 35 :	document.item35.submit();	break;
    case 36 :	document.item36.submit();	break;
    case 37 :	document.item37.submit();	break;
    case 38 :	document.item38.submit();	break;
    case 39 :	document.item39.submit();	break;

    case 40 :	document.item40.submit();	break;
    case 41 :	document.item41.submit();	break;
    case 42 :	document.item42.submit();	break;
    case 43 :	document.item43.submit();	break;
    case 44 :	document.item44.submit();	break;
    case 45 :	document.item45.submit();	break;
    case 46 :	document.item46.submit();	break;
    case 47 :	document.item47.submit();	break;
    case 48 :	document.item48.submit();	break;
    case 49 :	document.item49.submit();	break;

    case 50 :	document.item50.submit();	break;
    case 51 :	document.item51.submit();	break;
    case 52 :	document.item52.submit();	break;
    case 53 :	document.item53.submit();	break;
    case 54 :	document.item54.submit();	break;
    case 55 :	document.item55.submit();	break;
    case 56 :	document.item56.submit();	break;
    case 57 :	document.item57.submit();	break;
    case 58 :	document.item58.submit();	break;
    case 59 :	document.item59.submit();	break;

    case 60 :	document.item60.submit();	break;
    case 61 :	document.item61.submit();	break;
    case 62 :	document.item62.submit();	break;
    case 63 :	document.item63.submit();	break;
    case 64 :	document.item64.submit();	break;
    case 65 :	document.item65.submit();	break;
    case 66 :	document.item66.submit();	break;
    case 67 :	document.item67.submit();	break;
    case 68 :	document.item68.submit();	break;
    case 69 :	document.item69.submit();	break;

    case 70 :	document.item70.submit();	break;
  }
}


// First step of Gift Pack selection
// Sets price in price form field
//
function setGPPrice() {
  var prodnum = "";
  var price = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Gift Pack;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (k=0; k<i; k++) {
         prodnum = prodnum + temp.charAt(k);
        }
        for (j=i+1; j<temp.length; j++) {
          price = price + temp.charAt(j);
        }
      }
    }
  }
  prodnum = (+prodnum);
  price = (+price);

  // set price
  document.getElementById('tinprice').value = "$" + price.toFixed(2);

  // display product image
  switch(prodnum) {
    case 13 :
      document.gift_pack.src=cheeze_lover.src;
      str1 = "<font face=Verdana color=#000080><b>Cheeze Lover Gift Pack</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon decorative tin with bags of Cheddar, White Cheddar, Choice Cheddar, and Triple Mix Popcorns along with Honey Roasted Peanuts and a 3-Pack of <em>Dad's Original Scotch Oatmeal&trade; Cookies</em>.</font>";
      break;
    case 14 :
      document.gift_pack.src=premium.src;
      str1 = "<font face=Verdana color=#000080><b>Premium Gift Pack</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon decorative tin with bags of Choice Cheddar, Butter Almond Pecan, Caramel, and Chocolate Pecan Caramel Popcorns along with a 3-Pack of Chocolate-Dipped <em>Dad's Original Scotch Oatmeal&trade; Cookies</em> and a Chocolate Caramel Pecan Pretzel Rod.</font>";
      break;
    case 15 :
      document.gift_pack.src=snack_attack.src;
      str1 = "<font face=Verdana color=#000080><b>Snack Attack Gift Pack</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon decorative tin with bags of Butter Flavored, White Cheddar, Choice Cheddar, and Triple Mix Popcorns along with Honey Roasted Peanuts and a 3-Pack of <em>Dad's Original Scotch Oatmeal&trade; Cookies</em>.</font>";
      break;
    case 16 :
      document.gift_pack.src=standard.src;
      str1 = "<font face=Verdana color=#000080><b>Standard Gift Pack</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon decorative tin with bags of Cheddar, Choice Cheddar, Caramel, and Triple Mix Popcorns along with Honey Roasted Peanuts and a 3-Pack of Chocolate-Dipped <em>Dad's Original Scotch Oatmeal&trade; Cookies</em>.</font>";
      break;
    default :
      document.gift_pack.src=blank_pack.src;
      str1 = "<font face=Verdana color=#000080><b>Gift Pack";
      str2 = " ";
  }

  // display description
  document.getElementById('descr_1').innerHTML = str1;
  document.getElementById('descr_2').innerHTML = str2;
}


// Second step of Gift Pack selection
// Loads selected flavor, tin decoration, and quantity in the form fields
// then submits the form to ShopSite when the Add To Cart button is clicked
//
function submitGiftPack() {
  var prodnum = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Gift Pack;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (k=0; k<i; k++) {
          prodnum = prodnum + temp.charAt(k);
        }
      }
    }
  }
  prodnum = (+prodnum);

  // customer MUST select a flavor to continue
  if (prodnum == "Gift Pack;n") {
    return;
  }

  // get tin decoration
  var tinstyle = document.getElementById('tintype').value;

  // load selected values into form input tags
  document.getElementById('tin' + prodnum).value = tinstyle;

  // submit selected form
  switch(prodnum) {
    case 13 :	document.item13.submit();	break;
    case 14 :	document.item14.submit();	break;
    case 15 :	document.item15.submit();	break;
    case 16 :	document.item16.submit();	break;
  }
}


// Open a 400pixel x 450pixel popup with a web page using: <a href=javascript:openWindow('mypage.htm')></a>
//
function openWindow(pg_name) {
  var leftPos = (screen.width - 400)/2;
  var topPos = (screen.height - 450)/2;

  newWindow = window.open( pg_name, 'newWin', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,location=no,width=400,height=450,left=' + leftPos + ',top=' + topPos + '');
}


// Opens & centers an image popup, sized 24 pixels greatear than the image dimensions
// Call with: <a href="images/myimage.jpg" target="_blank" onclick="goImgWin('images/myimage.jpg',width,height); return false;"></a>
//
function goImgWin(myImage, myWidth, myHeight) {
  myHeight += 24;
  myWidth += 24;
  var leftPos = (screen.width - myWidth)/2;
  var topPos = (screen.height - myHeight)/2;

  TheImgWin = window.open(myImage,'image','height=' + myHeight + ',width=' + myWidth + ',left=' + leftPos + ',top=' +topPos + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  TheImgWin.focus();
}


// Opens & centers a popup page using:  <a href=javascript:openPage('mypage.htm',width,height)></a>
//
function openPage(myPage, myWidth, myHeight) {
  var leftPos = (screen.width - myWidth)/2;
  var topPos = (screen.height - myHeight)/2;

  newWindow = window.open(myPage,'newWin','height=' + myHeight + ',width=' + myWidth + ',left=' + leftPos + ',top=' +topPos + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}


// First step of Standard Fill selection
// Sets price in price form field
//
function setStdFillPrice() {
  var prodnum = "";
  var price = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Flavor 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (k=0; k<i; k++) {
         prodnum = prodnum + temp.charAt(k);
        }
        for (j=i+1; j<temp.length; j++) {
          price = price + temp.charAt(j);
        }
      }
    }
  }
  prodnum = (+prodnum);
  price = (+price);

  // set price
  document.getElementById('tinprice').value = "$" + price.toFixed(2);

  // display product image
  switch(prodnum) {
    case 7 :
      document.std_fill.src=choice.src;
      str1 = "<font face=Verdana color=#000080><b>Choice Fill</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Choice Cheddar  popcorn.</font>";
      break;
    case 8 :
      document.std_fill.src=choice.src;
      str1 = "<font face=Verdana color=#000080><b>Choice Fill</b></font>";
      str2 = "<font face=Arial size=2>A 3.5-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Choice Cheddar  popcorn.</font>";
      break;
    case 9 :
      document.std_fill.src=choice.src;
      str1 = "<font face=Verdana color=#000080><b>Choice Fill</b></font>";
      str2 = "<font face=Arial size=2>A 6.5-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Choice Cheddar  popcorn.</font>";
      break;
    case 10 :
      document.std_fill.src=traditional.src;
      str1 = "<font face=Verdana color=#000080><b>Traditional Fill</b></font>";
      str2 = "<font face=Arial size=2>A 2-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Cheddar Cheese  popcorn.</font>";
      break;
    case 11 :
      document.std_fill.src=traditional.src;
      str1 = "<font face=Verdana color=#000080><b>Traditional Fill</b></font>";
      str2 = "<font face=Arial size=2>A 3.5-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Cheddar Cheese  popcorn.</font>";
      break;
    case 12 :
      document.std_fill.src=traditional.src;
      str1 = "<font face=Verdana color=#000080><b>Traditional Fill</b></font>";
      str2 = "<font face=Arial size=2>A 6.5-gallon, 3-compartment decorative tin filled with Caramel, Butter, and Cheddar Cheese  popcorn.</font>";
      break;
    default :
      document.std_fill.src=blank_std.src;
      str1 = "<font face=Verdana color=#000080><b>Flavor 1</b></font>";
      str2 = " ";
  }

  // display description
  document.getElementById('descr_1').innerHTML = str1;
  document.getElementById('descr_2').innerHTML = str2;
}


// Second step of Standard Fill selection
// Loads selected flavor, tin decoration, and quantity in the form fields
// then submits the form to ShopSite when the Add To Cart button is clicked
//
function submitStdFill() {
  var prodnum = "";
  var temp = "";

  temp = document.getElementById('itemnum').value; 
  if (temp != "Flavor 1;n") {
    for (i=0; i<temp.length; i++) {
      if (temp.charAt(i) == ";") {
        for (k=0; k<i; k++) {
          prodnum = prodnum + temp.charAt(k);
        }
      }
    }
  }
  prodnum = (+prodnum);

  // customer MUST select a flavor to continue
  if (prodnum == "Flavor 1;n") {
    return;
  }

  // get tin decoration
  var tinstyle = document.getElementById('tintype').value;

  // load selected values into form input tags
  document.getElementById('tin' + prodnum).value = tinstyle;

  // submit selected form
  switch(prodnum) {
    case 7 :	document.item7.submit();	break;
    case 8 :	document.item8.submit();	break;
    case 9 :	document.item9.submit();	break;
    case 10 :	document.item10.submit();	break;
    case 11 :	document.item11.submit();	break;
    case 12 :	document.item12.submit();	break;
  }
}


// -->


