   function enlargeImage() {
      var obj;
      var obj1;
      obj = document.getElementById("imageText");
      if (obj.innerHTML == "Enlarge Image(s)") {
         obj.innerHTML = "Shrink Image(s)";
         obj = document.getElementById("viewImage1");
         if (obj) {
            obj1 = document.form0.imageLarge1;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage2");
         if (obj) {
            obj1 = document.form0.imageLarge2;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage3");
         if (obj) {
            obj1 = document.form0.imageLarge3;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage4");
         if (obj) {
            obj1 = document.form0.imageLarge4;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage5");
         if (obj) {
            obj1 = document.form0.imageLarge5;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage6");
         if (obj) {
            obj1 = document.form0.imageLarge6;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
      }
      else  {
         obj.innerHTML = "Enlarge Image(s)";
         obj = document.getElementById("viewImage1");
         if (obj) {
            obj1 = document.form0.image1;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage2");
         if (obj) {
            obj1 = document.form0.image2;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage3");
         if (obj) {
            obj1 = document.form0.image3;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage4");
         if (obj) {
            obj1 = document.form0.image4;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage5");
         if (obj) {
            obj1 = document.form0.image5;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
         obj = document.getElementById("viewImage6");
         if (obj) {
            obj1 = document.form0.image6;
            if (obj1) {obj.innerHTML = obj1.value;}
         }
      }
   }
    
    function checkQuantity(value1, txtbox, frm, alrt)
    {
        pfrm = document.PersonalizationForm
        strTemp = ''
                        
        if (pfrm.PersonalizationQuestionCounter.value != 0)
        {
            for (i=1; i <= pfrm.PersonalizationQuestionCounter.value; i++)
            {
                if (pfrm.elements["PersonalizationRequired" + i].value == "true" && 
                    pfrm.elements["PersonalizationAnswer" + i].value == "")
                {
                    if (alrt==true)
                    alert("Please answer all required personalization questions!");

                    return false
                }
                
                strTemp = strTemp + '<br>&nbsp;&nbsp;' + pfrm.elements["PersonalizationQuestion" + i].value + '&nbsp;&nbsp;' + pfrm.elements["PersonalizationAnswer" + i].value
            }			
            frm.PersonalizationQandA.value = strTemp				
        }					

        //value2 = txtbox.value
        var istrue=0
        value2=0
            frm =document.form0;
            

        if(istrue==1){
         if(alrt==true){
            alert("Please enter a valid quantity");
         }
         return false;
         }
        else if(istrue==2){	
         if(alrt==true){
            alert("The minimum quantity for this product is " + value1);	
         }
         return false;
         }
        else
            return true;
    }

    function checkQuantitySetPrice(value1, txtbox, frm_next)
    {
        frm = document.form0
        description_text = ""
        total_price = 0
        if(frm.GroupCounter.value!=-1) {
        for (i = 1; i <= frm.GroupCounter.value; i++)
        {
            ind = frm.elements["VariantGroup" + i].selectedIndex
            description_text += frm.elements["VariantGroup" + i][ind].value + ";"
            if(parseFloat(frm.elements["variant" + i + "_" + (ind + 1)].value)!=0) {														
                total_price += parseFloat(frm.elements["variant" + i + "_" + (ind + 1)].value)
            }
        }
            if(checkQuantity(value1, txtbox, frm_next,false)==true) {
                frm.elements["ProdVarIDDesc"].value = description_text			
                frm.elements["ProdPrice"].value = parseFloat(frm.elements["ProdPrice"].value) + total_price
            }
        }
        //return false
        if (frm.elements["ProdPrice"].value <= 0){alert('You have selected an invalid combination of product options');return false;}
        return checkQuantity(value1, txtbox, frm_next,true)
    }

    function DecimalRound(PassValue, deci, nopad) //Rounds number to the nearest decimal place 
    { 
        var count; 
        var temp = new Array(2); 
        if (!deci && deci != "0")deci=2;  
        PassValue = ((Math.round((PassValue * Math.pow(10, deci)))) / (Math.pow(10, deci))) 
        if (!nopad)
        {
            temp = PassValue.toString();
            temp = temp.split(".");  
            if (!temp[1]) temp[1]="0"; 
            for (count = 0; temp[1].length < deci; count++)
            {
                temp[1] = temp[1] + "0"
            }
            if (!deci){	PassValue = temp[0];}else{PassValue = temp.join(".");} 
        }
        return PassValue;
    }
    function formatCurrency(num) {
        num = num.toString().replace(/\$|\,/g,'');
        if(isNaN(num))
        num = "0";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num*100+0.50000000001);
        cents = num%100;
        num = Math.floor(num/100).toString();
        if(cents<10)
        cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+','+
        num.substring(num.length-(4*i+3));
    return (((sign)?'':'-') + '$' + num + '.' + cents);
    }

    function UpdatePrice() {
        /*get browser version*/
        var ie4=document.all;                            /*IE 4 or greater browsers*/
        var ns6=document.getElementById&&document.all;   /*6 or greater netscape browsers*/
        var ns4=document.layers;                         /* the lonely netscape 4 browsers */
    
        frm = document.form0
        if(frm.cntval != null){
            var cnt = frm.cntval.value;
            var qty;
            if(frm.pqty!=null)
                var qty = frm.pqty.value;
            else
                var qty = 1;
            
            description_text = ""
            var total_price_discountable = 0
            var total_price_not_discountable = 0
            var profit = parseFloat(frm.productProfit.value);
            var cost;
            var price;
            var list;
            var option_cost = 0;
            var option_list = 0;
            var option_profit = 0;
            var qdiscamt;
            var unitspercase = 1;
            var opt_unit = 1;
            
            price = parseFloat(frm.elements["ProdPrice"].value) /*get the initial price of the product*/
            cost = parseFloat(frm.elements["ProdCost"].value) /*get the initial cost of the product*/
            list = parseFloat(frm.elements["ProdList"].value) /*get the initial list price of the product*/
        
            if(frm.GroupCounter!=null) {
                /*If there are actually variants(based on the count of variant groups)*/
                
                if (frm.GroupCounter.value!=-1) {
                    /*assure there is something in the array*/ 
                    for (i = 1; i <= frm.GroupCounter.value; i++) {
                        ind = frm.elements["VariantGroup" + i].selectedIndex
                        description_text += frm.elements["VariantGroup" + i][ind].value + ";"
                        if(frm.elements["variantnd" + i + "_" + (ind + 1)].value == "0") {
                            total_price_discountable += parseFloat(frm.elements["variant" + i + "_" + (ind + 1)].value);}
                        else {
                            total_price_not_discountable += parseFloat(frm.elements["variant" + i + "_" + (ind + 1)].value);
                            }
                        option_cost += parseFloat(frm.elements["variantoc" + i + "_" + (ind + 1)].value);
                        option_list += parseFloat(frm.elements["variantlp" + i + "_" + (ind + 1)].value);
                        if (frm.elements["variantu" + i + "_" + (ind + 1)].value != "0") {
                           unitspercase = frm.elements["variantu" + i + "_" + (ind + 1)].value;
                        }
                        if (frm.elements["variantu" + i + "_" + (ind + 1)].value > "1") {
                           opt_unit = frm.elements["variantu" + i + "_" + (ind + 1)].value;
                        }
                    }
                    frm.elements["ProdVarIDDesc"].value = description_text			
                    
                    if(true){
                        if (frm.OptionOnly != null && frm.OptionOnly.checked) {
                            price = 0           // when option only is checked do not add cost of product
                            cost = 0            // when option only is checked do not add cost of product
                            list = 0            // when option only is checked do not add list of product
                        }
                        var totPrice = price + total_price_discountable /*add it to the variant cost*/
                        
                        if (document.getElementById("oprice")) {
                            qdiscamt = 0;
                            for(x=0;x!=cnt;++x) {
                                var discamt = frm.elements["damt"+x].value
                                if(parseInt(frm.elements["lbound" + x].value) <= parseInt(frm.pqty.value) && parseInt(frm.elements["ubound" + x].value) >= parseInt(frm.pqty.value)) {
                                    if(frm.elements["percent" + x].value==1)
                                        qdiscamt = parseFloat(totPrice-(totPrice*discamt));
                                    else if (frm.elements["peritm"+x].value==1 && frm.elements["percent" + x].value!=1) 
                                        qdiscamt = parseFloat(totPrice-discamt);
                                }
                                obj = document.getElementById("disc"+x);
                                if(frm.elements["percent" + x].value==1)
                                    obj.innerHTML = formatCurrency(parseFloat(totPrice-(totPrice*discamt)+total_price_not_discountable));
                                else if(frm.elements["peritm"+x].value==1 && frm.elements["percent" + x].value!=1)
                                    obj.innerHTML = formatCurrency(parseFloat(totPrice-discamt+total_price_not_discountable));
                                else
                                    obj.innerHTML = formatCurrency(parseFloat(discamt+total_price_not_discountable)) + " <small>off entire cart</small>";
                            
                                obj = document.getElementById("price_per_case"+x);
                                
                                if (obj) {
                                    if(frm.elements["percent" + x].value==1)
                                        obj.innerHTML = formatCurrency(parseFloat((totPrice-(totPrice*discamt)+total_price_not_discountable)/unitspercase));
                                    else if(frm.elements["peritm"+x].value==1 && frm.elements["percent" + x].value!=1)
                                        obj.innerHTML = formatCurrency(parseFloat((totPrice-discamt+total_price_not_discountable)/unitspercase));
                                    else
                                        obj.innerHTML = formatCurrency(parseFloat((discamt+total_price_not_discountable)/unitspercase)) + " <small>off entire cart</small>";
                                }
                            }
                            qty = frm.ProdQty0.value;
                            if (totPrice + total_price_not_discountable == 0) {
                                calcLease (0, 0);
                                document.getElementById("oprice").innerHTML = "<font class=price>Select Options Below</font>";}
                            else if (qdiscamt != 0) {
                                qdiscamt += total_price_not_discountable
                                calcLease (qty, qdiscamt);
                                document.getElementById("oprice").innerHTML = "<font class=price>" + formatCurrency(qdiscamt*qty) + "</font>";
                                if (document.getElementById("oyousave")) {
                                    document.getElementById("oyousave").innerHTML = formatCurrency((list+option_list-qdiscamt)*qty);
                                }
                                if (document.getElementById("profit")) {
                                    profit = qdiscamt-(cost+option_cost)
                                    document.getElementById("profit").innerHTML = formatCurrency(profit*qty);
                                }
                                if (document.getElementById("cost")) {
                                    document.getElementById("cost").innerHTML = formatCurrency((cost+option_cost)*qty);
                                }
                            }
                            else {
                                totPrice += total_price_not_discountable
                                calcLease (qty, totPrice);
                                document.getElementById("oprice").innerHTML = "<font class=price>" + formatCurrency(totPrice*qty) + "</font>";
                                if (document.getElementById("oyousave")) {
                                    document.getElementById("oyousave").innerHTML = formatCurrency(((list + option_list)-totPrice)*qty);
                                }
                                if (document.getElementById("profit")) {
                                    document.getElementById("profit").innerHTML = formatCurrency((totPrice-(cost+option_cost))*qty)
                                }
                                if (document.getElementById("cost")) {
                                    document.getElementById("cost").innerHTML = formatCurrency((cost+option_cost)*qty);
                                }
                            }
                            if (document.getElementById("olist")) {
                                document.getElementById("olist").innerHTML = "<font class=listprice>" + formatCurrency((list + option_list)*qty) + "</font>";
                            }
                        }
                    }
                }
                else {
                    if (document.getElementById("profit")) {
                        document.getElementById("profit").innerHTML = formatCurrency(profit*qty)
                    }
                    if (document.getElementById("olist")) {
                        document.getElementById("olist").innerHTML = "<font class=listprice>" + formatCurrency(list*qty) + "</font>";
                    }
                    if (document.getElementById("oyousave")) {
                        document.getElementById("oyousave").innerHTML = formatCurrency((list-cost)*qty);
                    }
                    if (document.getElementById("cost")) {
                        document.getElementById("cost").innerHTML = formatCurrency(cost*qty);
                    }
                    
                    qdiscamt = 0;
                    totPrice = frm.ProdPrice.value;
                    for(x=0;x!=cnt;++x) {
                        var discamt = frm.elements["damt"+x].value
                        if(parseInt(frm.elements["lbound" + x].value) <= parseInt(frm.pqty.value) && parseInt(frm.elements["ubound" + x].value) >= parseInt(frm.pqty.value)) {
                            if(frm.elements["percent" + x].value==1)
                                qdiscamt = parseFloat( totPrice - (totPrice * discamt));
                            else if (frm.elements["peritm"+x].value==1 && frm.elements["percent" + x].value!=1) 
                                qdiscamt = parseFloat(totPrice-discamt);
                        }
                        obj = document.getElementById("disc"+x);
                        if(frm.elements["percent" + x].value==1)
                            obj.innerHTML = formatCurrency(parseFloat( totPrice - (totPrice * discamt)));
                        else if(frm.elements["peritm"+x].value==1 && frm.elements["percent" + x].value!=1)
                            obj.innerHTML = formatCurrency(parseFloat(totPrice-discamt));
                        else
                            obj.innerHTML = formatCurrency(parseFloat(discamt)) + " <small>off entire cart</small>";
                    }
                    if (qdiscamt != 0) {
                        document.getElementById("oprice").innerHTML = "<font class=price>" + formatCurrency(qdiscamt*qty) + "</font>";
                    }
                    else {
                        document.getElementById("oprice").innerHTML = "<font class=price>" + formatCurrency(totPrice*qty) + "</font>";
                    }
                    calcLease (qty, parseFloat(frm.elements["ProdPrice"].value));
                }
            }
        }
        
        // if units is > 1 then this is a tank, if the spec window is open, then fill in the tank field and run the code.
        if (document.specForm) {
           if (document.specForm.newTankSize) {
              if (opt_unit > "1") {
                 document.specForm.newTankSize.value = opt_unit;
                 calcFuelUse();
              }
              else {
                 document.specForm.newTankSize.value = "";
                 calcFuelUse();
              }
           }
        }
    }
    
   function doblink() {
         if (document.all["cartMsg"] != null) {
            if ((document.all["cartMsg"].style.visibility == "visible") || (document.all["cartMsg"].style.visibility == "")) {
                document.all["cartMsg"].style.visibility = "hidden";
            }
            else {
                document.all["cartMsg"].style.visibility = "visible";
            }
         }
   }
   function showAnimation() {
      document.showAnim.submit();
      return false;
   }

   var loc = "images/themes/backup/";
   var gtype = ".gif";
   while(typeof(document[name])!="undefined") name += "x";
   
   function turn_over_1(name) {
   	if (document.images != null && clicked != name) {
   		document[name].src = document[name+"_over"].src;
   	}
   }
   
   function turn_off_1(name) {
   	if (document.images != null && clicked != name) {
   		document[name].src = document[name+"_off"].src;
   	}
   }
   
   function reg(gname,name) {
      if (document.images) {
         document[name+"_off"] = new Image();
         document[name+"_off"].src = loc+gname+gtype;
         document[name+"_over"] = new Image();
         document[name+"_over"].src = loc+gname+"_over"+gtype;}
   }
   reg ("go_b1", "go_b1");
   reg ("go_search", "go_search");

   function updatePackageQty(frm, id) {
      var price;
      var obj;
      var qty;
      
      if (isNaN(frm.ProdQty0.value)) {
         return;
      }
      else {
         qdiscamt = 0;
         price = frm.prodPrice.value;
         mainFrm = document.form0;
         qty = frm.ProdQty0.value;
         var cnt = mainFrm.cntval.value;
         
         for(x=0;x!=cnt;++x) {
             var discamt = mainFrm.elements["damt"+x].value;
             if(parseInt(mainFrm.elements["lbound" + x].value) <= parseInt(qty) && parseInt(mainFrm.elements["ubound" + x].value) >= parseInt(qty)) {
                 if(mainFrm.elements["percent" + x].value==1)
                     qdiscamt = parseFloat( price - (price * discamt));
                 else if (mainFrm.elements["peritm"+x].value==1 && mainFrm.elements["percent" + x].value!=1) 
                     qdiscamt = parseFloat(price-discamt);
             }
             obj = document.getElementById("disc"+x);
             if(mainFrm.elements["percent" + x].value==1)
                 obj.innerHTML = formatCurrency(parseFloat( price - (price * discamt)));
             else if(mainFrm.elements["peritm"+x].value==1 && mainFrm.elements["percent" + x].value!=1)
                 obj.innerHTML = formatCurrency(parseFloat(price-discamt));
             else
                 obj.innerHTML = formatCurrency(parseFloat(discamt)) + " <small>off entire cart</small>";
         }
         if (! isNaN(price)) {
            if (qdiscamt != 0) {
               obj = document.getElementById("ourPrice"+id);
               if (obj) {obj.innerHTML = formatCurrency(qdiscamt*qty);}
            }
            else {
               obj = document.getElementById("ourPrice"+id);
               if (obj) {obj.innerHTML = formatCurrency(price*qty);}
            }
         }
      }
   }
   
   function requestInfo(id) {
      window.open("request-info.asp?ids="+id, "_blank")
   }
   
   function expandOptionGroup(theCode) {
      var frm = document.varForm;
      var hid = frm.unfoldedGroups.value;
      
      if (hid=="") {
         frm.unfoldedGroups.value=theCode;
      }
      else {
         frm.unfoldedGroups.value=hid+','+theCode;
      }
      frm.submit();
      return false;      
   }
   
   function collapseOptionGroup(theCode) {
      var frm = document.varForm;
      var hid = frm.unfoldedGroups.value;
   
      if (hid==theCode) {
         frm.unfoldedGroups.value="";
      }
      else {
         frm.unfoldedGroups.value=hid.replace(theCode+",","");
      }
      frm.submit();
      return false;      
   }

   function launchHelp() {
      //AC_VHost_Embed_347435(160, 400, '', 1, 1, , 0, 1, 0, , 6, '400|158|50|1|L|T|false|1|1|1|0|http%3A//vhss-a.oddcast.com/ccs2/vhss/user/a65/347435/thumbs/show_1465370.jpg|Double%20click%20to%20play%20me|0|C|0|0|0|1597');
      AC_VHost_Embed_347435(150, 400, '', 1, 1, document.helpForm.helpContext.value, 0, 1, 0, document.helpForm.helpContextGuid.value, 6, '400|158|15|15|L|T|false|1|1|1|0|http%3A//vhss-a.oddcast.com/ccs2/vhss/user/a65/347435/thumbs/show_1465365.jpg|Double%20click%20to%20play%20me|0|C|-1|0|0|869');
   }
   function launchHelpSpecific(x, y) {
      //AC_VHost_Embed_347435(160, 400, '', 1, 1, x, 0, 1, 0, y, 6, '400|158|50|1|L|T|false|1|1|1|0|http%3A//vhss-a.oddcast.com/ccs2/vhss/user/a65/347435/thumbs/show_1465370.jpg|Double%20click%20to%20play%20me|0|C|0|0|0|1597');
      AC_VHost_Embed_347435(150, 400, '', 1, 1, x, 0, 1, 0, y, 6, '400|158|15|15|L|T|false|1|1|1|0|http%3A//vhss-a.oddcast.com/ccs2/vhss/user/a65/347435/thumbs/show_1465365.jpg|Double%20click%20to%20play%20me|0|C|-1|0|0|869');
   }   
